mirror of https://github.com/python/cpython
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.
This commit is contained in:
parent
cd11ff12ac
commit
7ca74a760a
|
@ -2,6 +2,9 @@
|
|||
preserve
|
||||
[clinic start generated code]*/
|
||||
|
||||
#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
|
||||
# include "pycore_runtime.h" // _Py_SINGLETON()
|
||||
#endif
|
||||
#include "pycore_abstract.h" // _PyNumber_Index()
|
||||
#include "pycore_modsupport.h" // _PyArg_UnpackKeywords()
|
||||
|
||||
|
@ -607,4 +610,4 @@ Simple_from_outparm(PyObject *self, PyTypeObject *cls, PyObject *const *args, Py
|
|||
}
|
||||
return Simple_from_outparm_impl(self, cls);
|
||||
}
|
||||
/*[clinic end generated code: output=9c6539a3559e6088 input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=a90886be2a294ee6 input=a9049054013a1b77]*/
|
||||
|
|
|
@ -4,7 +4,7 @@ preserve
|
|||
|
||||
#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
|
||||
# include "pycore_gc.h" // PyGC_Head
|
||||
# include "pycore_runtime.h" // _Py_ID()
|
||||
# include "pycore_runtime.h" // _Py_SINGLETON()
|
||||
#endif
|
||||
#include "pycore_abstract.h" // _PyNumber_Index()
|
||||
#include "pycore_critical_section.h"// Py_BEGIN_CRITICAL_SECTION()
|
||||
|
@ -1245,4 +1245,4 @@ skip_optional_pos:
|
|||
exit:
|
||||
return return_value;
|
||||
}
|
||||
/*[clinic end generated code: output=4249187a725a3b3e input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=8eead000083dc5fa input=a9049054013a1b77]*/
|
||||
|
|
|
@ -2,6 +2,9 @@
|
|||
preserve
|
||||
[clinic start generated code]*/
|
||||
|
||||
#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
|
||||
# include "pycore_runtime.h" // _Py_SINGLETON()
|
||||
#endif
|
||||
#include "pycore_abstract.h" // _Py_convert_optional_to_ssize_t()
|
||||
#include "pycore_modsupport.h" // _PyArg_UnpackKeywords()
|
||||
|
||||
|
@ -438,4 +441,4 @@ _io__RawIOBase_readall(PyObject *self, PyObject *Py_UNUSED(ignored))
|
|||
{
|
||||
return _io__RawIOBase_readall_impl(self);
|
||||
}
|
||||
/*[clinic end generated code: output=e7326fbefc52bfba input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=dab5e9323d191e32 input=a9049054013a1b77]*/
|
||||
|
|
|
@ -4,7 +4,7 @@ preserve
|
|||
|
||||
#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
|
||||
# include "pycore_gc.h" // PyGC_Head
|
||||
# include "pycore_runtime.h" // _Py_ID()
|
||||
# include "pycore_runtime.h" // _Py_SINGLETON()
|
||||
#endif
|
||||
#include "pycore_abstract.h" // _Py_convert_optional_to_ssize_t()
|
||||
#include "pycore_critical_section.h"// Py_BEGIN_CRITICAL_SECTION()
|
||||
|
@ -1292,4 +1292,4 @@ _io_TextIOWrapper__CHUNK_SIZE_set(textio *self, PyObject *value, void *Py_UNUSED
|
|||
|
||||
return return_value;
|
||||
}
|
||||
/*[clinic end generated code: output=93a5a91a22100a28 input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=04cb7c67791a9ec1 input=a9049054013a1b77]*/
|
||||
|
|
|
@ -2,6 +2,9 @@
|
|||
preserve
|
||||
[clinic start generated code]*/
|
||||
|
||||
#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
|
||||
# include "pycore_runtime.h" // _Py_SINGLETON()
|
||||
#endif
|
||||
#include "pycore_modsupport.h" // _PyArg_UnpackKeywords()
|
||||
|
||||
PyDoc_STRVAR(_curses_panel_panel_bottom__doc__,
|
||||
|
@ -418,4 +421,4 @@ _curses_panel_update_panels(PyObject *module, PyObject *Py_UNUSED(ignored))
|
|||
{
|
||||
return _curses_panel_update_panels_impl(module);
|
||||
}
|
||||
/*[clinic end generated code: output=7bac14e9a1194c87 input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=18dc5571174c7189 input=a9049054013a1b77]*/
|
||||
|
|
|
@ -2,6 +2,9 @@
|
|||
preserve
|
||||
[clinic start generated code]*/
|
||||
|
||||
#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
|
||||
# include "pycore_runtime.h" // _Py_SINGLETON()
|
||||
#endif
|
||||
#include "pycore_modsupport.h" // _PyArg_UnpackKeywords()
|
||||
|
||||
PyDoc_STRVAR(_dbm_dbm_close__doc__,
|
||||
|
@ -218,4 +221,4 @@ skip_optional:
|
|||
exit:
|
||||
return return_value;
|
||||
}
|
||||
/*[clinic end generated code: output=743ce0cea116747e input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=f7d9a87d80a64278 input=a9049054013a1b77]*/
|
||||
|
|
|
@ -4,7 +4,7 @@ preserve
|
|||
|
||||
#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
|
||||
# include "pycore_gc.h" // PyGC_Head
|
||||
# include "pycore_runtime.h" // _Py_ID()
|
||||
# include "pycore_runtime.h" // _Py_SINGLETON()
|
||||
#endif
|
||||
#include "pycore_abstract.h" // _PyNumber_Index()
|
||||
#include "pycore_modsupport.h" // _PyArg_UnpackKeywords()
|
||||
|
@ -1236,4 +1236,4 @@ skip_optional:
|
|||
exit:
|
||||
return return_value;
|
||||
}
|
||||
/*[clinic end generated code: output=aed9f53eeb0404e0 input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=bd28eba33d9c1f25 input=a9049054013a1b77]*/
|
||||
|
|
|
@ -2,6 +2,9 @@
|
|||
preserve
|
||||
[clinic start generated code]*/
|
||||
|
||||
#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
|
||||
# include "pycore_runtime.h" // _Py_SINGLETON()
|
||||
#endif
|
||||
#include "pycore_modsupport.h" // _PyArg_CheckPositional()
|
||||
|
||||
PyDoc_STRVAR(_gdbm_gdbm_get__doc__,
|
||||
|
@ -340,4 +343,4 @@ skip_optional:
|
|||
exit:
|
||||
return return_value;
|
||||
}
|
||||
/*[clinic end generated code: output=6b4c19905ac9967d input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=07bdeb4a8ecb328e input=a9049054013a1b77]*/
|
||||
|
|
|
@ -4,7 +4,7 @@ preserve
|
|||
|
||||
#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
|
||||
# include "pycore_gc.h" // PyGC_Head
|
||||
# include "pycore_runtime.h" // _Py_ID()
|
||||
# include "pycore_runtime.h" // _Py_SINGLETON()
|
||||
#endif
|
||||
#include "pycore_modsupport.h" // _PyArg_UnpackKeywords()
|
||||
|
||||
|
@ -1077,4 +1077,4 @@ skip_optional_kwonly:
|
|||
exit:
|
||||
return return_value;
|
||||
}
|
||||
/*[clinic end generated code: output=bd63c85a8737b0aa input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=c7dd60d20ee4895f input=a9049054013a1b77]*/
|
||||
|
|
|
@ -2,6 +2,9 @@
|
|||
preserve
|
||||
[clinic start generated code]*/
|
||||
|
||||
#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
|
||||
# include "pycore_runtime.h" // _Py_SINGLETON()
|
||||
#endif
|
||||
#include "pycore_abstract.h" // _PyNumber_Index()
|
||||
#include "pycore_modsupport.h" // _PyArg_CheckPositional()
|
||||
|
||||
|
@ -688,4 +691,4 @@ PyDoc_STRVAR(array_arrayiterator___setstate____doc__,
|
|||
|
||||
#define ARRAY_ARRAYITERATOR___SETSTATE___METHODDEF \
|
||||
{"__setstate__", (PyCFunction)array_arrayiterator___setstate__, METH_O, array_arrayiterator___setstate____doc__},
|
||||
/*[clinic end generated code: output=9a3276ffd499c796 input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=ecd63acd7924c223 input=a9049054013a1b77]*/
|
||||
|
|
|
@ -4,7 +4,7 @@ preserve
|
|||
|
||||
#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
|
||||
# include "pycore_gc.h" // PyGC_Head
|
||||
# include "pycore_runtime.h" // _Py_ID()
|
||||
# include "pycore_runtime.h" // _Py_SINGLETON()
|
||||
#endif
|
||||
#include "pycore_modsupport.h" // _PyArg_UnpackKeywords()
|
||||
|
||||
|
@ -545,4 +545,4 @@ exit:
|
|||
#ifndef PYEXPAT_XMLPARSER_USEFOREIGNDTD_METHODDEF
|
||||
#define PYEXPAT_XMLPARSER_USEFOREIGNDTD_METHODDEF
|
||||
#endif /* !defined(PYEXPAT_XMLPARSER_USEFOREIGNDTD_METHODDEF) */
|
||||
/*[clinic end generated code: output=51874bfaf4992ba2 input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=9f1e9a7192d29976 input=a9049054013a1b77]*/
|
||||
|
|
|
@ -38,6 +38,8 @@ def declare_parser(
|
|||
p for p in f.parameters.values()
|
||||
if not p.is_positional_only() and not p.is_vararg()
|
||||
])
|
||||
|
||||
condition = '#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)'
|
||||
if limited_capi:
|
||||
declarations = """
|
||||
#define KWTUPLE NULL
|
||||
|
@ -50,6 +52,9 @@ def declare_parser(
|
|||
# define KWTUPLE NULL
|
||||
#endif
|
||||
"""
|
||||
|
||||
codegen.add_include('pycore_runtime.h', '_Py_SINGLETON()',
|
||||
condition=condition)
|
||||
else:
|
||||
# XXX Why do we not statically allocate the tuple
|
||||
# for non-builtin modules?
|
||||
|
@ -73,9 +78,10 @@ def declare_parser(
|
|||
#endif // !Py_BUILD_CORE
|
||||
""" % num_keywords
|
||||
|
||||
condition = '#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)'
|
||||
codegen.add_include('pycore_gc.h', 'PyGC_Head', condition=condition)
|
||||
codegen.add_include('pycore_runtime.h', '_Py_ID()', condition=condition)
|
||||
codegen.add_include('pycore_gc.h', 'PyGC_Head',
|
||||
condition=condition)
|
||||
codegen.add_include('pycore_runtime.h', '_Py_ID()',
|
||||
condition=condition)
|
||||
|
||||
declarations += """
|
||||
static const char * const _keywords[] = {{{keywords_c} NULL}};
|
||||
|
|
Loading…
Reference in New Issue