vstinner · GitHub

Hi,

Would it make sense to move the pythoncapi_compat project under the GitHub python or psf organization to make it more "official" and make it a little more sustainable?

In the past, I managed to move my pyperf project under the psf organization. Now other core developers are contributing and using it. It's better than using it on my personal organization.

pythoncapi_compat respects the PSF requirements to move a project in the GitHub psf organization: contributors are requires to respect the PSF Code of Conduct and the project has 3 maintainers (@corona10, @erlend-aasland and me: @vstinner).

On Discord, @Yhg1s and @gpshead told me that this question is for the SC, so I'm asking the question here :-)


Some context.

C API changes in Python 3.10 and 3.11 require adding compatibility code to write C code compatible with old and new Python versions.

For example, What's New in Python 3.10 suggests adding the following code to your project to get Py_SET_REFCNT() on Python 3.8 and older:

#if PY_VERSION_HEX < 0x030900A4
#  define Py_SET_REFCNT(obj, refcnt) ((Py_REFCNT(obj) = (refcnt)), (void)0)
#endif

Python 3.11 requires even more compatibility functions:

  • Py_SET_TYPE()
  • Py_SET_SIZE()
  • PyFrame_GetCode()
  • PyFrame_GetBack()
  • PyThreadState_GetFrame()
  • PyThreadState_EnterTracing()
  • PyThreadState_LeaveTracing()

I added a reference to my pythoncapi_compat project to What's New in Python 3.11:

Or use the pythoncapi_compat project to get these functions on old Python functions.

This project provides a pythoncapi_compat.h header file which contains all the required compatibility code. There is no need to manually copy/paste it in your code, you just need to add #include "pythoncapi_compat.h" and copy the file to your project.

My concern is that currently the project lives in my https://github.com/pythoncapi organization which is not really a sustainable option for the future.


The pythoncapi_compat project is used by more and more Python projects, like Mercurial or mypy.

Victor

Read the original on github.com ↗