Brett Cannon <br...@python.org> added the comment:

The patch looks fine for its current semantics except for the fact that the 
macro doesn't work under clang; ##macro_var is supposed to be used only when 
concatenating parts of a string to create a complete identifier, not 
concatenating two identifiers next to each other (e.g. gooblede##gook is fine, 
but self->##gook isn't because '->' is its own identifier).

But one issue is that for my purposes I need 'name' to be the full name of the 
module, not just the tail of the full name. The reason is that pydoc needs a 
way to tell when a module import failed because the module isn't there vs. when 
a module had an actual error itself. Using the tail end of the name doesn't 
help me because it means I can't tell if an import of a module named 'bunk' 
containing the line 'import test.bunk' fails because the module 'bunk' doesn't 
exist or because the import line failed since in both cases name == 'bunk'. But 
if name == 'test.bunk' there is no ambiguity. Pydoc used to do this by 
inspecting the stack and seeing where the exception was thrown which is just 
nasty and brittle (i.e. doesn't work with importlib since the stack goes much 
farther until ImportError is thrown).

IOW I don't think we should be tossing out valuable data just because 
historically modules that didn't exist only returned the tail end of the full 
module name. Anyone object to switching to using the full name of the module 
triggering the exception? The message wouldn't change to use the full name 
(unfortunately) for backwards-compatibility reasons of course.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue1559549>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to