mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
[dynamo, 3.14] fix stack ref copy error (#163796)
Pull Request resolved: https://github.com/pytorch/pytorch/pull/163796 Approved by: https://github.com/anijain2305 ghstack dependencies: #161838, #161555, #161839, #163009, #163109, #163110, #163191, #163292
This commit is contained in:
committed by
PyTorch MergeBot
parent
9278b18ec0
commit
d4b785a6a7
@ -229,11 +229,7 @@ const char* get_frame_name(THP_EVAL_API_FRAME_OBJECT* frame) {
|
||||
|
||||
#if IS_PYTHON_3_14_PLUS
|
||||
static void dup_obj(_PyStackRef* dst, _PyStackRef src) {
|
||||
if (PyStackRef_IsNull(src)) {
|
||||
*dst = (_PyStackRef){0};
|
||||
} else {
|
||||
*dst = PyStackRef_DUP(src);
|
||||
}
|
||||
*dst = PyStackRef_DUP(src);
|
||||
}
|
||||
#else
|
||||
static void dup_obj(PyObject** dst, PyObject* src) {
|
||||
@ -502,13 +498,19 @@ PyObject* dynamo_eval_custom_code(
|
||||
THP_EVAL_API_FRAME_OBJECT* frame,
|
||||
PyCodeObject* code,
|
||||
const char* trace_annotation,
|
||||
int throw_flag) { return NULL; }
|
||||
int throw_flag) {
|
||||
return NULL;
|
||||
}
|
||||
THPPyInterpreterFrame* THPPyInterpreterFrame_New(
|
||||
THP_EVAL_API_FRAME_OBJECT* frame) { return NULL; }
|
||||
THP_EVAL_API_FRAME_OBJECT* frame) {
|
||||
return NULL;
|
||||
}
|
||||
PyObject* dynamo_eval_frame_default(
|
||||
PyThreadState* tstate,
|
||||
THP_EVAL_API_FRAME_OBJECT* frame,
|
||||
int throw_flag) { return NULL; }
|
||||
int throw_flag) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static struct PyGetSetDef THPPyInterpreterFrame_properties[] = {{NULL}};
|
||||
|
||||
@ -565,9 +567,7 @@ static PyObject* decrement_working_threads(
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
static PyObject* set_eval_frame(
|
||||
PyObject* new_callback,
|
||||
PyObject* module) {
|
||||
static PyObject* set_eval_frame(PyObject* new_callback, PyObject* module) {
|
||||
// Change the eval frame callback and return the old one
|
||||
// - None: disables TorchDynamo
|
||||
// - False: run-only mode (reuse existing compiles)
|
||||
@ -587,8 +587,8 @@ static PyObject* set_eval_frame(
|
||||
|
||||
Py_INCREF(new_callback);
|
||||
|
||||
// Set thread local callback. This will drive behavior of our shim, if/when it
|
||||
// is installed.
|
||||
// Set thread local callback. This will drive behavior of our shim, if/when
|
||||
// it is installed.
|
||||
eval_frame_callback_set(new_callback);
|
||||
|
||||
// Transfer owned reference from eval_frame_callback_get() to caller
|
||||
|
Reference in New Issue
Block a user