Debian Codegraph @

Tools/build/stable_abi.py

raw
1 """Check the stable ABI manifest or generate files from it
2
3 By default, the tool only checks existing files/libraries.
4 Pass --generate to recreate auto-generated files instead.
5
6 For actions that take a FILENAME, the filename can be left out to use a default
7 (relative to the manifest file, as they appear in the CPython codebase).
8 """
9
10 from functools import partial
11 from pathlib import Path
12 import dataclasses
13 import subprocess
14 import sysconfig
15 import argparse
16 import textwrap
17 import tomllib
18 import difflib
19 import pprint
20 import sys
21 import os
22 import os.path
23 import io
24 import re
25 import csv
26
27 SCRIPT_NAME = 'Tools/build/stable_abi.py'
28 MISSING = object()
29
30 EXCLUDED_HEADERS = {
31 "bytes_methods.h",
32 "cellobject.h",
33 "classobject.h",
34 "code.h",
35 "compile.h",
36 "datetime.h",
37 "dtoa.h",
38 "frameobject.h",
39 "genobject.h",
40 "longintrepr.h",
41 "parsetok.h",
42 "pyatomic.h",
43 "token.h",
44 "ucnhash.h",
45 }
46 MACOS = (sys.platform == "darwin")
47 UNIXY = MACOS or (sys.platform == "linux") # XXX should this be "not Windows"?
48
49
50 # The stable ABI manifest (Misc/stable_abi.toml) exists only to fill the
51 # following dataclasses.
52 # Feel free to change its syntax (and the `parse_manifest` function)
53 # to better serve that purpose (while keeping it human-readable).
54
55 class Manifest:
56 """Collection of `ABIItem`s forming the stable ABI/limited API."""
57 def __init__(self):
58 self.contents = dict()
59
60 def add(self, item):
61 if item.name in self.contents:
62 # We assume that stable ABI items do not share names,
63 # even if they're different kinds (e.g. function vs. macro).
64 raise ValueError(f'duplicate ABI item {item.name}')
65 self.contents[item.name] = item
66
67 def select(self, kinds, *, include_abi_only=True, ifdef=None):
68 """Yield selected items of the manifest
69
70 kinds: set of requested kinds, e.g. {'function', 'macro'}
71 include_abi_only: if True (default), include all items of the
72 stable ABI.
73 If False, include only items from the limited API
74 (i.e. items people should use today)
75 ifdef: set of feature macros (e.g. {'HAVE_FORK', 'MS_WINDOWS'}).
76 If None (default), items are not filtered by this. (This is
77 different from the empty set, which filters out all such
78 conditional items.)
79 """
80 for name, item in sorted(self.contents.items()):
81 if item.kind not in kinds:
82 continue
83 if item.abi_only and not include_abi_only:
84 continue
85 if (ifdef is not None
86 and item.ifdef is not None
87 and item.ifdef not in ifdef):
88 continue
89 yield item
90
91 def dump(self):
92 """Yield lines to recreate the manifest file (sans comments/newlines)"""
93 for item in self.contents.values():
94 fields = dataclasses.fields(item)
95 yield f"[{item.kind}.{item.name}]"
96 for field in fields:
97 if field.name in {'name', 'value', 'kind'}:
98 continue
99 value = getattr(item, field.name)
100 if value == field.default:
101 pass
102 elif value is True:
103 yield f" {field.name} = true"
104 elif value:
105 yield f" {field.name} = {value!r}"
106
107
108 itemclasses = {}
109 def itemclass(kind):
110 """Register the decorated class in `itemclasses`"""
111 def decorator(cls):
112 itemclasses[kind] = cls
113 return cls
114 return decorator
115
116 @itemclass('function')
117 @itemclass('macro')
118 @itemclass('data')
119 @itemclass('const')
120 @itemclass('typedef')
121 @dataclasses.dataclass
122 class ABIItem:
123 """Information on one item (function, macro, struct, etc.)"""
124
125 name: str
126 kind: str
127 added: str = None
128 abi_only: bool = False
129 ifdef: str = None
130
131 @itemclass('feature_macro')
132 @dataclasses.dataclass(kw_only=True)
133 class FeatureMacro(ABIItem):
134 name: str
135 doc: str
136 windows: bool = False
137 abi_only: bool = True
138
139 @itemclass('struct')
140 @dataclasses.dataclass(kw_only=True)
141 class Struct(ABIItem):
142 struct_abi_kind: str
143 members: list = None
144
145
146 def parse_manifest(file):
147 """Parse the given file (iterable of lines) to a Manifest"""
148
149 manifest = Manifest()
150
151 data = tomllib.load(file)
152
153 for kind, itemclass in itemclasses.items():
154 for name, item_data in data[kind].items():
155 try:
156 item = itemclass(name=name, kind=kind, **item_data)
157 manifest.add(item)
158 except BaseException as exc:
159 exc.add_note(f'in {kind} {name}')
160 raise
161
162 return manifest
163
164 # The tool can run individual "actions".
165 # Most actions are "generators", which generate a single file from the
166 # manifest. (Checking works by generating a temp file & comparing.)
167 # Other actions, like "--unixy-check", don't work on a single file.
168
169 generators = []
170 def generator(var_name, default_path):
171 """Decorates a file generator: function that writes to a file"""
172 def _decorator(func):
173 func.var_name = var_name
174 func.arg_name = '--' + var_name.replace('_', '-')
175 func.default_path = default_path
176 generators.append(func)
177 return func
178 return _decorator
179
180
181 @generator("python3dll", 'PC/python3dll.c')
182 def gen_python3dll(manifest, args, outfile):
183 """Generate/check the source for the Windows stable ABI library"""
184 write = partial(print, file=outfile)
185 content = f"""\
186 /* Re-export stable Python ABI */
187
188 /* Generated by {SCRIPT_NAME} */
189 """
190 content += r"""
191 #ifdef _M_IX86
192 #define DECORATE "_"
193 #else
194 #define DECORATE
195 #endif
196
197 #define EXPORT_FUNC(name) \
198 __pragma(comment(linker, "/EXPORT:" DECORATE #name "=" PYTHON_DLL_NAME "." #name))
199 #define EXPORT_DATA(name) \
200 __pragma(comment(linker, "/EXPORT:" DECORATE #name "=" PYTHON_DLL_NAME "." #name ",DATA"))
201 """
202 write(textwrap.dedent(content))
203
204 def sort_key(item):
205 return item.name.lower()
206
207 windows_feature_macros = {
208 item.name for item in manifest.select({'feature_macro'}) if item.windows
209 }
210 for item in sorted(
211 manifest.select(
212 {'function'},
213 include_abi_only=True,
214 ifdef=windows_feature_macros),
215 key=sort_key):
216 write(f'EXPORT_FUNC({item.name})')
217
218 write()
219
220 for item in sorted(
221 manifest.select(
222 {'data'},
223 include_abi_only=True,
224 ifdef=windows_feature_macros),
225 key=sort_key):
226 write(f'EXPORT_DATA({item.name})')
227
228 ITEM_KIND_TO_DOC_ROLE = {
229 'function': 'func',
230 'data': 'data',
231 'struct': 'type',
232 'macro': 'macro',
233 'const': 'macro',
234 'typedef': 'type',
235 }
236
237 @generator("doc_list", 'Doc/data/stable_abi.dat')
238 def gen_doc_annotations(manifest, args, outfile):
239 """Generate/check the stable ABI list for documentation annotations
240
241 See ``StableABIEntry`` in ``Doc/tools/extensions/c_annotations.py``
242 for a description of each field.
243 """
244 writer = csv.DictWriter(
245 outfile,
246 ['role', 'name', 'added', 'ifdef_note', 'struct_abi_kind'],
247 lineterminator='\n')
248 writer.writeheader()
249 kinds = set(ITEM_KIND_TO_DOC_ROLE)
250 for item in manifest.select(kinds, include_abi_only=False):
251 if item.ifdef:
252 ifdef_note = manifest.contents[item.ifdef].doc
253 else:
254 ifdef_note = None
255 row = {
256 'role': ITEM_KIND_TO_DOC_ROLE[item.kind],
257 'name': item.name,
258 'added': item.added,
259 'ifdef_note': ifdef_note,
260 }
261 rows = [row]
262 if item.kind == 'struct':
263 row['struct_abi_kind'] = item.struct_abi_kind
264 for member_name in item.members or ():
265 rows.append({
266 'role': 'member',
267 'name': f'{item.name}.{member_name}',
268 'added': item.added,
269 })
270 writer.writerows(rows)
271
272 @generator("ctypes_test", 'Lib/test/test_stable_abi_ctypes.py')
273 def gen_ctypes_test(manifest, args, outfile):
274 """Generate/check the ctypes-based test for exported symbols"""
275 write = partial(print, file=outfile)
276 write(textwrap.dedent(f'''\
277 # Generated by {SCRIPT_NAME}
278
279 """Test that all symbols of the Stable ABI are accessible using ctypes
280 """
281
282 import sys
283 import unittest
284 from test.support.import_helper import import_module
285 try:
286 from _testcapi import get_feature_macros
287 except ImportError:
288 raise unittest.SkipTest("requires _testcapi")
289
290 feature_macros = get_feature_macros()
291
292 # Stable ABI is incompatible with Py_TRACE_REFS builds due to PyObject
293 # layout differences.
294 # See https://github.com/python/cpython/issues/88299#issuecomment-1113366226
295 if feature_macros['Py_TRACE_REFS']:
296 raise unittest.SkipTest("incompatible with Py_TRACE_REFS.")
297
298 ctypes_test = import_module('ctypes')
299
300 class TestStableABIAvailability(unittest.TestCase):
301 def test_available_symbols(self):
302
303 for symbol_name in SYMBOL_NAMES:
304 with self.subTest(symbol_name):
305 ctypes_test.pythonapi[symbol_name]
306
307 def test_feature_macros(self):
308 self.assertEqual(
309 set(get_feature_macros()), EXPECTED_FEATURE_MACROS)
310
311 # The feature macros for Windows are used in creating the DLL
312 # definition, so they must be known on all platforms.
313 # If we are on Windows, we check that the hardcoded data matches
314 # the reality.
315 @unittest.skipIf(sys.platform != "win32", "Windows specific test")
316 def test_windows_feature_macros(self):
317 for name, value in WINDOWS_FEATURE_MACROS.items():
318 if value != 'maybe':
319 with self.subTest(name):
320 self.assertEqual(feature_macros[name], value)
321
322 SYMBOL_NAMES = (
323 '''))
324 items = manifest.select(
325 {'function', 'data'},
326 include_abi_only=True,
327 )
328 feature_macros = list(manifest.select({'feature_macro'}))
329 optional_items = {m.name: [] for m in feature_macros}
330 for item in items:
331 if item.ifdef:
332 optional_items[item.ifdef].append(item.name)
333 else:
334 write(f' "{item.name}",')
335 write(")")
336 for ifdef, names in optional_items.items():
337 write(f"if feature_macros[{ifdef!r}]:")
338 write(f" SYMBOL_NAMES += (")
339 for name in names:
340 write(f" {name!r},")
341 write(" )")
342 write("")
343 feature_names = sorted(m.name for m in feature_macros)
344 write(f"EXPECTED_FEATURE_MACROS = set({pprint.pformat(feature_names)})")
345
346 windows_feature_macros = {m.name: m.windows for m in feature_macros}
347 write(f"WINDOWS_FEATURE_MACROS = {pprint.pformat(windows_feature_macros)}")
348
349
350 @generator("testcapi_feature_macros", 'Modules/_testcapi_feature_macros.inc')
351 def gen_testcapi_feature_macros(manifest, args, outfile):
352 """Generate/check the stable ABI list for documentation annotations"""
353 write = partial(print, file=outfile)
354 write(f'// Generated by {SCRIPT_NAME}')
355 write()
356 write('// Add an entry in dict `result` for each Stable ABI feature macro.')
357 write()
358 for macro in manifest.select({'feature_macro'}):
359 name = macro.name
360 write(f'#ifdef {name}')
361 write(f' res = PyDict_SetItemString(result, "{name}", Py_True);')
362 write('#else')
363 write(f' res = PyDict_SetItemString(result, "{name}", Py_False);')
364 write('#endif')
365 write('if (res) {')
366 write(' Py_DECREF(result); return NULL;')
367 write('}')
368 write()
369
370
371 def generate_or_check(manifest, args, path, func):
372 """Generate/check a file with a single generator
373
374 Return True if successful; False if a comparison failed.
375 """
376
377 outfile = io.StringIO()
378 func(manifest, args, outfile)
379 generated = outfile.getvalue()
380 existing = path.read_text()
381
382 if generated != existing:
383 if args.generate:
384 path.write_text(generated)
385 else:
386 print(f'File {path} differs from expected!')
387 diff = difflib.unified_diff(
388 generated.splitlines(), existing.splitlines(),
389 str(path), '<expected>',
390 lineterm='',
391 )
392 for line in diff:
393 print(line)
394 return False
395 return True
396
397
398 def do_unixy_check(manifest, args):
399 """Check headers & library using "Unixy" tools (GCC/clang, binutils)"""
400 okay = True
401
402 # Get all macros first: we'll need feature macros like HAVE_FORK and
403 # MS_WINDOWS for everything else
404 present_macros = gcc_get_limited_api_macros(['Include/Python.h'])
405 feature_macros = set(m.name for m in manifest.select({'feature_macro'}))
406 feature_macros &= present_macros
407
408 # Check that we have all needed macros
409 expected_macros = set(
410 item.name for item in manifest.select({'macro'})
411 )
412 missing_macros = expected_macros - present_macros
413 okay &= _report_unexpected_items(
414 missing_macros,
415 'Some macros from are not defined from "Include/Python.h"'
416 + 'with Py_LIMITED_API:')
417
418 expected_symbols = set(item.name for item in manifest.select(
419 {'function', 'data'}, include_abi_only=True, ifdef=feature_macros,
420 ))
421
422 # Check the static library (*.a)
423 LIBRARY = sysconfig.get_config_var("LIBRARY")
424 if not LIBRARY:
425 raise Exception("failed to get LIBRARY variable from sysconfig")
426 if os.path.exists(LIBRARY):
427 okay &= binutils_check_library(
428 manifest, LIBRARY, expected_symbols, dynamic=False)
429
430 # Check the dynamic library (*.so)
431 LDLIBRARY = sysconfig.get_config_var("LDLIBRARY")
432 if not LDLIBRARY:
433 raise Exception("failed to get LDLIBRARY variable from sysconfig")
434 okay &= binutils_check_library(
435 manifest, LDLIBRARY, expected_symbols, dynamic=False)
436
437 # Check definitions in the header files
438 expected_defs = set(item.name for item in manifest.select(
439 {'function', 'data'}, include_abi_only=False, ifdef=feature_macros,
440 ))
441 found_defs = gcc_get_limited_api_definitions(['Include/Python.h'])
442 missing_defs = expected_defs - found_defs
443 okay &= _report_unexpected_items(
444 missing_defs,
445 'Some expected declarations were not declared in '
446 + '"Include/Python.h" with Py_LIMITED_API:')
447
448 # Some Limited API macros are defined in terms of private symbols.
449 # These are not part of Limited API (even though they're defined with
450 # Py_LIMITED_API). They must be part of the Stable ABI, though.
451 private_symbols = {n for n in expected_symbols if n.startswith('_')}
452 extra_defs = found_defs - expected_defs - private_symbols
453 okay &= _report_unexpected_items(
454 extra_defs,
455 'Some extra declarations were found in "Include/Python.h" '
456 + 'with Py_LIMITED_API:')
457
458 return okay
459
460
461 def _report_unexpected_items(items, msg):
462 """If there are any `items`, report them using "msg" and return false"""
463 if items:
464 print(msg, file=sys.stderr)
465 for item in sorted(items):
466 print(' -', item, file=sys.stderr)
467 return False
468 return True
469
470
471 def binutils_get_exported_symbols(library, dynamic=False):
472 """Retrieve exported symbols using the nm(1) tool from binutils"""
473 # Only look at dynamic symbols
474 args = ["nm", "--no-sort"]
475 if dynamic:
476 args.append("--dynamic")
477 args.append(library)
478 proc = subprocess.run(args, stdout=subprocess.PIPE, universal_newlines=True)
479 if proc.returncode:
480 sys.stdout.write(proc.stdout)
481 sys.exit(proc.returncode)
482
483 stdout = proc.stdout.rstrip()
484 if not stdout:
485 raise Exception("command output is empty")
486
487 for line in stdout.splitlines():
488 # Split line '0000000000001b80 D PyTextIOWrapper_Type'
489 if not line:
490 continue
491
492 parts = line.split(maxsplit=2)
493 if len(parts) < 3:
494 continue
495
496 symbol = parts[-1]
497 if MACOS and symbol.startswith("_"):
498 yield symbol[1:]
499 else:
500 yield symbol
501
502
503 def binutils_check_library(manifest, library, expected_symbols, dynamic):
504 """Check that library exports all expected_symbols"""
505 available_symbols = set(binutils_get_exported_symbols(library, dynamic))
506 missing_symbols = expected_symbols - available_symbols
507 if missing_symbols:
508 print(textwrap.dedent(f"""\
509 Some symbols from the limited API are missing from {library}:
510 {', '.join(missing_symbols)}
511
512 This error means that there are some missing symbols among the
513 ones exported in the library.
514 This normally means that some symbol, function implementation or
515 a prototype belonging to a symbol in the limited API has been
516 deleted or is missing.
517 """), file=sys.stderr)
518 return False
519 return True
520
521
522 def gcc_get_limited_api_macros(headers):
523 """Get all limited API macros from headers.
524
525 Runs the preprocessor over all the header files in "Include" setting
526 "-DPy_LIMITED_API" to the correct value for the running version of the
527 interpreter and extracting all macro definitions (via adding -dM to the
528 compiler arguments).
529
530 Requires Python built with a GCC-compatible compiler. (clang might work)
531 """
532
533 api_hexversion = sys.version_info.major << 24 | sys.version_info.minor << 16
534
535 preprocessor_output_with_macros = subprocess.check_output(
536 sysconfig.get_config_var("CC").split()
537 + [
538 # Prevent the expansion of the exported macros so we can
539 # capture them later
540 "-DSIZEOF_WCHAR_T=4", # The actual value is not important
541 f"-DPy_LIMITED_API={api_hexversion}",
542 "-I.",
543 "-I./Include",
544 "-dM",
545 "-E",
546 ]
547 + [str(file) for file in headers],
548 text=True,
549 )
550
551 return {
552 target
553 for target in re.findall(
554 r"#define (\w+)", preprocessor_output_with_macros
555 )
556 }
557
558
559 def gcc_get_limited_api_definitions(headers):
560 """Get all limited API definitions from headers.
561
562 Run the preprocessor over all the header files in "Include" setting
563 "-DPy_LIMITED_API" to the correct value for the running version of the
564 interpreter.
565
566 The limited API symbols will be extracted from the output of this command
567 as it includes the prototypes and definitions of all the exported symbols
568 that are in the limited api.
569
570 This function does *NOT* extract the macros defined on the limited API
571
572 Requires Python built with a GCC-compatible compiler. (clang might work)
573 """
574 api_hexversion = sys.version_info.major << 24 | sys.version_info.minor << 16
575 preprocessor_output = subprocess.check_output(
576 sysconfig.get_config_var("CC").split()
577 + [
578 # Prevent the expansion of the exported macros so we can capture
579 # them later
580 "-DPyAPI_FUNC=__PyAPI_FUNC",
581 "-DPyAPI_DATA=__PyAPI_DATA",
582 "-DEXPORT_DATA=__EXPORT_DATA",
583 "-D_Py_NO_RETURN=",
584 "-DSIZEOF_WCHAR_T=4", # The actual value is not important
585 f"-DPy_LIMITED_API={api_hexversion}",
586 "-I.",
587 "-I./Include",
588 "-E",
589 ]
590 + [str(file) for file in headers],
591 text=True,
592 stderr=subprocess.DEVNULL,
593 )
594 stable_functions = set(
595 re.findall(r"__PyAPI_FUNC\(.*?\)\s*(.*?)\s*\(", preprocessor_output)
596 )
597 stable_exported_data = set(
598 re.findall(r"__EXPORT_DATA\((.*?)\)", preprocessor_output)
599 )
600 stable_data = set(
601 re.findall(r"__PyAPI_DATA\(.*?\)[\s\*\(]*([^);]*)\)?.*;", preprocessor_output)
602 )
603 return stable_data | stable_exported_data | stable_functions
604
605 def check_private_names(manifest):
606 """Ensure limited API doesn't contain private names
607
608 Names prefixed by an underscore are private by definition.
609 """
610 for name, item in manifest.contents.items():
611 if name.startswith('_') and not item.abi_only:
612 raise ValueError(
613 f'`{name}` is private (underscore-prefixed) and should be '
614 + 'removed from the stable ABI list or marked `abi_only`')
615
616 def check_dump(manifest, filename):
617 """Check that manifest.dump() corresponds to the data.
618
619 Mainly useful when debugging this script.
620 """
621 dumped = tomllib.loads('\n'.join(manifest.dump()))
622 with filename.open('rb') as file:
623 from_file = tomllib.load(file)
624 if dumped != from_file:
625 print(f'Dump differs from loaded data!', file=sys.stderr)
626 diff = difflib.unified_diff(
627 pprint.pformat(dumped).splitlines(),
628 pprint.pformat(from_file).splitlines(),
629 '<dumped>', str(filename),
630 lineterm='',
631 )
632 for line in diff:
633 print(line, file=sys.stderr)
634 return False
635 else:
636 return True
637
638 def main():
639 parser = argparse.ArgumentParser(
640 description=__doc__,
641 formatter_class=argparse.RawDescriptionHelpFormatter,
642 )
643 parser.add_argument(
644 "file", type=Path, metavar='FILE',
645 help="file with the stable abi manifest",
646 )
647 parser.add_argument(
648 "--generate", action='store_true',
649 help="generate file(s), rather than just checking them",
650 )
651 parser.add_argument(
652 "--generate-all", action='store_true',
653 help="as --generate, but generate all file(s) using default filenames."
654 + " (unlike --all, does not run any extra checks)",
655 )
656 parser.add_argument(
657 "-a", "--all", action='store_true',
658 help="run all available checks using default filenames",
659 )
660 parser.add_argument(
661 "-l", "--list", action='store_true',
662 help="list available generators and their default filenames; then exit",
663 )
664 parser.add_argument(
665 "--dump", action='store_true',
666 help="dump the manifest contents (used for debugging the parser)",
667 )
668
669 actions_group = parser.add_argument_group('actions')
670 for gen in generators:
671 actions_group.add_argument(
672 gen.arg_name, dest=gen.var_name,
673 type=str, nargs="?", default=MISSING,
674 metavar='FILENAME',
675 help=gen.__doc__,
676 )
677 actions_group.add_argument(
678 '--unixy-check', action='store_true',
679 help=do_unixy_check.__doc__,
680 )
681 args = parser.parse_args()
682
683 base_path = args.file.parent.parent
684
685 if args.list:
686 for gen in generators:
687 print(f'{gen.arg_name}: {base_path / gen.default_path}')
688 sys.exit(0)
689
690 run_all_generators = args.generate_all
691
692 if args.generate_all:
693 args.generate = True
694
695 if args.all:
696 run_all_generators = True
697 if UNIXY:
698 args.unixy_check = True
699
700 try:
701 file = args.file.open('rb')
702 except FileNotFoundError as err:
703 if args.file.suffix == '.txt':
704 # Provide a better error message
705 suggestion = args.file.with_suffix('.toml')
706 raise FileNotFoundError(
707 f'{args.file} not found. Did you mean {suggestion} ?') from err
708 raise
709 with file:
710 manifest = parse_manifest(file)
711
712 check_private_names(manifest)
713
714 # Remember results of all actions (as booleans).
715 # At the end we'll check that at least one action was run,
716 # and also fail if any are false.
717 results = {}
718
719 if args.dump:
720 for line in manifest.dump():
721 print(line)
722 results['dump'] = check_dump(manifest, args.file)
723
724 for gen in generators:
725 filename = getattr(args, gen.var_name)
726 if filename is None or (run_all_generators and filename is MISSING):
727 filename = base_path / gen.default_path
728 elif filename is MISSING:
729 continue
730
731 results[gen.var_name] = generate_or_check(manifest, args, filename, gen)
732
733 if args.unixy_check:
734 results['unixy_check'] = do_unixy_check(manifest, args)
735
736 if not results:
737 if args.generate:
738 parser.error('No file specified. Use --help for usage.')
739 parser.error('No check specified. Use --help for usage.')
740
741 failed_results = [name for name, result in results.items() if not result]
742
743 if failed_results:
744 raise Exception(f"""
745 These checks related to the stable ABI did not succeed:
746 {', '.join(failed_results)}
747
748 If you see diffs in the output, files derived from the stable
749 ABI manifest the were not regenerated.
750 Run `make regen-limited-abi` to fix this.
751
752 Otherwise, see the error(s) above.
753
754 The stable ABI manifest is at: {args.file}
755 Note that there is a process to follow when modifying it.
756
757 You can read more about the limited API and its contracts at:
758
759 https://docs.python.org/3/c-api/stable.html
760
761 And in PEP 384:
762
763 https://peps.python.org/pep-0384/
764 """)
765
766
767 if __name__ == "__main__":
768 main()