mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-29 08:15:18 -04:00
event: Replace _PyGen_FetchStopIterationValue in Python 3.13+
See python/cpython#106320 and python/cpython#107032 Closes #1526
This commit is contained in:
parent
a463f25d39
commit
0bc290eb2c
@ -545,7 +545,17 @@ do_python_task() {
|
|||||||
Py_DECREF(_generator);
|
Py_DECREF(_generator);
|
||||||
_generator = nullptr;
|
_generator = nullptr;
|
||||||
|
|
||||||
#if PY_VERSION_HEX >= 0x03030000
|
#if PY_VERSION_HEX >= 0x030D0000 // Python 3.13
|
||||||
|
// Python 3.13 does not support _PyGen_FetchStopIterationValue anymore.
|
||||||
|
if (PyErr_ExceptionMatches(PyExc_StopIteration)) {
|
||||||
|
PyObject *exc = PyErr_GetRaisedException();
|
||||||
|
result = ((PyStopIterationObject *)exc)->value;
|
||||||
|
if (result == nullptr) {
|
||||||
|
result = Py_None;
|
||||||
|
}
|
||||||
|
Py_INCREF(result);
|
||||||
|
Py_DECREF(exc);
|
||||||
|
#elif PY_VERSION_HEX >= 0x03030000
|
||||||
if (_PyGen_FetchStopIterationValue(&result) == 0) {
|
if (_PyGen_FetchStopIterationValue(&result) == 0) {
|
||||||
#else
|
#else
|
||||||
if (PyErr_ExceptionMatches(PyExc_StopIteration)) {
|
if (PyErr_ExceptionMatches(PyExc_StopIteration)) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user