GH-105588: Add missing error checks to some obj2ast_* converters (GH-105589)

This commit is contained in:
Brandt Bucher 2023-06-15 15:45:13 -07:00 committed by GitHub
parent 3af2dc7588
commit a4056c8f9c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 37 additions and 0 deletions

View file

@ -601,6 +601,7 @@ class Obj2ModVisitor(PickleVisitor):
args = [f.name for f in prod.fields]
args.extend([a.name for a in prod.attributes])
self.emit("*out = %s(%s);" % (ast_func_name(name), self.buildArgs(args)), 1)
self.emit("if (*out == NULL) goto failed;", 1)
self.emit("return 0;", 1)
self.emit("failed:", 0)
self.emit("Py_XDECREF(tmp);", 1)