Sorry, something went wrong.
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.
Sorry, something went wrong.
| 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.
Sorry, something went wrong.
|
@brandtbucher, please address the review comments. Thanks! |
Sorry, something went wrong.
|
Sorry @vstinner, I didn't realize that PEP 7 applied to generated code. Fixed! |
Sorry, something went wrong.
There was a problem hiding this comment.
Thanks, LGTM.
Sorry, something went wrong.
|
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. |
Sorry, something went wrong.
|
Thanks! |
Sorry, something went wrong.
https://bugs.python.org/issue38823