File tree Expand file tree Collapse file tree 5 files changed +21
-8
lines changed Expand file tree Collapse file tree 5 files changed +21
-8
lines changed Original file line number Diff line number Diff line change @@ -2532,9 +2532,14 @@ def foo(x):
2532
2532
_C ._log_api_usage_once ("torch.compile" )
2533
2533
if sys .version_info >= (3 , 14 ):
2534
2534
raise RuntimeError ("torch.compile is not supported on Python 3.14+" )
2535
- elif sysconfig .get_config_var ("Py_GIL_DISABLED" ) == 1 :
2535
+ elif sysconfig .get_config_var ("Py_GIL_DISABLED" ) == 1 and sys .version_info < (
2536
+ 3 ,
2537
+ 13 ,
2538
+ 3 ,
2539
+ ):
2536
2540
raise RuntimeError (
2537
- "torch.compile is not supported on Python built with GIL disabled"
2541
+ "torch.compile is not supported on Python < 3.13.3 built with GIL disabled. "
2542
+ "Please use Python 3.13.3+."
2538
2543
)
2539
2544
2540
2545
# Decorator mode
Original file line number Diff line number Diff line change @@ -896,9 +896,14 @@ def __call__(self, fn):
896
896
def check_if_dynamo_supported ():
897
897
if sys .version_info >= (3 , 14 ):
898
898
raise RuntimeError ("Python 3.14+ not yet supported for torch.compile" )
899
- elif sysconfig .get_config_var ("Py_GIL_DISABLED" ) == 1 :
899
+ elif sysconfig .get_config_var ("Py_GIL_DISABLED" ) == 1 and sys .version_info < (
900
+ 3 ,
901
+ 13 ,
902
+ 3 ,
903
+ ):
900
904
raise RuntimeError (
901
- "torch.compile is not supported on Python built with GIL disabled"
905
+ "torch.compile is not supported on Python < 3.13.3 built with GIL disabled. "
906
+ "Please use Python 3.13.3+."
902
907
)
903
908
904
909
Original file line number Diff line number Diff line change @@ -2283,7 +2283,7 @@ class CppPythonBindingsCodeCache(CppCodeCache):
2283
2283
return NULL;
2284
2284
}}
2285
2285
#ifdef Py_GIL_DISABLED
2286
- PyUnstable_Module_SetGIL(mod , Py_MOD_GIL_NOT_USED);
2286
+ PyUnstable_Module_SetGIL(module , Py_MOD_GIL_NOT_USED);
2287
2287
#endif
2288
2288
return module;
2289
2289
}}
Original file line number Diff line number Diff line change @@ -589,7 +589,10 @@ static PyObject* set_skip_guard_eval_unsafe(
589
589
}
590
590
591
591
static PyObject * get_eval_frame_callback_py (PyObject * dummy , PyObject * args ) {
592
- return eval_frame_callback_get ();
592
+ // New reference
593
+ PyObject * callback = eval_frame_callback_get ();
594
+ Py_INCREF (callback );
595
+ return callback ;
593
596
}
594
597
595
598
static PyObject * reset_code (PyObject * dummy , PyObject * code ) {
Original file line number Diff line number Diff line change @@ -940,13 +940,13 @@ std::string get_exception_message() {
940
940
PyErr_Fetch (&ptype, &pvalue, &ptraceback);
941
941
942
942
PyObject* exc_message_pyobj = PyObject_Str (pvalue);
943
- const char * exc_message = PyUnicode_AsUTF8 (exc_message_pyobj);
943
+ std::string exc_message = PyUnicode_AsUTF8 (exc_message_pyobj);
944
944
945
945
Py_DECREF (exc_message_pyobj);
946
946
Py_XDECREF (ptype);
947
947
Py_XDECREF (pvalue);
948
948
Py_XDECREF (ptraceback);
949
- return std::string ( exc_message) ;
949
+ return exc_message;
950
950
}
951
951
952
952
bool is_immutable_object (py::handle example_value) {
You can’t perform that action at this time.
0 commit comments