Sorry, something went wrong.
|
Since you plan to convert pyexpat to multiphase init, could you already add an "exec" function, and modify the PyInit to call it? So later you will have no replace all "goto error" with "return -1". |
Sorry, something went wrong.
There was a problem hiding this comment.
Thanks, add_submodule() is nice. But my idea was to go further and put all code using errors_module in a sub-function and call it from the init function. Same for model_module.
Sorry, something went wrong.
|
Thanks, add_submodule() is nice. But my idea was to go further and put all code using errors_module in a sub-function and call it from the init function. Same for model_module. Oh - sure I can do that. |
Sorry, something went wrong.
There was a problem hiding this comment.
Thanks, it's way better! Variables have a shorter scopes, error handling is easier to review. More comments.
Sorry, something went wrong.
There was a problem hiding this comment.
LGTM, but please address the few minor remaining issues before I can merge your change.
Oh wow, I didn't expect a so large PR to add error handling to PyInit_pyexpat()! Maybe there was a reason to ignore errors :-D It's complex to handle errors in C :-(
I like the new design of the code with many smaller functions and more narrow scope for variables. It's way simpler to track the lifetime of each variable, and so check manually for reference leaks!
Note: I still hate the INCREF/DECREF required by PyModule_AddObject() (that's unrelated to your PR, I just hate this function.)
Sorry, something went wrong.
|
Merged. I rewrote your PR title and description. |
Sorry, something went wrong.
Preparation for multi-phase init. See #22222 for origin of most of these changes
https://bugs.python.org/issue1635741