diff options
Diffstat (limited to 'Python')
-rw-r--r-- | Python/bltinmodule.c | 27 | ||||
-rw-r--r-- | Python/gc_free_threading.c | 6 |
2 files changed, 18 insertions, 15 deletions
diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c index f776120..7a12a86 100644 --- a/Python/bltinmodule.c +++ b/Python/bltinmodule.c @@ -2537,22 +2537,19 @@ static PyObject * builtin_round_impl(PyObject *module, PyObject *number, PyObject *ndigits) /*[clinic end generated code: output=ff0d9dd176c02ede input=275678471d7aca15]*/ { - PyObject *round, *result; - - round = _PyObject_LookupSpecial(number, &_Py_ID(__round__)); - if (round == NULL) { - if (!PyErr_Occurred()) - PyErr_Format(PyExc_TypeError, - "type %.100s doesn't define __round__ method", - Py_TYPE(number)->tp_name); - return NULL; + PyObject *result; + if (ndigits == Py_None) { + result = _PyObject_MaybeCallSpecialNoArgs(number, &_Py_ID(__round__)); + } + else { + result = _PyObject_MaybeCallSpecialOneArg(number, &_Py_ID(__round__), + ndigits); + } + if (result == NULL && !PyErr_Occurred()) { + PyErr_Format(PyExc_TypeError, + "type %.100s doesn't define __round__ method", + Py_TYPE(number)->tp_name); } - - if (ndigits == Py_None) - result = _PyObject_CallNoArgs(round); - else - result = PyObject_CallOneArg(round, ndigits); - Py_DECREF(round); return result; } diff --git a/Python/gc_free_threading.c b/Python/gc_free_threading.c index 70dace9..4c459b0 100644 --- a/Python/gc_free_threading.c +++ b/Python/gc_free_threading.c @@ -433,6 +433,12 @@ static void gc_visit_thread_stacks(PyInterpreterState *interp, struct collection_state *state) { _Py_FOR_EACH_TSTATE_BEGIN(interp, p) { + _PyCStackRef *c_ref = ((_PyThreadStateImpl *)p)->c_stack_refs; + while (c_ref != NULL) { + gc_visit_stackref(c_ref->ref); + c_ref = c_ref->next; + } + for (_PyInterpreterFrame *f = p->current_frame; f != NULL; f = f->previous) { if (f->owner >= FRAME_OWNED_BY_INTERPRETER) { continue; |