-
-
Notifications
You must be signed in to change notification settings - Fork 31.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
gh-131591: Implement PEP 768 #131592
base: main
Are you sure you want to change the base?
gh-131591: Implement PEP 768 #131592
Changes from all commits
6f6b4cd
9b86022
af84100
19ef7ae
444453c
1d3ad3c
eeec1f6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
@@ -29,6 +29,14 @@ typedef int (*Py_tracefunc)(PyObject *, PyFrameObject *, int, PyObject *); | |||||||||
#define PyTrace_C_RETURN 6 | ||||||||||
#define PyTrace_OPCODE 7 | ||||||||||
|
||||||||||
/* Remote debugger support */ | ||||||||||
# define MAX_SCRIPT_PATH_SIZE 512 | ||||||||||
typedef struct _remote_debugger_support { | ||||||||||
int enabled; | ||||||||||
int debugger_pending_call; | ||||||||||
Comment on lines
+35
to
+36
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should probably be explicit about our sizes:
Suggested change
Granted Or, if you'd prefer, the offsets themselves could contain the size of the field - but I think that's overkill. |
||||||||||
char debugger_script_path[MAX_SCRIPT_PATH_SIZE]; | ||||||||||
} _PyRemoteDebuggerSupport; | ||||||||||
|
||||||||||
typedef struct _err_stackitem { | ||||||||||
/* This struct represents a single execution context where we might | ||||||||||
* be currently handling an exception. It is a per-coroutine state | ||||||||||
|
@@ -202,6 +210,7 @@ struct _ts { | |||||||||
The PyThreadObject must hold the only reference to this value. | ||||||||||
*/ | ||||||||||
PyObject *threading_local_sentinel; | ||||||||||
_PyRemoteDebuggerSupport remote_debugger_support; | ||||||||||
}; | ||||||||||
|
||||||||||
# define Py_C_RECURSION_LIMIT 5000 | ||||||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -73,6 +73,7 @@ typedef struct _Py_DebugOffsets { | |
uint64_t id; | ||
uint64_t next; | ||
uint64_t threads_head; | ||
uint64_t threads_main; | ||
uint64_t gc; | ||
uint64_t imports_modules; | ||
uint64_t sysdict; | ||
|
@@ -206,6 +207,15 @@ typedef struct _Py_DebugOffsets { | |
uint64_t gi_iframe; | ||
uint64_t gi_frame_state; | ||
} gen_object; | ||
|
||
struct _debugger_support { | ||
uint64_t eval_breaker; | ||
uint64_t remote_debugger_support; | ||
uint64_t remote_debugging_enabled; | ||
uint64_t debugger_pending_call; | ||
uint64_t debugger_script_path; | ||
uint64_t debugger_script_path_size; | ||
} debugger_support; | ||
} _Py_DebugOffsets; | ||
|
||
|
||
|
@@ -223,6 +233,7 @@ typedef struct _Py_DebugOffsets { | |
.id = offsetof(PyInterpreterState, id), \ | ||
.next = offsetof(PyInterpreterState, next), \ | ||
.threads_head = offsetof(PyInterpreterState, threads.head), \ | ||
.threads_main = offsetof(PyInterpreterState, threads.main), \ | ||
.gc = offsetof(PyInterpreterState, gc), \ | ||
.imports_modules = offsetof(PyInterpreterState, imports.modules), \ | ||
.sysdict = offsetof(PyInterpreterState, sysdict), \ | ||
|
@@ -326,6 +337,14 @@ typedef struct _Py_DebugOffsets { | |
.gi_iframe = offsetof(PyGenObject, gi_iframe), \ | ||
.gi_frame_state = offsetof(PyGenObject, gi_frame_state), \ | ||
}, \ | ||
.debugger_support = { \ | ||
.eval_breaker = offsetof(PyThreadState, eval_breaker), \ | ||
.remote_debugger_support = offsetof(PyThreadState, remote_debugger_support), \ | ||
.remote_debugging_enabled = offsetof(PyInterpreterState, config.remote_debug), \ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should this field really go into the |
||
.debugger_pending_call = offsetof(_PyRemoteDebuggerSupport, debugger_pending_call), \ | ||
.debugger_script_path = offsetof(_PyRemoteDebuggerSupport, debugger_script_path), \ | ||
.debugger_script_path_size = MAX_SCRIPT_PATH_SIZE, \ | ||
}, \ | ||
} | ||
|
||
|
||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -936,7 +936,6 @@ struct _is { | |
_PyThreadStateImpl _initial_thread; | ||
// _initial_thread should be the last field of PyInterpreterState. | ||
// See https://github.com/python/cpython/issues/127117. | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Accidental change? |
||
#if !defined(Py_GIL_DISABLED) && defined(Py_STACKREF_DEBUG) | ||
uint64_t next_stackref; | ||
_Py_hashtable_t *open_stackrefs_table; | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe this field is unused. You added
enabled
here, but never reference it anywhere, and the offsets instead use:I think this line should just be removed (which makes sense, anyway - we want a per-process enablement, not a per-thread enablement).