[issue1559549] ImportError needs attributes for module and file name
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>
More information about the Python-bugs-list