Uh oh!
There was an error while loading. Please reload this page.
bpo-38823: Clean up refleaks in _ast initialization. - #17276
Conversation
corona10
left a comment
There was a problem hiding this comment.
PR looks good to me.
The specific change is that error handling is done by the goto statement
and this decision is looking good to me for this situation.
@vstinner
Please take a look at @brandtbucher 's PR as the core developer.
Thank you for understanding.
| self.emit("if (!init_types()) return NULL;", 1) | ||
| self.emit('m = PyState_FindModule(&_astmodule);', 1) | ||
| self.emit("if (!m) return NULL;", 1) | ||
| self.emit('if (PyModule_AddObject(m, "AST", astmodulestate_global->AST_type) < 0) goto error;', 1) |
There was a problem hiding this comment.
Please add braces, see PEP 7.
| self.emit('if (PyModule_AddObject(m, "AST", astmodulestate_global->AST_type) < 0) goto error;', 1) | |
| self.emit('if (PyModule_AddObject(m, "AST", astmodulestate_global->AST_type) < 0) { goto error; }', 1) |
Same for changes below.
csabella
commented
Jan 26, 2020
@brandtbucher, please address the review comments. Thanks! |
brandtbucher
commented
Jan 28, 2020
Sorry @vstinner, I didn't realize that PEP 7 applied to generated code. Fixed! |
vstinner
commented
Feb 6, 2020
I don't see the need to backport such change. Errors in _ast init function are very unlikely. I prefer to reduce the number of backported changes to stable branches to reduce the risk of regression. |
brandtbucher
commented
Feb 6, 2020
Thanks! |
https://bugs.python.org/issue38823