-
-
Notifications
You must be signed in to change notification settings - Fork 31.9k
bpo-29849: fix memory leak in import_from #712
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@zhangyangyu, thanks for your PR! By analyzing the history of the files in this pull request, we identified @benjaminp, @serhiy-storchaka and @1st1 to be potential reviewers. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor doc removal, otherwise LGTM.
Python/ceval.c
Outdated
"cannot import name %R from %R (unknown location)", | ||
name, pkgname_or_unknown | ||
); | ||
/* doesn't check NULL for errmsg, PyErr_SetImportError will catch */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think the comment is necessary long-term.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment is to make others know the error check is left out deliberately. It is not an oversight.
Do you think it's a must to remove it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you want to keep it then please change it to "/* NULL check for errmsg done by PyErr_SetImportError. */".
Python/ceval.c
Outdated
name, pkgname_or_unknown | ||
); | ||
/* doesn't check NULL for errmsg, PyErr_SetImportError will catch */ | ||
PyErr_SetImportError(errmsg, pkgname, NULL); | ||
} else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While you're here you might as well fix the formatting for this.
Python/ceval.c
Outdated
"cannot import name %R from %R (unknown location)", | ||
name, pkgname_or_unknown | ||
); | ||
/* doesn't check NULL for errmsg, PyErr_SetImportError will catch */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you want to keep it then please change it to "/* NULL check for errmsg done by PyErr_SetImportError. */".
Python/ceval.c
Outdated
"cannot import name %R from %R (%S)", | ||
name, pkgname_or_unknown, pkgpath | ||
); | ||
PyErr_SetImportError(errmsg, pkgname, pkgpath); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need a similar comment here if you are going to leave it in.
Thanks @serhiy-storchaka and @brettcannon ! |
No description provided.