Fixup: using incorrect method names in some cases where they have been renamed

This commit is contained in:
lojack5
2025-01-17 03:29:41 -07:00
parent 2071ae765d
commit 68f75d28dc
2 changed files with 7 additions and 5 deletions

View File

@@ -538,8 +538,10 @@ class FunctionDef(BaseDef, FixWxPrefix):
if getattr(self, 'isCtor', False):
name = '__init__'
else:
name = self.name or self.pyName
name = self.pyName or self.name
name = self.fixWxPrefix(name)
if 'Destroy' in (name, self.name, self.pyName):
print(f'Generating signature for: {name}, {self.name}, {self.pyName}')
# __bool__ and __nonzero__ need to be defined as returning int for SIP, but for Python
# __bool__ is required to return a bool:
if name in ('__bool__', '__nonzero__'):
@@ -727,7 +729,7 @@ class ClassDef(BaseDef):
@convertFromPyObject.setter
def convertFromPyObject(self, value: AutoConversionInfo) -> None:
self._convertFromPyObject = value.code
name = self.name or self.pyName
name = self.pyName or self.name
name = removeWxPrefix(name)
FixWxPrefix.register_autoconversion(name, value.convertables)

View File

@@ -42,7 +42,7 @@ magicMethods = {
class AutoConversionInfo(NamedTuple):
convertables: tuple[str, ...] # String type-hints for each of the types that can be automatically converted to this class
convertables: Tuple[str, ...] # String type-hints for each of the types that can be automatically converted to this class
code: str # Code that will be added to SIP for this conversion
@@ -254,10 +254,10 @@ class FixWxPrefix(object):
"""
_coreTopLevelNames = None
_auto_conversions: dict[str, tuple[str, ...]] = {}
_auto_conversions: dict[str, Tuple[str, ...]] = {}
@classmethod
def register_autoconversion(cls, class_name: str, convertables: tuple[str, ...]) -> None:
def register_autoconversion(cls, class_name: str, convertables: Tuple[str, ...]) -> None:
cls._auto_conversions[class_name] = convertables
def fixWxPrefix(self, name, checkIsCore=False):