GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - ngoldbaum/pythoncapi-compat: The pythoncapi-compat project can be used to write a C extension supporting a wide range of Python versions with a single code base.

BranchesTags
Open more actions menu
 
 

Latest commit

 

History

204 Commits
204 Commits

Folders and files

NameName
Last commit message
Last commit date
.github/workflows
.github/workflows
 
 
docs
docs
 
 
tests
tests
 
 
.gitignore
.gitignore
 
 
.readthedocs.yaml
.readthedocs.yaml
 
 
CODE_OF_CONDUCT.md
CODE_OF_CONDUCT.md
 
 
COPYING
COPYING
 
 
README.rst
README.rst
 
 
pythoncapi_compat.h
pythoncapi_compat.h
 
 
runtests.py
runtests.py
 
 
upgrade_pythoncapi.py
upgrade_pythoncapi.py
 
 

Repository files navigation

Python C API compatibility

Build status of pythoncapi-compat on GitHub 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 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 and is covered by the PSF Code of Conduct.

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.

pythoncapi-compat.readthedocs.io/

Resources

Readme
License

Code of conduct

Code of conduct
Activity

Stars

0 stars

Watchers

0 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.