Skip to content

Commit be56464

Browse files
authored
GH-137630: Convert _interpreters to use Argument Clinic (#137631)
1 parent 68a61b0 commit be56464

8 files changed

+1533
-317
lines changed

Include/internal/pycore_global_objects_fini_generated.h

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Include/internal/pycore_global_strings.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,7 @@ struct _Py_global_strings {
333333
STRUCT_FOR_ID(call)
334334
STRUCT_FOR_ID(call_exception_handler)
335335
STRUCT_FOR_ID(call_soon)
336+
STRUCT_FOR_ID(callable)
336337
STRUCT_FOR_ID(callback)
337338
STRUCT_FOR_ID(cancel)
338339
STRUCT_FOR_ID(capath)
@@ -368,6 +369,7 @@ struct _Py_global_strings {
368369
STRUCT_FOR_ID(command)
369370
STRUCT_FOR_ID(comment_factory)
370371
STRUCT_FOR_ID(compile_mode)
372+
STRUCT_FOR_ID(config)
371373
STRUCT_FOR_ID(consts)
372374
STRUCT_FOR_ID(context)
373375
STRUCT_FOR_ID(contravariant)
@@ -426,6 +428,7 @@ struct _Py_global_strings {
426428
STRUCT_FOR_ID(errors)
427429
STRUCT_FOR_ID(event)
428430
STRUCT_FOR_ID(eventmask)
431+
STRUCT_FOR_ID(exc)
429432
STRUCT_FOR_ID(exc_type)
430433
STRUCT_FOR_ID(exc_value)
431434
STRUCT_FOR_ID(excepthook)
@@ -497,6 +500,7 @@ struct _Py_global_strings {
497500
STRUCT_FOR_ID(identity_hint)
498501
STRUCT_FOR_ID(ignore)
499502
STRUCT_FOR_ID(imag)
503+
STRUCT_FOR_ID(implieslink)
500504
STRUCT_FOR_ID(importlib)
501505
STRUCT_FOR_ID(in_fd)
502506
STRUCT_FOR_ID(include_aliases)
@@ -546,6 +550,7 @@ struct _Py_global_strings {
546550
STRUCT_FOR_ID(kw)
547551
STRUCT_FOR_ID(kw1)
548552
STRUCT_FOR_ID(kw2)
553+
STRUCT_FOR_ID(kwargs)
549554
STRUCT_FOR_ID(kwdefaults)
550555
STRUCT_FOR_ID(label)
551556
STRUCT_FOR_ID(last)
@@ -662,6 +667,7 @@ struct _Py_global_strings {
662667
STRUCT_FOR_ID(pos1)
663668
STRUCT_FOR_ID(pos2)
664669
STRUCT_FOR_ID(posix)
670+
STRUCT_FOR_ID(preserve_exc)
665671
STRUCT_FOR_ID(print_file_and_line)
666672
STRUCT_FOR_ID(priority)
667673
STRUCT_FOR_ID(progress)
@@ -689,9 +695,12 @@ struct _Py_global_strings {
689695
STRUCT_FOR_ID(reload)
690696
STRUCT_FOR_ID(repl)
691697
STRUCT_FOR_ID(replace)
698+
STRUCT_FOR_ID(reqrefs)
699+
STRUCT_FOR_ID(require_ready)
692700
STRUCT_FOR_ID(reserved)
693701
STRUCT_FOR_ID(reset)
694702
STRUCT_FOR_ID(resetids)
703+
STRUCT_FOR_ID(restrict)
695704
STRUCT_FOR_ID(return)
696705
STRUCT_FOR_ID(reverse)
697706
STRUCT_FOR_ID(reversed)
@@ -718,6 +727,7 @@ struct _Py_global_strings {
718727
STRUCT_FOR_ID(setsigmask)
719728
STRUCT_FOR_ID(setstate)
720729
STRUCT_FOR_ID(shape)
730+
STRUCT_FOR_ID(shared)
721731
STRUCT_FOR_ID(show_cmd)
722732
STRUCT_FOR_ID(signed)
723733
STRUCT_FOR_ID(size)
@@ -788,6 +798,7 @@ struct _Py_global_strings {
788798
STRUCT_FOR_ID(uid)
789799
STRUCT_FOR_ID(unlink)
790800
STRUCT_FOR_ID(unraisablehook)
801+
STRUCT_FOR_ID(updates)
791802
STRUCT_FOR_ID(uri)
792803
STRUCT_FOR_ID(usedforsecurity)
793804
STRUCT_FOR_ID(value)

Include/internal/pycore_runtime_init_generated.h

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Include/internal/pycore_unicodeobject_generated.h

Lines changed: 44 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Lib/test/test__interpreters.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -474,19 +474,19 @@ def setUp(self):
474474

475475
def test_signatures(self):
476476
# See https://github.com/python/cpython/issues/126654
477-
msg = r'_interpreters.exec\(\) argument 3 must be dict, not int'
477+
msg = r"exec\(\) argument 'shared' must be dict, not int"
478478
with self.assertRaisesRegex(TypeError, msg):
479479
_interpreters.exec(self.id, 'a', 1)
480480
with self.assertRaisesRegex(TypeError, msg):
481481
_interpreters.exec(self.id, 'a', shared=1)
482-
msg = r'_interpreters.run_string\(\) argument 3 must be dict, not int'
482+
msg = r"run_string\(\) argument 'shared' must be dict, not int"
483483
with self.assertRaisesRegex(TypeError, msg):
484484
_interpreters.run_string(self.id, 'a', shared=1)
485-
msg = r'_interpreters.run_func\(\) argument 3 must be dict, not int'
485+
msg = r"run_func\(\) argument 'shared' must be dict, not int"
486486
with self.assertRaisesRegex(TypeError, msg):
487487
_interpreters.run_func(self.id, lambda: None, shared=1)
488488
# See https://github.com/python/cpython/issues/135855
489-
msg = r'_interpreters.set___main___attrs\(\) argument 2 must be dict, not int'
489+
msg = r"set___main___attrs\(\) argument 'updates' must be dict, not int"
490490
with self.assertRaisesRegex(TypeError, msg):
491491
_interpreters.set___main___attrs(self.id, 1)
492492

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
The :mod:`!_interpreters` module now uses Argument Clinic to parse arguments.
2+
Patch by Adam Turner.

0 commit comments

Comments
 (0)