Merge pull request #8829 from RonnyPfannschmidt/fix-6858-cpdev-set-name-supported-in-cython31

fix #6858: correct the signature of __set_name__ as cython 3.1 added support
This commit is contained in:
TW 2025-05-10 12:18:34 +02:00 committed by GitHub
commit 5c304edf9c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 5 additions and 5 deletions

View file

@ -67,7 +67,7 @@ where = ["src"]
"*" = ["*.c", "*.h", "*.pyx"]
[build-system]
requires = ["setuptools>=77.0.0", "wheel", "pkgconfig", "Cython>=3.0.3,<3.1.0", "setuptools_scm[toml]>=6.2"]
requires = ["setuptools>=77.0.0", "wheel", "pkgconfig", "Cython>=3.0.3", "setuptools_scm[toml]>=6.2"]
build-backend = "setuptools.build_meta"
[tool.setuptools_scm]

View file

@ -10,5 +10,5 @@ pytest
pytest-xdist
pytest-cov
pytest-benchmark
Cython < 3.1
Cython
pre-commit

View file

@ -238,7 +238,7 @@ cdef class PropDictProperty:
except KeyError:
raise AttributeError(self.attr_error_msg) from None
cpdef __set_name__(self, name):
cpdef __set_name__(self, owner, name):
self.key = name
self.__doc__ = "%s (%s)" % (name, self.value_type_name)
self.type_error_msg = "%s value must be %s" % (name, self.value_type_name)
@ -613,12 +613,12 @@ cdef class ManifestItem(PropDict):
cpdef _init_names():
"""
re-implements python __set_name__
re-implements python __set_name__ for Cython<3.1
"""
for cls in PropDict.__subclasses__():
for name, value in vars(cls).items():
if isinstance(value, PropDictProperty):
value.__set_name__(name)
value.__set_name__(cls, name)
_init_names()