Skip to content

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

Merged
merged 4 commits into from
Mar 21, 2017

Conversation

zhangyangyu
Copy link
Member

No description provided.

@zhangyangyu zhangyangyu added the type-bug An unexpected behavior, bug, or error label Mar 18, 2017
@mention-bot
Copy link

@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.

@brettcannon
Copy link
Member

The Travis failures were probably due to GH-697 which has now been fixed in GH-718. Please rebase your branch to pick up the change.

Copy link
Member

@brettcannon brettcannon left a 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 */
Copy link
Member

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.

Copy link
Member Author

@zhangyangyu zhangyangyu Mar 20, 2017

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?

Copy link
Member

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 {
Copy link
Member

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 */
Copy link
Member

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);
Copy link
Member

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.

@zhangyangyu zhangyangyu merged commit 4830f58 into python:master Mar 21, 2017
@zhangyangyu zhangyangyu deleted the bpo-29849 branch March 21, 2017 03:13
@zhangyangyu
Copy link
Member Author

Thanks @serhiy-storchaka and @brettcannon !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants