Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

The pythoncapi-compat project can be used to write a C extension supporting a wide range of Python versions with a single code base.

License

NotificationsYou must be signed in to change notification settings

python/pythoncapi-compat

Build status of pythoncapi-compat on GitHub Actions

Thepythoncapi-compat project can be used to write a C or C++ extensionsupporting a wide range of Python versions with a single code base. It is madeof thepythoncapi_compat.h header file and theupgrade_pythoncapi.pyscript.

upgrade_pythoncapi.py requires Python 3.6 or newer.

See thedocumentation at ReadTheDocsfor 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 replaceop->ob_type withPy_TYPE(op), select thePy_TYPEoperation with:

python3 upgrade_pythoncapi.py -o Py_TYPE module.c

Or the opposite, to apply all operations but leaveop->ob_type unchanged,deselect thePy_TYPE operation with:

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

Download pythoncapi_compat.h

If you want topythoncapi_compat.h to your code base, use theupgrade_pythoncapi.py tool to fetch it:

python3 upgrade_pythoncapi.py --download PATH

This project is distributed under theZero Clause BSD (0BSD) license and is covered by thePSF Code ofConduct.

About

The pythoncapi-compat project can be used to write a C extension supporting a wide range of Python versions with a single code base.

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors13


[8]ページ先頭

©2009-2025 Movatter.jp