Help needed for adapting C code in Zope to upcoming Python versions

Each new Python version deprecates small portions of the Python C API. Deprecated behaviors get removed mainly within the next releases. I am listing some issues below where we are currently running into this problem or will do later on. Fixing these kind of problems requires a deeper knowledge of the Python C API, which at least I do not have. It is not easy to find someone who is able and will voluntarily work on these issues.

To keep up with the yearly new Python releases we should develop a plan how to include the required upcoming changes in the C API into our code. (It seems impossible get rid of the C code and run entirely on Python code.)

Does anyone in the audience have any ideas or suggestions?

Known issues (probably not a complete list):

With kind regards,
Michael Howitz. Zope release manager

1 Like

I also do not have deep Python C API knowlegde but I've found a compat/upgrade repo which claims to help solving those problems ... at least as far as I understand :wink: GitHub - pythoncapi/pythoncapi_compat: Header file providing new functions of the Python C API to old Python versions.

2 Likes

Thank you @petschki for sharing this tool.

I tried it in Add support for Python 3.11. by icemac · Pull Request #38 · zopefoundation/ExtensionClass · GitHub and was able to get past the compiling error on Python 3.11.

But this approach has the main problem that the contributor agreement forbids me to commit the change to the repository as the file pythoncapi_compat.h is required to stay compatible with older Python versions. But it is provided by the tool and the contributor agreement requires: "I hereby represent and warrant that I am the sole copyright holder for the Work …" – pythoncapi_compat.h is licensed under MIT.

Am I understanding the contributor agreement correctly?
Does anyone have an idea how to solve this legal problem?

I do not think this is a problem, ZPL and MIT are compatible FOSS licenses. If you copy a whole file unchanged, this is fine. We had this in past too, i.e. used ZPL code in Plone (years ago, when the copyright were with two different holders).
You may need to add a note to COPYRIGHT.txt about the different license in a single file.
If you in doubt, we can discuss this issue in the Plone Foundation Board at the next meeting.

1 Like

An advice from the board would be helpful, I think; especially as there are suggestions to include just the parts of the file which are actually needed, so it does not confuse the C compiler on Windows.

We discussed this shortly at the board, green light:

  1. we can just copy a file in if licenses do not taint the code (like GPL in non GPL code)
  2. we can change the code in there, changes will stay under the original license (MIT in this case).
  3. we should mention the different license in README or a dedicated COPYRIGHT file like "Some files are under MIT licence; that is noted in the respective files" and leave the MIT reference in the top of the modified, in our case "pythoncapi_compat.h" - file, so that if that file is renamed you don't have to fix copyright mentions in several places
1 Like

Thank you for the advice.

Plone Foundation Code of Conduct