GitXplorerGitXplorer
p

pythoncapi-compat

public
84 stars
25 forks
1 issues

Commits

List of commits on branch main.
Verified
79404e9b5bab9d40d71f18562e20df03fc69e7cb

Add Py_fopen() and Py_fclose() (#127)

vvstinner committed 12 days ago
Verified
7eb512b67cf3b4449c72bdfba04af24cb1503514

Add structmember.h constants (#126)

vvstinner committed a month ago
Verified
61709bfa512f66842fbc70bac5fb3279d0bdba7b

Add PyLong Import/Export API (#121)

sskirpichev committed a month ago
Verified
900c130f9cdc6ec3ae19a76410c76d39bdc3b958

Add PyGObject as a user (#124)

ddanyeaw committed 2 months ago
Verified
0f1d42a10a3f594ad48894912396df31b2c2d55d

prepare for pypy3.11 release (#123)

mmattip committed 2 months ago
Verified
03e441d5e0bf005b481cb61821d58e400cc1c293

Relax PYPY_VERSION_NUM requirements for hash macros (#122)

sskirpichev committed 2 months ago

README

The README file for this repository.

++++++++++++++++++++++++++ Python C API compatibility ++++++++++++++++++++++++++

.. image:: https://github.com/python/pythoncapi-compat/actions/workflows/build.yml/badge.svg :alt: Build status of pythoncapi-compat on GitHub Actions :target: https://github.com/python/pythoncapi-compat/actions

The pythoncapi-compat project can be used to write a C or C++ extension supporting a wide range of Python versions with a single code base. It is made of the pythoncapi_compat.h header file and the upgrade_pythoncapi.py script.

upgrade_pythoncapi.py requires Python 3.6 or newer.

See the documentation at ReadTheDocs <https://pythoncapi-compat.readthedocs.io/en/latest/>_ for more details.

Getting started

To upgrade a specific file::

python3 upgrade_pythoncapi.py module.c

To upgrade all C/C++ files in a directory::

python3 upgrade_pythoncapi.py src/

Select operations

To only replace op->ob_type with Py_TYPE(op), select the Py_TYPE operation with::

python3 upgrade_pythoncapi.py -o Py_TYPE module.c

Or the opposite, to apply all operations but leave op->ob_type unchanged, deselect the Py_TYPE operation with::

python3 upgrade_pythoncapi.py -o all,-Py_TYPE module.c

Download pythoncapi_compat.h

If you want to pythoncapi_compat.h to your code base, use the upgrade_pythoncapi.py tool to fetch it::

python3 upgrade_pythoncapi.py --download PATH

This project is distributed under the Zero Clause BSD (0BSD) license <https://opensource.org/licenses/0BSD>_ and is covered by the PSF Code of Conduct <https://www.python.org/psf/codeofconduct/>_.