]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-106905: avoid incorrect SystemError about recursion depth mismatch (#106906)
authorMarkus Mohrhard <markusm@dug.com>
Mon, 13 Nov 2023 13:05:17 +0000 (21:05 +0800)
committerGitHub <noreply@github.com>
Mon, 13 Nov 2023 13:05:17 +0000 (13:05 +0000)
* gh-106905: avoid incorrect SystemError about recursion depth mismatch

* Update Misc/NEWS.d/next/Core and Builtins/2023-07-20-11-41-16.gh-issue-106905.AyZpuB.rst

---------

Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Misc/NEWS.d/next/Core and Builtins/2023-07-20-11-41-16.gh-issue-106905.AyZpuB.rst [new file with mode: 0644]
Parser/asdl_c.py
Python/Python-ast.c

diff --git a/Misc/NEWS.d/next/Core and Builtins/2023-07-20-11-41-16.gh-issue-106905.AyZpuB.rst b/Misc/NEWS.d/next/Core and Builtins/2023-07-20-11-41-16.gh-issue-106905.AyZpuB.rst
new file mode 100644 (file)
index 0000000..73b7583
--- /dev/null
@@ -0,0 +1 @@
+Fix incorrect SystemError about AST constructor recursion depth mismatch.
index f61099b97055adbf958e3aab3d2c21ec9717d7f7..ae642e83fb15e100c20923efd4c2c0832675711a 100755 (executable)
@@ -1286,6 +1286,7 @@ class ObjVisitor(PickleVisitor):
         self.emit("state->recursion_depth--;", 1)
         self.emit("return result;", 1)
         self.emit("failed:", 0)
+        self.emit("state->recursion_depth--;", 1)
         self.emit("Py_XDECREF(value);", 1)
         self.emit("Py_XDECREF(result);", 1)
         self.emit("return NULL;", 1)
index a197d44868b5aa3eaef495c86898944c44c7863e..ec132078c1536eb27d8dee66dc75a2e878236c00 100644 (file)
@@ -3846,6 +3846,7 @@ ast2obj_mod(struct ast_state *state, void* _o)
     state->recursion_depth--;
     return result;
 failed:
+    state->recursion_depth--;
     Py_XDECREF(value);
     Py_XDECREF(result);
     return NULL;
@@ -4451,6 +4452,7 @@ ast2obj_stmt(struct ast_state *state, void* _o)
     state->recursion_depth--;
     return result;
 failed:
+    state->recursion_depth--;
     Py_XDECREF(value);
     Py_XDECREF(result);
     return NULL;
@@ -4934,6 +4936,7 @@ ast2obj_expr(struct ast_state *state, void* _o)
     state->recursion_depth--;
     return result;
 failed:
+    state->recursion_depth--;
     Py_XDECREF(value);
     Py_XDECREF(result);
     return NULL;
@@ -5073,6 +5076,7 @@ ast2obj_comprehension(struct ast_state *state, void* _o)
     state->recursion_depth--;
     return result;
 failed:
+    state->recursion_depth--;
     Py_XDECREF(value);
     Py_XDECREF(result);
     return NULL;
@@ -5138,6 +5142,7 @@ ast2obj_excepthandler(struct ast_state *state, void* _o)
     state->recursion_depth--;
     return result;
 failed:
+    state->recursion_depth--;
     Py_XDECREF(value);
     Py_XDECREF(result);
     return NULL;
@@ -5198,6 +5203,7 @@ ast2obj_arguments(struct ast_state *state, void* _o)
     state->recursion_depth--;
     return result;
 failed:
+    state->recursion_depth--;
     Py_XDECREF(value);
     Py_XDECREF(result);
     return NULL;
@@ -5258,6 +5264,7 @@ ast2obj_arg(struct ast_state *state, void* _o)
     state->recursion_depth--;
     return result;
 failed:
+    state->recursion_depth--;
     Py_XDECREF(value);
     Py_XDECREF(result);
     return NULL;
@@ -5313,6 +5320,7 @@ ast2obj_keyword(struct ast_state *state, void* _o)
     state->recursion_depth--;
     return result;
 failed:
+    state->recursion_depth--;
     Py_XDECREF(value);
     Py_XDECREF(result);
     return NULL;
@@ -5368,6 +5376,7 @@ ast2obj_alias(struct ast_state *state, void* _o)
     state->recursion_depth--;
     return result;
 failed:
+    state->recursion_depth--;
     Py_XDECREF(value);
     Py_XDECREF(result);
     return NULL;
@@ -5403,6 +5412,7 @@ ast2obj_withitem(struct ast_state *state, void* _o)
     state->recursion_depth--;
     return result;
 failed:
+    state->recursion_depth--;
     Py_XDECREF(value);
     Py_XDECREF(result);
     return NULL;
@@ -5443,6 +5453,7 @@ ast2obj_match_case(struct ast_state *state, void* _o)
     state->recursion_depth--;
     return result;
 failed:
+    state->recursion_depth--;
     Py_XDECREF(value);
     Py_XDECREF(result);
     return NULL;
@@ -5604,6 +5615,7 @@ ast2obj_pattern(struct ast_state *state, void* _o)
     state->recursion_depth--;
     return result;
 failed:
+    state->recursion_depth--;
     Py_XDECREF(value);
     Py_XDECREF(result);
     return NULL;
@@ -5643,6 +5655,7 @@ ast2obj_type_ignore(struct ast_state *state, void* _o)
     state->recursion_depth--;
     return result;
 failed:
+    state->recursion_depth--;
     Py_XDECREF(value);
     Py_XDECREF(result);
     return NULL;
@@ -5722,6 +5735,7 @@ ast2obj_type_param(struct ast_state *state, void* _o)
     state->recursion_depth--;
     return result;
 failed:
+    state->recursion_depth--;
     Py_XDECREF(value);
     Py_XDECREF(result);
     return NULL;