FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Remove upgrade_pythoncapi.py script by vstinner · Pull Request #198 · python/pythoncapi-compat · GitHub

Repository navigation

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .py  (3) .rst  (4) All 2 file types selected
Deleted files Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
38 changes: 1 addition & 37 deletions README.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -8,48 +8,12 @@ Python C API compatibility

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.
of the ``pythoncapi_compat.h`` header file.

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/>`_.
1 change: 1 addition & 0 deletions docs/changelog.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
Changelog
=========

* 2026-10-11: Remove the ``upgrade_pythoncapi.py`` script.
* 2026-10-10: Add ``PyObject_GenericHash()`` and
``PyUnicodeWriter_WriteUCS4()`` functions. runtests.py now runs tests in
parallel.
Expand Down
4 changes: 1 addition & 3 deletions docs/index.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ Python C API compatibility

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.
of the ``pythoncapi_compat.h`` header file.

* Homepage: `GitHub pythoncapi-compat project
<https://github.com/python/pythoncapi-compat>`_.
Expand All @@ -18,7 +17,6 @@ Documentation:
:maxdepth: 2

api
upgrade
users
tests
changelog
Expand Down
168 changes: 0 additions & 168 deletions docs/upgrade.rst

This file was deleted.

13 changes: 0 additions & 13 deletions runtests.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@

TEST_DIR = os.path.join(os.path.dirname(__file__), 'tests')
TEST_COMPAT = os.path.join(TEST_DIR, "test_pythoncapi_compat.py")
TEST_UPGRADE = os.path.join(TEST_DIR, "test_upgrade_pythoncapi.py")

PYTHONS = (
# CPython
Expand Down Expand Up @@ -123,16 +122,6 @@ def worker(executable):
print(f"Tested: {len(jobs)} Python executables")


def test_upgrade_pythoncapi(args):
# upgrade_pythoncapi.py requires Python 3.6 or newer
print(f"Run {TEST_UPGRADE}")
cmd = [sys.executable, "-u", TEST_UPGRADE]
if args.verbose:
cmd.append('-v')
run_command(cmd)
print()


def test_current_version(args):
with tempfile.TemporaryDirectory() as build_dir:
cmd = get_test_command(sys.executable, args.verbose, build_dir)
Expand All @@ -144,8 +133,6 @@ def main():
start_time = time.perf_counter()
args = parse_args()

test_upgrade_pythoncapi(args)

if not args.current:
run_tests_parallel(args)
else:
Expand Down
Loading
Loading

Back | FazBrowse Home | New Git URL