[issue1559549] ImportError needs attributes for module and file name

Brian Curtin report at bugs.python.org
Thu Feb 9 20:00:00 CET 2012


Brian Curtin <brian at python.org> added the comment:

Here's an updated patch which creates two convenience functions, PyErr_SetFromImportErrorWithName and PyErr_SetFromImportErrorWithNameAndPath. I figure the two common cases are that you'll want to set just a name or you'll want a name and a path.

*WithName is all that I've applied for now, and I've only done it in import.c to allow Brett to continue with his work. I'll come back and make changes elsewhere in the code, and I'll apply the *WithNameAndPath function where I need it for #10854.

All tests pass and some IRL testing works nicely.

Note: I'm a little rushed at the moment so I have not included docs but I will surely update them. I just want to get Brett what he needs by this afternoon.

----------
Added file: http://bugs.python.org/file24467/issue1559549_v2.diff

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue1559549>
_______________________________________


More information about the Python-bugs-list mailing list