diff --git a/etgtools/extractors.py b/etgtools/extractors.py index 998a5b01..5d8e83bb 100644 --- a/etgtools/extractors.py +++ b/etgtools/extractors.py @@ -243,6 +243,7 @@ class FunctionDef(BaseDef): self.deprecated = False # is the function deprecated self.factory = False # a factory function that creates a new instance of the return value self.pyReleaseGIL = False # release the Python GIL for this function call + self.pyHoldGIL = False # hold the Python GIL for this function call self.noCopy = False # don't make a copy of the return value, just wrap the original self.pyInt = False # treat char types as integers self.transfer = False # transfer ownership of return value to C++? @@ -270,6 +271,9 @@ class FunctionDef(BaseDef): def releaseGIL(self, release=True): self.pyReleaseGIL = release + def holdGIL(self, hold=True): + self.pyHoldGIL = hold + def setCppCode_sip(self, code): """ diff --git a/etgtools/sip_generator.py b/etgtools/sip_generator.py index cb8fb7a4..5f41de81 100644 --- a/etgtools/sip_generator.py +++ b/etgtools/sip_generator.py @@ -860,8 +860,10 @@ from %s import * annotations.append('Deprecated') if item.factory: annotations.append('Factory') - if item.pyReleaseGIL: # else HoldGIL?? + if item.pyReleaseGIL: annotations.append('ReleaseGIL') + if item.pyHoldGIL: + annotations.append('HoldGIL') if item.noCopy: annotations.append('NoCopy')