We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a463f25 commit 0bc290eCopy full SHA for 0bc290e
1 file changed
panda/src/event/pythonTask.cxx
@@ -545,7 +545,17 @@ do_python_task() {
545
Py_DECREF(_generator);
546
_generator = nullptr;
547
548
-#if PY_VERSION_HEX >= 0x03030000
+#if PY_VERSION_HEX >= 0x030D0000 // Python 3.13
549
+ // Python 3.13 does not support _PyGen_FetchStopIterationValue anymore.
550
+ if (PyErr_ExceptionMatches(PyExc_StopIteration)) {
551
+ PyObject *exc = PyErr_GetRaisedException();
552
+ result = ((PyStopIterationObject *)exc)->value;
553
+ if (result == nullptr) {
554
+ result = Py_None;
555
+ }
556
+ Py_INCREF(result);
557
+ Py_DECREF(exc);
558
+#elif PY_VERSION_HEX >= 0x03030000
559
if (_PyGen_FetchStopIterationValue(&result) == 0) {
560
#else
561
if (PyErr_ExceptionMatches(PyExc_StopIteration)) {
0 commit comments