Skip to content

Commit a1da208

Browse files
authored
gh-131591: Add Py_ prefix to MAX_SCRIPT_PATH_SIZE; remove unprefixed struct tag (GH-135924)
Names/macros defined in public headers should have `Py`/`_Py` prefixes.
1 parent e3ea6f2 commit a1da208

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

Include/cpython/pystate.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ typedef int (*Py_tracefunc)(PyObject *, PyFrameObject *, int, PyObject *);
2828
#define PyTrace_OPCODE 7
2929

3030
/* Remote debugger support */
31-
#define MAX_SCRIPT_PATH_SIZE 512
32-
typedef struct _remote_debugger_support {
31+
#define Py_MAX_SCRIPT_PATH_SIZE 512
32+
typedef struct {
3333
int32_t debugger_pending_call;
34-
char debugger_script_path[MAX_SCRIPT_PATH_SIZE];
34+
char debugger_script_path[Py_MAX_SCRIPT_PATH_SIZE];
3535
} _PyRemoteDebuggerSupport;
3636

3737
typedef struct _err_stackitem {

Include/internal/pycore_debug_offsets.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ typedef struct _Py_DebugOffsets {
368368
.remote_debugging_enabled = offsetof(PyInterpreterState, config.remote_debug), \
369369
.debugger_pending_call = offsetof(_PyRemoteDebuggerSupport, debugger_pending_call), \
370370
.debugger_script_path = offsetof(_PyRemoteDebuggerSupport, debugger_script_path), \
371-
.debugger_script_path_size = MAX_SCRIPT_PATH_SIZE, \
371+
.debugger_script_path_size = Py_MAX_SCRIPT_PATH_SIZE, \
372372
}, \
373373
}
374374

Modules/posixmodule.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -685,7 +685,8 @@ static void
685685
reset_remotedebug_data(PyThreadState *tstate)
686686
{
687687
tstate->remote_debugger_support.debugger_pending_call = 0;
688-
memset(tstate->remote_debugger_support.debugger_script_path, 0, MAX_SCRIPT_PATH_SIZE);
688+
memset(tstate->remote_debugger_support.debugger_script_path, 0,
689+
Py_MAX_SCRIPT_PATH_SIZE);
689690
}
690691

691692

0 commit comments

Comments
 (0)