]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-106320: Remove private _PyTraceback functions (#108453)
authorVictor Stinner <vstinner@python.org>
Thu, 24 Aug 2023 23:35:47 +0000 (01:35 +0200)
committerGitHub <noreply@github.com>
Thu, 24 Aug 2023 23:35:47 +0000 (23:35 +0000)
Move private functions to the internal C API (pycore_traceback.h):

* _Py_DisplaySourceLine()
* _PyTraceback_Add()

Include/cpython/traceback.h
Include/internal/pycore_traceback.h
Modules/_ctypes/callproc.c
Modules/pyexpat.c
Python/_warnings.c

index a4e087b2b4ecedb6ad08545c9be6d0f08e50bfac..81c51944f136f29396699dbcf8a3ddbd5c21b75a 100644 (file)
@@ -11,6 +11,3 @@ struct _traceback {
     int tb_lasti;
     int tb_lineno;
 };
-
-PyAPI_FUNC(int) _Py_DisplaySourceLine(PyObject *, PyObject *, int, int, int *, PyObject **);
-PyAPI_FUNC(void) _PyTraceback_Add(const char *, const char *, int);
index 21fb4a25a0facefd05cad5c2be9add61825ea8d9..01b3f5b6b26d2eef6f3f8d04c587b4f4d1089b8b 100644 (file)
@@ -8,6 +8,12 @@ extern "C" {
 #  error "this header requires Py_BUILD_CORE define"
 #endif
 
+// Export for '_ctypes' shared extension
+PyAPI_FUNC(int) _Py_DisplaySourceLine(PyObject *, PyObject *, int, int, int *, PyObject **);
+
+// Export for 'pyexact' shared extension
+PyAPI_FUNC(void) _PyTraceback_Add(const char *, const char *, int);
+
 /* Write the Python traceback into the file 'fd'. For example:
 
        Traceback (most recent call first):
index f9535db4f57c0e40f30a1f8c9490a0f550530989..fc08c42bd3574abe671c286fb32988a4b2d4a147 100644 (file)
@@ -101,8 +101,10 @@ module _ctypes
 #define DONT_USE_SEH
 #endif
 
-#include "pycore_runtime.h"         // _PyRuntime
-#include "pycore_global_objects.h"  // _Py_ID()
+#include "pycore_runtime.h"       // _PyRuntime
+#include "pycore_global_objects.h"// _Py_ID()
+#include "pycore_traceback.h"     // _PyTraceback_Add()
+
 #include "clinic/callproc.c.h"
 
 #define CTYPES_CAPSULE_NAME_PYMEM "_ctypes pymem"
index a8ce84c0bb9f054531264b760629109bda737ac8..52dd06cd3c818190772e1b622c796c85ec62dd8c 100644 (file)
@@ -5,6 +5,7 @@
 #include "Python.h"
 #include "pycore_import.h"        // _PyImport_SetModule()
 #include "pycore_pyhash.h"        // _Py_HashSecret
+#include "pycore_traceback.h"     // _PyTraceback_Add()
 
 #include <ctype.h>
 #include <stddef.h>               // offsetof()
index 9e562d7ba7f6a7e23d4d7c1a028a5a4d7d97c146..4b7fb888247145fb26f7c534d22d3b6a90c60768 100644 (file)
@@ -1,13 +1,12 @@
 #include "Python.h"
 #include "pycore_dict.h"          // _PyDict_GetItemWithError()
-#include "pycore_frame.h"
-#include "pycore_initconfig.h"
 #include "pycore_interp.h"        // PyInterpreterState.warnings
 #include "pycore_long.h"          // _PyLong_GetZero()
-#include "pycore_pyerrors.h"
+#include "pycore_pyerrors.h"      // _PyErr_Occurred()
 #include "pycore_pylifecycle.h"   // _Py_IsInterpreterFinalizing()
 #include "pycore_pystate.h"       // _PyThreadState_GET()
 #include "pycore_sysmodule.h"     // _PySys_GetAttr()
+#include "pycore_traceback.h"     // _Py_DisplaySourceLine()
 
 #include "clinic/_warnings.c.h"