]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-45439: Move _PyObject_CallNoArgs() to pycore_call.h (GH-28895)
authorVictor Stinner <vstinner@python.org>
Tue, 12 Oct 2021 06:38:19 +0000 (08:38 +0200)
committerGitHub <noreply@github.com>
Tue, 12 Oct 2021 06:38:19 +0000 (08:38 +0200)
* Move _PyObject_CallNoArgs() to pycore_call.h (internal C API).
* _ssl, _sqlite and _testcapi extensions now call the public
  PyObject_CallNoArgs() function, rather than _PyObject_CallNoArgs().
* _lsprof extension is now built with Py_BUILD_CORE_MODULE macro
  defined to get access to internal _PyObject_CallNoArgs().

38 files changed:
Include/cpython/abstract.h
Include/internal/pycore_call.h
Modules/_collectionsmodule.c
Modules/_ctypes/_ctypes.c
Modules/_ctypes/callbacks.c
Modules/_ctypes/cfield.c
Modules/_ctypes/stgdict.c
Modules/_functoolsmodule.c
Modules/_io/bufferedio.c
Modules/_lsprof.c
Modules/_sqlite/connection.c
Modules/_ssl.c
Modules/_testcapimodule.c
Modules/itertoolsmodule.c
Modules/main.c
Modules/mathmodule.c
Modules/posixmodule.c
Modules/signalmodule.c
Objects/abstract.c
Objects/bytesobject.c
Objects/complexobject.c
Objects/dictobject.c
Objects/enumobject.c
Objects/fileobject.c
Objects/genobject.c
Objects/iterobject.c
Objects/moduleobject.c
Objects/object.c
Objects/odictobject.c
Objects/typeobject.c
Parser/tokenizer.c
Python/bltinmodule.c
Python/ceval.c
Python/codecs.c
Python/errors.c
Python/marshal.c
Python/sysmodule.c
setup.py

index 18bf0137639a999dc945f5d715ede7b2fe09bc77..0814bfa62e1a421d81b87b694ce552c53e1fb0bb 100644 (file)
@@ -160,15 +160,6 @@ _PyObject_FastCall(PyObject *func, PyObject *const *args, Py_ssize_t nargs)
     return _PyObject_FastCallTstate(tstate, func, args, nargs);
 }
 
-/* Call a callable without any arguments
-   Private static inline function variant of public function
-   PyObject_CallNoArgs(). */
-static inline PyObject *
-_PyObject_CallNoArgs(PyObject *func) {
-    PyThreadState *tstate = PyThreadState_Get();
-    return _PyObject_VectorcallTstate(tstate, func, NULL, 0, NULL);
-}
-
 static inline PyObject *
 PyObject_CallOneArg(PyObject *func, PyObject *arg)
 {
index 2f7c07a4b411a493d917377df9c95a9fd1c87e0b..28a4194db74845ffb124e54b6faed9556f805eaf 100644 (file)
@@ -33,6 +33,13 @@ _PyObject_CallNoArgsTstate(PyThreadState *tstate, PyObject *func) {
     return _PyObject_VectorcallTstate(tstate, func, NULL, 0, NULL);
 }
 
+// Private static inline function variant of public PyObject_CallNoArgs()
+static inline PyObject *
+_PyObject_CallNoArgs(PyObject *func) {
+    PyThreadState *tstate = PyThreadState_Get();
+    return _PyObject_VectorcallTstate(tstate, func, NULL, 0, NULL);
+}
+
 #ifdef __cplusplus
 }
 #endif
index 8a690b46fa3e56ef46dd818eceff42efd5a313b0..c6de9636032c0a14635809393585b9c8daac62b0 100644 (file)
@@ -1,4 +1,5 @@
 #include "Python.h"
+#include "pycore_call.h"          // _PyObject_CallNoArgs()
 #include "pycore_long.h"          // _PyLong_GetZero()
 #include "structmember.h"         // PyMemberDef
 
index 7ff101e5714904452b948a13c8522faf129e92d2..2567067f0b39fa2a2c93235ea9f54254337c75af 100644 (file)
@@ -102,6 +102,7 @@ bytes(cdata)
 #define PY_SSIZE_T_CLEAN
 
 #include "Python.h"
+#include "pycore_call.h"          // _PyObject_CallNoArgs()
 #include "structmember.h"         // PyMemberDef
 
 #include <ffi.h>
index 16afb240a54ed5b40e667769bac29bdb110390fa..18b010493628c9add611f7c5a15b698e33953e7f 100644 (file)
@@ -1,4 +1,5 @@
 #include "Python.h"
+#include "pycore_call.h"          // _PyObject_CallNoArgs()
 #include "frameobject.h"
 
 #include <stdbool.h>
index 2909f2f0f7dc4808f1326b5d04ef193bf874e4a3..6788aee78a2d30222ea1e63b25573f0fa714b3a5 100644 (file)
@@ -1,5 +1,6 @@
 #include "Python.h"
 #include "pycore_bitutils.h"      // _Py_bswap32()
+#include "pycore_call.h"          // _PyObject_CallNoArgs()
 
 #include <ffi.h>
 #ifdef MS_WIN32
index d44b54cd55280691e0a18d3091b4f89dbf1de38d..ea3c58b88e704acbe85c1788717ff8ad802f6ac6 100644 (file)
@@ -1,4 +1,5 @@
 #include "Python.h"
+#include "pycore_call.h"          // _PyObject_CallNoArgs()
 #include <ffi.h>
 #ifdef MS_WIN32
 #include <windows.h>
index ed60ae3d7ea366fd3a1c689e740a6a1a2614e272..4c77ee7b7a53ce66ee491db8cda888e1aa732454 100644 (file)
@@ -1,4 +1,5 @@
 #include "Python.h"
+#include "pycore_call.h"          // _PyObject_CallNoArgs()
 #include "pycore_long.h"          // _PyLong_GetZero()
 #include "pycore_moduleobject.h"  // _PyModule_GetState()
 #include "pycore_object.h"        // _PyObject_GC_TRACK
index 74d4fb5da70aa151777f2cfc17baf8eaed79b964..dc6371a572b9f80d00fd101a4d3b3e2189f72a8c 100644 (file)
@@ -9,6 +9,7 @@
 
 #define PY_SSIZE_T_CLEAN
 #include "Python.h"
+#include "pycore_call.h"          // _PyObject_CallNoArgs()
 #include "pycore_object.h"
 #include "structmember.h"         // PyMemberDef
 #include "_iomodule.h"
index 0ca3f1e1a2533944a3dad06450636d89ee3f4e04..097d0eff2602d1009f8da2c4e3cc6aad3a1932a3 100644 (file)
@@ -1,4 +1,5 @@
 #include "Python.h"
+#include "pycore_call.h"          // _PyObject_CallNoArgs()
 #include "rotatingtree.h"
 
 /************************************************************/
index a331757562aa0c50212d2b77dc47904fdd48dd46..b4badb111a3c7722a18b23a65c41fa43bbc79926 100644 (file)
@@ -710,7 +710,7 @@ step_callback(sqlite3_context *context, int argc, sqlite3_value **params)
     if (*aggregate_instance == NULL) {
         callback_context *ctx = (callback_context *)sqlite3_user_data(context);
         assert(ctx != NULL);
-        *aggregate_instance = _PyObject_CallNoArgs(ctx->callable);
+        *aggregate_instance = PyObject_CallNoArgs(ctx->callable);
         if (!*aggregate_instance) {
             set_sqlite_error(context,
                     "user-defined aggregate's '__init__' method raised error");
@@ -1008,7 +1008,7 @@ progress_callback(void *ctx)
 
     assert(ctx != NULL);
     PyObject *callable = ((callback_context *)ctx)->callable;
-    ret = _PyObject_CallNoArgs(callable);
+    ret = PyObject_CallNoArgs(callable);
     if (!ret) {
         /* abort query if error occurred */
         rc = -1;
index c163ce69d5ee934af6b41d50594381353cf0b361..b2e241a0a338eb7dbe5bd44a6f44f05069b48403 100644 (file)
@@ -3773,7 +3773,7 @@ _password_callback(char *buf, int size, int rwflag, void *userdata)
     }
 
     if (pw_info->callable) {
-        fn_ret = _PyObject_CallNoArgs(pw_info->callable);
+        fn_ret = PyObject_CallNoArgs(pw_info->callable);
         if (!fn_ret) {
             /* TODO: It would be nice to move _ctypes_add_traceback() into the
                core python API, so we could use it to add a frame here */
index 775464c2dee43962927fd07c759fb4bbecd6c9bc..7cbd2dc3b6a51f263eae869679b28591ecfbd664 100644 (file)
@@ -2866,7 +2866,7 @@ _make_call(void *callable)
     PyObject *rc;
     int success;
     PyGILState_STATE s = PyGILState_Ensure();
-    rc = _PyObject_CallNoArgs((PyObject *)callable);
+    rc = PyObject_CallNoArgs((PyObject *)callable);
     success = (rc != NULL);
     Py_XDECREF(rc);
     PyGILState_Release(s);
@@ -2937,7 +2937,7 @@ static int _pending_callback(void *arg)
 {
     /* we assume the argument is callable object to which we own a reference */
     PyObject *callable = (PyObject *)arg;
-    PyObject *r = _PyObject_CallNoArgs(callable);
+    PyObject *r = PyObject_CallNoArgs(callable);
     Py_DECREF(callable);
     Py_XDECREF(r);
     return r != NULL ? 0 : -1;
@@ -3729,7 +3729,7 @@ slot_tp_del(PyObject *self)
     /* Execute __del__ method, if any. */
     del = _PyObject_LookupSpecial(self, &PyId___tp_del__);
     if (del != NULL) {
-        res = _PyObject_CallNoArgs(del);
+        res = PyObject_CallNoArgs(del);
         if (res == NULL)
             PyErr_WriteUnraisable(del);
         else
@@ -4358,7 +4358,7 @@ temporary_c_thread(void *data)
     /* Allocate a Python thread state for this thread */
     state = PyGILState_Ensure();
 
-    res = _PyObject_CallNoArgs(test_c_thread->callback);
+    res = PyObject_CallNoArgs(test_c_thread->callback);
     Py_CLEAR(test_c_thread->callback);
 
     if (res == NULL) {
@@ -4893,7 +4893,7 @@ check_pyobject_freed_is_freed(PyObject *self, PyObject *Py_UNUSED(args))
 #ifdef _Py_ADDRESS_SANITIZER
     Py_RETURN_NONE;
 #else
-    PyObject *op = _PyObject_CallNoArgs((PyObject *)&PyBaseObject_Type);
+    PyObject *op = PyObject_CallNoArgs((PyObject *)&PyBaseObject_Type);
     if (op == NULL) {
         return NULL;
     }
@@ -5271,7 +5271,7 @@ bad_get(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
         return NULL;
     }
 
-    PyObject *res = _PyObject_CallNoArgs(cls);
+    PyObject *res = PyObject_CallNoArgs(cls);
     if (res == NULL) {
         return NULL;
     }
index d6f898cdbf18d6e9c1cb94c21acbddf7460170fc..342a3e6555ba05148b59043bd050398e7ba60fe9 100644 (file)
@@ -1,7 +1,6 @@
-
-
 #define PY_SSIZE_T_CLEAN
 #include "Python.h"
+#include "pycore_call.h"          // _PyObject_CallNoArgs()
 #include "pycore_long.h"          // _PyLong_GetZero()
 #include "pycore_object.h"        // _PyObject_GC_TRACK()
 #include "pycore_tuple.h"         // _PyTuple_ITEMS()
index 39b8c71071e09e0edea7f756722122323ca8304e..c537e6b678515eb42e441161c5702f8380ca6404 100644 (file)
@@ -1,6 +1,7 @@
 /* Python interpreter main program */
 
 #include "Python.h"
+#include "pycore_call.h"          // _PyObject_CallNoArgs()
 #include "pycore_initconfig.h"    // _PyArgv
 #include "pycore_interp.h"        // _PyInterpreterState.sysdict
 #include "pycore_pathconfig.h"    // _PyPathConfig_ComputeSysPath0()
index 62aceced435a01a0759d4c6cae49758d7a159878..4fac0cc29e4e984e0f49854f6d51f319b781d3fc 100644 (file)
@@ -54,7 +54,8 @@ raised for division by zero and mod by zero.
 
 #include "Python.h"
 #include "pycore_bitutils.h"      // _Py_bit_length()
-#include "pycore_dtoa.h"
+#include "pycore_call.h"          // _PyObject_CallNoArgs()
+#include "pycore_dtoa.h"          // _Py_dg_infinity()
 #include "pycore_long.h"          // _PyLong_GetZero()
 #include "_math.h"
 
index 01012c181b423e63b47926790cee01472dba2958..ada1a5865aae7c5d8c25ea6fe84dc86f5cfe2e5f 100644 (file)
@@ -10,7 +10,8 @@
 #define PY_SSIZE_T_CLEAN
 
 #include "Python.h"
-#include "pycore_fileutils.h"
+#include "pycore_call.h"          // _PyObject_CallNoArgs()
+#include "pycore_fileutils.h"     // _Py_closerange()
 #include "pycore_moduleobject.h"  // _PyModule_GetState()
 #ifdef MS_WINDOWS
    /* include <windows.h> early to avoid conflict with pycore_condvar.h:
index d5e6a43af28653e5b571b910c61f645eb27014fb..6568a4d5aa70efd4098df3d205c15dc8f4dc424b 100644 (file)
@@ -7,7 +7,7 @@
 #include "pycore_atomic.h"        // _Py_atomic_int
 #include "pycore_call.h"          // _PyObject_Call()
 #include "pycore_ceval.h"         // _PyEval_SignalReceived()
-#include "pycore_frame.h"
+#include "pycore_frame.h"         // InterpreterFrame
 #include "pycore_moduleobject.h"  // _PyModule_GetState()
 #include "pycore_pyerrors.h"      // _PyErr_SetString()
 #include "pycore_pylifecycle.h"   // NSIG
index 3312e264ea1c22c978067984d653ed66cb468bcb..0d6cefd3eb8612b189428b5bedc3af6646633781 100644 (file)
@@ -2,6 +2,7 @@
 
 #include "Python.h"
 #include "pycore_abstract.h"      // _PyIndex_Check()
+#include "pycore_call.h"          // _PyObject_CallNoArgs()
 #include "pycore_ceval.h"         // _Py_EnterRecursiveCall()
 #include "pycore_object.h"        // _Py_CheckSlotResult()
 #include "pycore_pyerrors.h"      // _PyErr_Occurred()
index 0dfded24b3519a7f0e7496e0a43ec6c49f136e7b..bc0b075cf405b301ff0cb1e922c810f87e86424f 100644 (file)
@@ -5,6 +5,7 @@
 #include "Python.h"
 #include "pycore_abstract.h"      // _PyIndex_Check()
 #include "pycore_bytes_methods.h" // _Py_bytes_startswith()
+#include "pycore_call.h"          // _PyObject_CallNoArgs()
 #include "pycore_format.h"        // F_LJUST
 #include "pycore_initconfig.h"    // _PyStatus_OK()
 #include "pycore_object.h"        // _PyObject_GC_TRACK
index ff8fcba20391b0d6ecdff1d7e2a8d24d4254bf6c..f658dbf336dbf513658337eaac43add6a3f2b90a 100644 (file)
@@ -6,6 +6,7 @@
 /* Submitted by Jim Hugunin */
 
 #include "Python.h"
+#include "pycore_call.h"          // _PyObject_CallNoArgs()
 #include "pycore_long.h"          // _PyLong_GetZero()
 #include "pycore_object.h"        // _PyObject_Init()
 #include "pycore_pymath.h"        // _Py_ADJUST_ERANGE2()
index f883ca7c5b5c623cec217a07d86f6bbe15b23d1f..60470bf66b16108e1ffe4a4fefa1e148ae21d35f 100644 (file)
@@ -112,13 +112,14 @@ As a consequence of this, split keys have a maximum size of 16.
 #define PyDict_MINSIZE 8
 
 #include "Python.h"
-#include "pycore_bitutils.h" // _Py_bit_length
-#include "pycore_gc.h"       // _PyObject_GC_IS_TRACKED()
-#include "pycore_object.h"   // _PyObject_GC_TRACK()
-#include "pycore_pyerrors.h" // _PyErr_Fetch()
-#include "pycore_pystate.h"  // _PyThreadState_GET()
-#include "pycore_dict.h"
-#include "stringlib/eq.h"    // unicode_eq()
+#include "pycore_bitutils.h"      // _Py_bit_length
+#include "pycore_call.h"          // _PyObject_CallNoArgs()
+#include "pycore_dict.h"          // PyDictKeysObject
+#include "pycore_gc.h"            // _PyObject_GC_IS_TRACKED()
+#include "pycore_object.h"        // _PyObject_GC_TRACK()
+#include "pycore_pyerrors.h"      // _PyErr_Fetch()
+#include "pycore_pystate.h"       // _PyThreadState_GET()
+#include "stringlib/eq.h"         // unicode_eq()
 
 /*[clinic input]
 class dict "PyDictObject *" "&PyDict_Type"
index aae7dffec1ba0e3fdb0df4fa4c506eab607cee00..4513831545b9a3132990d8feba4f62686b29129b 100644 (file)
@@ -1,6 +1,7 @@
 /* enumerate object */
 
 #include "Python.h"
+#include "pycore_call.h"          // _PyObject_CallNoArgs()
 #include "pycore_long.h"          // _PyLong_GetOne()
 #include "pycore_object.h"        // _PyObject_GC_TRACK()
 
index 5cb017e8e206eb6c991b50daa413041094433823..dc600c6d09a48742f9439983b8775d06d62c21a3 100644 (file)
@@ -2,7 +2,8 @@
 
 #define PY_SSIZE_T_CLEAN
 #include "Python.h"
-#include "pycore_runtime.h"  // _PyRuntime
+#include "pycore_call.h"          // _PyObject_CallNoArgs()
+#include "pycore_runtime.h"       // _PyRuntime
 
 #if defined(HAVE_GETC_UNLOCKED) && !defined(_Py_MEMORY_SANITIZER)
 /* clang MemorySanitizer doesn't yet understand getc_unlocked. */
index 8fa04e8d684136d9c64d594b4509ca63e12da2ea..f91f367f9a687414d59568dd00a74943035aad2a 100644 (file)
@@ -1,14 +1,15 @@
 /* Generator object implementation */
 
 #include "Python.h"
+#include "pycore_call.h"          // _PyObject_CallNoArgs()
 #include "pycore_ceval.h"         // _PyEval_EvalFrame()
-#include "pycore_object.h"
+#include "pycore_object.h"        // _PyObject_GC_UNTRACK()
 #include "pycore_pyerrors.h"      // _PyErr_ClearExcState()
 #include "pycore_pystate.h"       // _PyThreadState_GET()
-#include "frameobject.h"
-#include "pycore_frame.h"
+#include "pycore_frame.h"         // InterpreterFrame
+#include "frameobject.h"          // PyFrameObject
 #include "structmember.h"         // PyMemberDef
-#include "opcode.h"
+#include "opcode.h"               // YIELD_FROM
 
 static PyObject *gen_close(PyGenObject *, PyObject *);
 static PyObject *async_gen_asend_new(PyAsyncGenObject *, PyObject *);
index acfc539fae0b7ef66d21bf5223cda35d45b49d46..5db6bc10fb3ff23b9b8f678ae975404c997faa06 100644 (file)
@@ -1,7 +1,8 @@
 /* Iterator objects */
 
 #include "Python.h"
-#include "pycore_object.h"
+#include "pycore_call.h"          // _PyObject_CallNoArgs()
+#include "pycore_object.h"        // _PyObject_GC_TRACK()
 
 typedef struct {
     PyObject_HEAD
index f008995f32f0342cef4419646030665aecb3b665..1d649a7932098bc7dcad4ac4e4eb810c39dca2ec 100644 (file)
@@ -2,6 +2,7 @@
 /* Module object implementation */
 
 #include "Python.h"
+#include "pycore_call.h"          // _PyObject_CallNoArgs()
 #include "pycore_interp.h"        // PyInterpreterState.importlib
 #include "pycore_pystate.h"       // _PyInterpreterState_GET()
 #include "pycore_moduleobject.h"  // _PyModule_GetDef()
index d269274c74ec042a2f27b0c7c6969da772459fe2..9d48346d6d227f432656fff65b45d452dbc14ef0 100644 (file)
@@ -2,18 +2,19 @@
 /* Generic object operations; and implementation of None */
 
 #include "Python.h"
+#include "pycore_call.h"          // _PyObject_CallNoArgs()
 #include "pycore_ceval.h"         // _Py_EnterRecursiveCall()
 #include "pycore_context.h"
-#include "pycore_initconfig.h"
-#include "pycore_object.h"
-#include "pycore_pyerrors.h"
-#include "pycore_pylifecycle.h"
+#include "pycore_initconfig.h"    // _PyStatus_EXCEPTION()
+#include "pycore_object.h"        // _PyType_CheckConsistency()
+#include "pycore_pyerrors.h"      // _PyErr_Occurred()
+#include "pycore_pylifecycle.h"   // _PyTypes_InitSlotDefs()
 #include "pycore_pymem.h"         // _PyMem_IsPtrFreed()
 #include "pycore_pystate.h"       // _PyThreadState_GET()
 #include "pycore_symtable.h"      // PySTEntry_Type
 #include "pycore_unionobject.h"   // _PyUnion_Type
-#include "frameobject.h"
-#include "interpreteridobject.h"
+#include "frameobject.h"          // PyFrame_Type
+#include "interpreteridobject.h"  // _PyInterpreterID_Type
 
 #ifdef Py_LIMITED_API
    // Prevent recursive call _Py_IncRef() <=> Py_INCREF()
index 1462a3b39775279f37bb5a80b5deab0b554c06b3..9af45c685ab3b333e75e80d87ef2bc348cf8d416 100644 (file)
@@ -465,10 +465,10 @@ later:
 */
 
 #include "Python.h"
-#include "pycore_object.h"
+#include "pycore_call.h"          // _PyObject_CallNoArgs()
+#include "pycore_object.h"        // _PyObject_GC_UNTRACK()
+#include "pycore_dict.h"          // _Py_dict_lookup()
 #include <stddef.h>               // offsetof()
-#include "pycore_dict.h"
-#include <stddef.h>
 
 #include "clinic/odictobject.c.h"
 
index a73a696a1ec88f0108dd98b3412faea6af8235db..0f56e59bc518534c20b4313b6efadeb2f2df3b81 100644 (file)
@@ -4,14 +4,14 @@
 #include "pycore_call.h"
 #include "pycore_code.h"          // CO_FAST_FREE
 #include "pycore_compile.h"       // _Py_Mangle()
-#include "pycore_initconfig.h"
+#include "pycore_initconfig.h"    // _PyStatus_OK()
 #include "pycore_moduleobject.h"  // _PyModule_GetDef()
-#include "pycore_object.h"
-#include "pycore_pyerrors.h"
+#include "pycore_object.h"        // _PyType_HasFeature()
+#include "pycore_pyerrors.h"      // _PyErr_Occurred()
 #include "pycore_pystate.h"       // _PyThreadState_GET()
 #include "pycore_unionobject.h"   // _Py_union_type_or
-#include "frameobject.h"
-#include "pycore_frame.h"
+#include "frameobject.h"          // PyFrameObject
+#include "pycore_frame.h"         // InterpreterFrame
 #include "opcode.h"               // MAKE_CELL
 #include "structmember.h"         // PyMemberDef
 
index 0e3caf3086ad99337bf9e6b29f31c6e8200670e6..c7a014de42d8f218ed17ada2568b39aded295bc5 100644 (file)
@@ -3,6 +3,7 @@
 
 #define PY_SSIZE_T_CLEAN
 #include "Python.h"
+#include "pycore_call.h"          // _PyObject_CallNoArgs()
 
 #include <ctype.h>
 #include <assert.h>
index f91bb9ffdbcf36fb67bebf401d06add6283526db..d07ba38b698c6bdc3ce2611c3b3a0f665930ce80 100644 (file)
@@ -3,6 +3,7 @@
 #include "Python.h"
 #include <ctype.h>
 #include "pycore_ast.h"           // _PyAST_Validate()
+#include "pycore_call.h"          // _PyObject_CallNoArgs()
 #include "pycore_compile.h"       // _PyAST_Compile()
 #include "pycore_object.h"        // _Py_AddToAllObjects()
 #include "pycore_pyerrors.h"      // _PyErr_NoMemory()
index e9a9c1dccd82c7af10145d1e715ca8cb3f77b117..2d617a63648804ced3fd8ad4583498185fcabf14 100644 (file)
 #include "pycore_abstract.h"      // _PyIndex_Check()
 #include "pycore_call.h"          // _PyObject_FastCallDictTstate()
 #include "pycore_ceval.h"         // _PyEval_SignalAsyncExc()
-#include "pycore_code.h"
+#include "pycore_code.h"          // saturating_increment()
 #include "pycore_initconfig.h"    // _PyStatus_OK()
 #include "pycore_long.h"          // _PyLong_GetZero()
 #include "pycore_object.h"        // _PyObject_GC_TRACK()
-#include "pycore_moduleobject.h"
+#include "pycore_moduleobject.h"  // PyModuleObject
 #include "pycore_pyerrors.h"      // _PyErr_Fetch()
 #include "pycore_pylifecycle.h"   // _PyErr_Print()
 #include "pycore_pymem.h"         // _PyMem_IsPtrFreed()
index 9ee566bd0f7618d03786b51bad3c3c75ee2f6b1d..b7c8db7e8b6189fde8946f0154e8f0613349657c 100644 (file)
@@ -9,6 +9,7 @@ Copyright (c) Corporation for National Research Initiatives.
    ------------------------------------------------------------------------ */
 
 #include "Python.h"
+#include "pycore_call.h"          // _PyObject_CallNoArgs()
 #include "pycore_interp.h"        // PyInterpreterState.codec_search_path
 #include "pycore_pystate.h"       // _PyInterpreterState_GET()
 #include "pycore_ucnhash.h"       // _PyUnicode_Name_CAPI
index 36a529e65a170c1d4afdb4ca6feb221d4d9623f7..f072c214965925c6ed2bf5cceda32d20dcdde578 100644 (file)
@@ -2,11 +2,12 @@
 /* Error handling */
 
 #include "Python.h"
-#include "pycore_initconfig.h"
-#include "pycore_pyerrors.h"
-#include "pycore_pystate.h"    // _PyThreadState_GET()
-#include "pycore_sysmodule.h"
-#include "pycore_traceback.h"
+#include "pycore_call.h"          // _PyObject_CallNoArgs()
+#include "pycore_initconfig.h"    // _PyStatus_ERR()
+#include "pycore_pyerrors.h"      // _PyErr_Format()
+#include "pycore_pystate.h"       // _PyThreadState_GET()
+#include "pycore_sysmodule.h"     // _PySys_Audit()
+#include "pycore_traceback.h"     // _PyTraceBack_FromFrame()
 
 #ifndef __STDC__
 #ifndef MS_WINDOWS
index 530c8d0f2385786c01d6f22209f0501ac2ddc9af..c8a48a55dee0f314e5def8d911daed30a56ea8bc 100644 (file)
@@ -9,11 +9,12 @@
 #define PY_SSIZE_T_CLEAN
 
 #include "Python.h"
+#include "pycore_call.h"          // _PyObject_CallNoArgs()
+#include "pycore_code.h"          // _PyCode_New()
+#include "pycore_hashtable.h"     // _Py_hashtable_t
 #include "longintrepr.h"
 #include "code.h"
-#include "marshal.h"
-#include "pycore_hashtable.h"
-#include "pycore_code.h"        // _PyCode_New()
+#include "marshal.h"              // Py_MARSHAL_VERSION
 
 /*[clinic input]
 module marshal
index 0154af0b76fba3b1fe472d306144e8a48561990e..ae3cbf1954e09eb5f8c1d80e1bd744a27cef1926 100644 (file)
@@ -15,21 +15,22 @@ Data members:
 */
 
 #include "Python.h"
+#include "pycore_call.h"          // _PyObject_CallNoArgs()
 #include "pycore_ceval.h"         // _Py_RecursionLimitLowerWaterMark()
+#include "pycore_code.h"          // _Py_QuickenedCount
+#include "pycore_frame.h"         // InterpreterFrame
 #include "pycore_initconfig.h"    // _PyStatus_EXCEPTION()
 #include "pycore_object.h"        // _PyObject_IS_GC()
-#include "pycore_code.h"          // _Py_QuickenedCount
 #include "pycore_pathconfig.h"    // _PyPathConfig_ComputeSysPath0()
 #include "pycore_pyerrors.h"      // _PyErr_Fetch()
 #include "pycore_pylifecycle.h"   // _PyErr_WriteUnraisableDefaultHook()
 #include "pycore_pymem.h"         // _PyMem_SetDefaultAllocator()
 #include "pycore_pystate.h"       // _PyThreadState_GET()
-#include "pycore_tuple.h"         // _PyTuple_FromArray()
 #include "pycore_structseq.h"     // PyStructSequence_InitType()
+#include "pycore_tuple.h"         // _PyTuple_FromArray()
 
 #include "code.h"
 #include "frameobject.h"          // PyFrame_GetBack()
-#include "pycore_frame.h"
 #include "pydtrace.h"
 #include "osdefs.h"               // DELIM
 #include "stdlib_module_names.h"  // _Py_stdlib_module_names
index 6122430cd04317b7a92224ac853f07f22fa79148..c6290eebed30f6b75e1439ff518ddb179f5d3a9b 100644 (file)
--- a/setup.py
+++ b/setup.py
@@ -942,7 +942,8 @@ class PyBuildExt(build_ext):
                            extra_compile_args=['-DPy_BUILD_CORE_MODULE']))
 
         # profiler (_lsprof is for cProfile.py)
-        self.add(Extension('_lsprof', ['_lsprof.c', 'rotatingtree.c']))
+        self.add(Extension('_lsprof', ['_lsprof.c', 'rotatingtree.c'],
+                           extra_compile_args=['-DPy_BUILD_CORE_MODULE']))
         # static Unicode character database
         self.add(Extension('unicodedata', ['unicodedata.c'],
                            depends=['unicodedata_db.h', 'unicodename_db.h'],