Skip to content

Commit dd9e789

Browse files
committed
Add a section about how to regenerate the ABI file
Signed-off-by: Pablo Galindo <pablogsal@gmail.com>
1 parent 2714ab8 commit dd9e789

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

setup.rst

+45
Original file line numberDiff line numberDiff line change
@@ -475,6 +475,51 @@ install your own copy of Autoconf.
475475

476476
.. _build_troubleshooting:
477477

478+
Regenerate the ABI dump
479+
=======================
480+
481+
Maintainance branches (not ``main``) have a special file located in
482+
``Doc/data/pythonX.Y.abi`` that allows us to know if a given Pull Request
483+
affects the public ABI. This file is used by the GitHub CI in a check
484+
called ``Check if the ABI has changed`` that will fail if a give Pull Request
485+
has changes to the ABI and the ABI file is not updated.
486+
487+
This check acts as a fail-safe and **doesn't necessarily mean that the Pull
488+
Request cannot be merged**. When this check fails you should add the relevant
489+
release manager to the PR so that they are aware of the change and they can
490+
validate if the change can be made or nor.
491+
492+
.. important::
493+
ABI changes are allowed before the first release candidate. After the first release
494+
candidate, all further releases must have the same ABI for ensuring compatibility
495+
with native extensions and other tools that interact with the Python interpreter.
496+
See the documentation about the :ref:`release candidate <rc>` phase.
497+
498+
You can regenerate the ABI file by yourself by invoking the ``regen abidump``
499+
Make target. Note that for doing this you need to regenerate the ABI file in
500+
the same environment that the GitHub CI uses to check for it. This is because
501+
different platform may include some platform-specific details that make the
502+
check fail even if the Python ABI is the same. The easier way to regenerate
503+
the ABI file using the same platform as the CI uses is by using docker:
504+
505+
.. code-block:: bash
506+
# In the CPython root:
507+
$ docker run -v`pwd`:/src -it ubuntu:20.04 bash
508+
$ cd /src
509+
# Install dependencies to compile CPython
510+
$ .github/workflows/posix-deps-apt.sh
511+
# Install dependencies to run the ABI regeneration
512+
$ apt-get install -yq abigail-tools python3
513+
# Ensure CPython is built with all the debugging information
514+
$ export CFLAGS="-g3 -O0"
515+
# Build Python
516+
$ ./configure --enable-shared && make
517+
# Regenerate the ABI file
518+
$ make regen-abidump
519+
520+
This will change the ``Doc/data/pythonX.Y.abi`` file with the latest changes
521+
so it can be committed to the Pull Request so the check can pass.
522+
478523
Troubleshoot the build
479524
======================
480525

0 commit comments

Comments
 (0)