]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-131591: Add Py_ prefix to MAX_SCRIPT_PATH_SIZE; remove unprefixed struct tag ...
authorPetr Viktorin <encukou@gmail.com>
Thu, 26 Jun 2025 07:25:41 +0000 (09:25 +0200)
committerGitHub <noreply@github.com>
Thu, 26 Jun 2025 07:25:41 +0000 (09:25 +0200)
Names/macros defined in public headers should have `Py`/`_Py` prefixes.

Include/cpython/pystate.h
Include/internal/pycore_debug_offsets.h
Modules/posixmodule.c

index 54d7e62292966ea9ab978e994f084e9482378cb2..be582122118e44edec5af41ca3a7f2c9b90511bb 100644 (file)
@@ -28,10 +28,10 @@ typedef int (*Py_tracefunc)(PyObject *, PyFrameObject *, int, PyObject *);
 #define PyTrace_OPCODE 7
 
 /* Remote debugger support */
-#define MAX_SCRIPT_PATH_SIZE 512
-typedef struct _remote_debugger_support {
+#define Py_MAX_SCRIPT_PATH_SIZE 512
+typedef struct {
     int32_t debugger_pending_call;
-    char debugger_script_path[MAX_SCRIPT_PATH_SIZE];
+    char debugger_script_path[Py_MAX_SCRIPT_PATH_SIZE];
 } _PyRemoteDebuggerSupport;
 
 typedef struct _err_stackitem {
index ce3fcb109f49f7eaca5016c9f2359e9480a120b1..1b59fa2ef6001447f54a4dcbc8e32e6ef943097e 100644 (file)
@@ -368,7 +368,7 @@ typedef struct _Py_DebugOffsets {
         .remote_debugging_enabled = offsetof(PyInterpreterState, config.remote_debug),  \
         .debugger_pending_call = offsetof(_PyRemoteDebuggerSupport, debugger_pending_call),  \
         .debugger_script_path = offsetof(_PyRemoteDebuggerSupport, debugger_script_path),  \
-        .debugger_script_path_size = MAX_SCRIPT_PATH_SIZE, \
+        .debugger_script_path_size = Py_MAX_SCRIPT_PATH_SIZE, \
     }, \
 }
 
index 7dc5ef39a566e4876884dbe41c91fa939773eb93..b570f81b7cf7c2ad704982e45d66047a6d7e2ad1 100644 (file)
@@ -685,7 +685,8 @@ static void
 reset_remotedebug_data(PyThreadState *tstate)
 {
     tstate->remote_debugger_support.debugger_pending_call = 0;
-    memset(tstate->remote_debugger_support.debugger_script_path, 0, MAX_SCRIPT_PATH_SIZE);
+    memset(tstate->remote_debugger_support.debugger_script_path, 0,
+           Py_MAX_SCRIPT_PATH_SIZE);
 }