[Python-Dev] RFC: trunk checkins between now and 2.5 final

Nick Coghlan ncoghlan at gmail.com
Thu Jun 29 14:04:06 CEST 2006


Nick Coghlan wrote:
> I consider the proposed import change (looking for __module_name__ in the main 
> module) a bug fix for the interaction between PEP 338 and 328, but I'll hold 
> off on committing it until I get the OK from yourself or Neal (and put the 
> patch on SF in the meantime).

Or maybe not, since SF is still broken :(

You can find the diff here instead:

http://members.iinet.net.au/~ncoghlan/main_relative_imports.diff

The patch includes updates to import.c so that relative imports from a main 
module executed with -m will work automatically, some additional tests in 
test_runpy to make sure this all works as intended, and a couple of paragraphs 
in the tutorial about using explicit relative imports instead of implicit ones.

The changes to make runpy set '__module_name__' as well as '__name__' (and the 
associated doc and test changes) have already been committed.

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia
---------------------------------------------------------------
             http://www.boredomandlaziness.org


More information about the Python-Dev mailing list