Skip to content

Conversation

jcfr
Copy link
Contributor

@jcfr jcfr commented Sep 20, 2025

This pull request removes obsolete compatibility code for Python 2 and outdated
preprocessor conditionals for Python versions < 2.4.

  • Remove all #ifndef PY3K conditionals and related branches, consolidating on Python 3 APIs. This drops redundant code paths and consistently renames nb_nonzero helpers to nb_bool.

  • Remove the comment related to the use of Py_FlushLine in custom_system_exit_exception_handle in PythonQt.cpp, which is not needed in Python 3.x. See python/cpython@79139b247b0 ("Kill off softspace completely (except in formatter.py which seems to have a different feature with the same name). The change to test_doctest.txt reduces the doctest failures to 3.", 2007-02-09)

  • Remove outdated PY_VERSION_HEX conditional branches.

Remove all `#ifndef PY3K` conditionals and related branches, consolidating on
Python 3 APIs. This drops redundant code paths and consistently renames
`nb_nonzero` helpers to `nb_bool`.

Remove the comment related to the use of `Py_FlushLine` in
`custom_system_exit_exception_handle` in `PythonQt.cpp`, which is not needed
in Python 3.x. See python/cpython@79139b247b0 ("Kill off softspace completely (except in formatter.py which seems to have a different feature with the same name). The change to test_doctest.txt reduces the doctest failures to 3.", 2007-02-09)

Co-authored-by: Jean-Christophe Fillion-Robin <[email protected]>
This changes simplify the code by removing legacy preprocessor conditionals
for Python versions < 2.4. It ensures the consistent use of the `PyMarshal_Write*`
API with `Py_MARSHAL_VERSION`.
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 - it's time to really declare Python 2 dead...

@mrbean-bremen mrbean-bremen merged commit 46a2fe9 into MeVisLab:master Sep 20, 2025
17 checks passed
@jcfr
Copy link
Contributor Author

jcfr commented Sep 20, 2025

Ditto. Have a few more related PRs coming up 🚀

@he-hesce
Copy link
Contributor

he-hesce commented Sep 21, 2025

You should probably mark a final version as compatible with Python 2.7 so those who need Python 2 support know what to use - and then do a significant version bump to signal Python 3 only support.

Note that Python 2.7 is still the default version and supported on RHEL 7.9 which is in Extended Life Cycle Support phase until 30 June 2028. Thus in industrial/production environments it will be used until it can be pried out of the cold (dead) hands of the customer on 1 July 2028.

@mrbean-bremen
Copy link
Contributor

I think all the latest changes have been for Qt 5.15 and 6, which is not what is used on these systems. So basically, all changes since version 3.5 are basically targeted to Qt 5.15 and later, and Python 3.
The documentation here is a bit sparse, to say the least, and there are no separate release notes, so the only place to put this kind of information are the GitHub releases, and maybe the README.

That being said, I agree that a major version update makes sense after the synchronization with the commontk version is finished, with a note that Python 2 is no longer supported, and versions before Qt 5.15 are no longer guaranteed to work.

@jcfr jcfr deleted the remove-python2-compat-py3k-def branch September 26, 2025 19:47
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.

4 participants