Skip to content

Conversation

@jcfr
Copy link
Contributor

@jcfr jcfr commented Sep 2, 2025

This commit switches to using the Py_RETURN_* macros which expand to the expected constructs. This helps avoid a no-op (and misleading) call to Py_INCREF() when building against Python >= 3.12.

  • Py_RETURN_NOTIMPLEMENTED was introduced in Python 3.3 through python/cpython@7d2f9e13424 ("Add Py_RETURN_NOTIMPLEMENTED macro. Fixes #12724.", 2011-08-10)

  • Py_RETURN_TRUE, Py_RETURN_FALSE and Py_RETURN_NONE were introduced in Python 2.4 through python/cpython@d05235ec49d ("Defined macros Py_RETURN_(TRUE|FALSE|NONE) as helper functions for returning the specified value. All three Py_INCREF the singleton and then return it.", 2003-10-19)

References:

This commit switches to using the `Py_RETURN_*` macros which expand to the
expected constructs. This helps avoid a no-op (and misleading) call to
`Py_INCREF()` when building against Python >= 3.12.

- `Py_RETURN_NOTIMPLEMENTED` was introduced in Python 3.3
  through python/cpython@7d2f9e13424 ("Add Py_RETURN_NOTIMPLEMENTED macro. Fixes #12724.", 2011-08-10)

- `Py_RETURN_TRUE`, `Py_RETURN_FALSE` and `Py_RETURN_NONE` were introduced in
  Python 2.4 through python/cpython@d05235ec49d ("Defined macros Py_RETURN_(TRUE|FALSE|NONE) as helper functions for returning the specified value.  All three Py_INCREF the singleton and then return it.", 2003-10-19)

References:
* https://docs.python.org/3/glossary.html#term-immortal
* https://peps.python.org/pep-0683/
Copy link
Contributor

@mrbean-bremen mrbean-bremen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@mrbean-bremen mrbean-bremen merged commit ad9b6a0 into MeVisLab:master Sep 3, 2025
19 checks passed
@jcfr jcfr deleted the fix-pythonqt-immortals-support branch October 2, 2025 15:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants