Skip to content

Commit 48c7776

Browse files
authored
[3.13] gh-119661: Add _Py_SINGLETON() include in Argumenet Clinic (#119712) (#119716)
gh-119661: Add _Py_SINGLETON() include in Argumenet Clinic (#119712) When the _Py_SINGLETON() is used, Argument Clinic now adds an explicit "pycore_runtime.h" include to get the macro. Previously, the macro may or may not be included indirectly by another include. (cherry picked from commit 7ca74a7)
1 parent 7a9534f commit 48c7776

File tree

12 files changed

+43
-19
lines changed

12 files changed

+43
-19
lines changed

Modules/_ctypes/clinic/_ctypes.c.h

+4-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Modules/_io/clinic/bufferedio.c.h

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Modules/_io/clinic/iobase.c.h

+4-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Modules/_io/clinic/textio.c.h

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Modules/clinic/_curses_panel.c.h

+4-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Modules/clinic/_dbmmodule.c.h

+4-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Modules/clinic/_elementtree.c.h

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Modules/clinic/_gdbmmodule.c.h

+4-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Modules/clinic/_pickle.c.h

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Modules/clinic/arraymodule.c.h

+4-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Modules/clinic/pyexpat.c.h

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Tools/clinic/libclinic/parse_args.py

+9-3
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ def declare_parser(
3838
p for p in f.parameters.values()
3939
if not p.is_positional_only() and not p.is_vararg()
4040
])
41+
42+
condition = '#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)'
4143
if limited_capi:
4244
declarations = """
4345
#define KWTUPLE NULL
@@ -50,6 +52,9 @@ def declare_parser(
5052
# define KWTUPLE NULL
5153
#endif
5254
"""
55+
56+
codegen.add_include('pycore_runtime.h', '_Py_SINGLETON()',
57+
condition=condition)
5358
else:
5459
# XXX Why do we not statically allocate the tuple
5560
# for non-builtin modules?
@@ -73,9 +78,10 @@ def declare_parser(
7378
#endif // !Py_BUILD_CORE
7479
""" % num_keywords
7580

76-
condition = '#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)'
77-
codegen.add_include('pycore_gc.h', 'PyGC_Head', condition=condition)
78-
codegen.add_include('pycore_runtime.h', '_Py_ID()', condition=condition)
81+
codegen.add_include('pycore_gc.h', 'PyGC_Head',
82+
condition=condition)
83+
codegen.add_include('pycore_runtime.h', '_Py_ID()',
84+
condition=condition)
7985

8086
declarations += """
8187
static const char * const _keywords[] = {{{keywords_c} NULL}};

0 commit comments

Comments
 (0)