enthought / traits

Observable typed attributes for Python classes
Other
432 stars 85 forks source link

Fails to build with python 3.13 #1765

Closed opoplawski closed 7 months ago

opoplawski commented 8 months ago

python-Traits fails to build with Python 3.13.0a1.

traits/ctraits.c: In function ‘has_traits_dealloc’:
traits/ctraits.c:811:5: error: implicit declaration of function ‘Py_TRASHCAN_SAFE_BEGIN’; did you mean ‘Py_TRASHCAN_BEGIN’? [-Werror=implicit-function-declaration]
  811 |     Py_TRASHCAN_SAFE_BEGIN(obj);
      |     ^~~~~~~~~~~~~~~~~~~~~~
      |     Py_TRASHCAN_BEGIN
traits/ctraits.c:814:5: error: implicit declaration of function ‘Py_TRASHCAN_SAFE_END’; did you mean ‘Py_TRASHCAN_END’? [-Werror=implicit-function-declaration]
  814 |     Py_TRASHCAN_SAFE_END(obj);
      |     ^~~~~~~~~~~~~~~~~~~~
      |     Py_TRASHCAN_END

According to https://docs.python.org/3.13/whatsnew/3.13.html: Remove the old trashcan macros Py_TRASHCAN_SAFE_BEGIN and Py_TRASHCAN_SAFE_END. They should be replaced by the new macros Py_TRASHCAN_BEGIN and Py_TRASHCAN_END. The new macros were added in Python 3.8 and the old macros were deprecated in Python 3.11. (Contributed by Irit Katriel in gh-105111.)

https://docs.python.org/3.13/whatsnew/3.13.html

mdickinson commented 8 months ago

Thanks for the report and analysis. It may make sense to wait until the first 3.13 beta is released before we address this, in case there are other C-API changes in the meantime.

mdickinson commented 8 months ago

It may make sense to wait until the first 3.13 beta is released

It does look as though the setup-python GitHub action already supports the 3.13 alphas, though, which is good news for testing.