Issue 14600: Change ImportError reference handling, naming (original) (raw)

Created on 2012-04-16 21:14 by brian.curtin, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
ImportError_changes.diff brian.curtin,2012-04-16 21:14 review
issue14600.diff brian.curtin,2012-04-17 02:43
Messages (9)
msg158499 - (view) Author: Brian Curtin (brian.curtin) * (Python committer) Date: 2012-04-16 21:14
Antoine mentioned in email that the reference handling should be changed, so here's a shot at it. I also condensed and renamed the convenience functions - I was paying too much attention to the surrounding conventions and made this harder than it had to be.
msg158515 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2012-04-17 00:30
Looks good on the principle. Implementation is a bit weird: you don't need to check name and path for NULL-ness?
msg158516 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2012-04-17 00:30
Oh, and is PyErr_SetExcWithArgsKwargs still useful?
msg158523 - (view) Author: Brian Curtin (brian.curtin) * (Python committer) Date: 2012-04-17 02:43
How about this patch? Adds NULL checking and merges PyErr_SetExcWithArgsKwargs inside PyErr_SetImportError since it's not needed by itself. Docs are also updated in line with these changes.
msg158536 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2012-04-17 10:21
You probably want to check args and kwargs for NULL-ness too. Otherwise, looks good.
msg158570 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2012-04-17 21:57
New changeset 7a32b9380ffd by Brian Curtin in branch 'default': Fix #14600. Correct reference handling and naming of ImportError convenience function http://hg.python.org/cpython/rev/7a32b9380ffd
msg158669 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2012-04-18 22:05
As was pointed on python-dev for the first commit: args = PyTuple_New(1); if (args == NULL) return NULL; kwargs = PyDict_New(); if (args == NULL) return NULL; It looks like the second block has a copy-paste typo and should check kwargs, not args.
msg165356 - (view) Author: Eli Bendersky (eli.bendersky) * (Python committer) Date: 2012-07-13 05:29
Eric: your note appears to be fixed in the code. Can this issue be closed?
msg165391 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2012-07-13 16:15
Yep, bf23a6c215f6 fixed it, thanks for the ping. Brian or Antoine, can you close this or was there something else?
History
Date User Action Args
2022-04-11 14:57:29 admin set github: 58805
2012-07-13 16:58:36 brian.curtin set status: open -> closedresolution: fixedstage: patch review -> resolved
2012-07-13 16:15:58 eric.araujo set messages: +
2012-07-13 05:29:09 eli.bendersky set nosy: + eli.benderskymessages: +
2012-04-18 22:05:28 eric.araujo set nosy: + eric.araujomessages: +
2012-04-17 21:57:31 python-dev set nosy: + python-devmessages: +
2012-04-17 10:28:54 pitrou link issue14593 superseder
2012-04-17 10:21:54 pitrou set messages: +
2012-04-17 02:43:07 brian.curtin set files: + issue14600.diffmessages: +
2012-04-17 00:30:48 pitrou set messages: +
2012-04-17 00:30:18 pitrou set messages: +
2012-04-16 21:14:28 brian.curtin create