GH-106057: Handle recursion errors in inline class calls properly. (GH-106108)

This commit is contained in:
Mark Shannon 2023-07-07 11:09:26 +01:00 committed by GitHub
parent e1d45b8ed4
commit 24fb627ea7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 108 additions and 91 deletions

View file

@ -1811,7 +1811,7 @@
case EXIT_INIT_CHECK: {
PyObject *should_be_none = stack_pointer[-1];
#line 3018 "Python/bytecodes.c"
#line 3019 "Python/bytecodes.c"
assert(STACK_LEVEL() == 2);
if (should_be_none != Py_None) {
PyErr_Format(PyExc_TypeError,
@ -1827,7 +1827,7 @@
case MAKE_FUNCTION: {
PyObject *codeobj = stack_pointer[-1];
PyObject *func;
#line 3432 "Python/bytecodes.c"
#line 3433 "Python/bytecodes.c"
PyFunctionObject *func_obj = (PyFunctionObject *)
PyFunction_New(codeobj, GLOBALS());
@ -1847,7 +1847,7 @@
case SET_FUNCTION_ATTRIBUTE: {
PyObject *func = stack_pointer[-1];
PyObject *attr = stack_pointer[-2];
#line 3446 "Python/bytecodes.c"
#line 3447 "Python/bytecodes.c"
assert(PyFunction_Check(func));
PyFunctionObject *func_obj = (PyFunctionObject *)func;
switch(oparg) {
@ -1883,13 +1883,13 @@
PyObject *stop = stack_pointer[-(1 + ((oparg == 3) ? 1 : 0))];
PyObject *start = stack_pointer[-(2 + ((oparg == 3) ? 1 : 0))];
PyObject *slice;
#line 3496 "Python/bytecodes.c"
#line 3497 "Python/bytecodes.c"
slice = PySlice_New(start, stop, step);
#line 1889 "Python/executor_cases.c.h"
Py_DECREF(start);
Py_DECREF(stop);
Py_XDECREF(step);
#line 3498 "Python/bytecodes.c"
#line 3499 "Python/bytecodes.c"
if (slice == NULL) { STACK_SHRINK(((oparg == 3) ? 1 : 0)); goto pop_2_error; }
#line 1895 "Python/executor_cases.c.h"
STACK_SHRINK(((oparg == 3) ? 1 : 0));
@ -1901,7 +1901,7 @@
case CONVERT_VALUE: {
PyObject *value = stack_pointer[-1];
PyObject *result;
#line 3502 "Python/bytecodes.c"
#line 3503 "Python/bytecodes.c"
convertion_func_ptr conv_fn;
assert(oparg >= FVC_STR && oparg <= FVC_ASCII);
conv_fn = CONVERSION_FUNCTIONS[oparg];
@ -1916,7 +1916,7 @@
case FORMAT_SIMPLE: {
PyObject *value = stack_pointer[-1];
PyObject *res;
#line 3511 "Python/bytecodes.c"
#line 3512 "Python/bytecodes.c"
/* If value is a unicode object, then we know the result
* of format(value) is value itself. */
if (!PyUnicode_CheckExact(value)) {
@ -1936,7 +1936,7 @@
PyObject *fmt_spec = stack_pointer[-1];
PyObject *value = stack_pointer[-2];
PyObject *res;
#line 3524 "Python/bytecodes.c"
#line 3525 "Python/bytecodes.c"
res = PyObject_Format(value, fmt_spec);
Py_DECREF(value);
Py_DECREF(fmt_spec);
@ -1950,7 +1950,7 @@
case COPY: {
PyObject *bottom = stack_pointer[-(1 + (oparg-1))];
PyObject *top;
#line 3531 "Python/bytecodes.c"
#line 3532 "Python/bytecodes.c"
assert(oparg > 0);
top = Py_NewRef(bottom);
#line 1957 "Python/executor_cases.c.h"
@ -1962,7 +1962,7 @@
case SWAP: {
PyObject *top = stack_pointer[-1];
PyObject *bottom = stack_pointer[-(2 + (oparg-2))];
#line 3556 "Python/bytecodes.c"
#line 3557 "Python/bytecodes.c"
assert(oparg >= 2);
#line 1968 "Python/executor_cases.c.h"
stack_pointer[-1] = bottom;