@@ -475,6 +475,51 @@ install your own copy of Autoconf.
475
475
476
476
.. _build_troubleshooting :
477
477
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 given 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 not.
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 platforms 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 and the check can pass.
522
+
478
523
Troubleshoot the build
479
524
======================
480
525
0 commit comments