This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author scoder
Recipients scoder
Date 2011-11-19.09:16:47
SpamBayes Score 8.876233e-13
Marked as misclassified No
Message-id <1321694208.82.0.599594610804.issue13431@psf.upfronthosting.co.za>
In-reply-to
Content
This is a follow-up to issue 13429, which deals with setting __file__ on newly created extension modules earlier than it is currently the case.

Currently, the module init function of extension modules lacks a way to find out the context in which it is being imported, e.g. its package path or its location in the file system. This makes it tricky for extension modules to do things like loading package resources or using relative imports at init time.

This can be fixed by allowing the init function to take a context struct as argument, which would contain object pointers to the FQ package name and file path, and potentially other information.

I think this would be backwards compatible to existing code, because C should allow the caller of the init function to pack additional arguments on the stack that the called function simply doesn't care about. From CPython 3.3 on, however, new and updated code could benefit from this feature.
History
Date User Action Args
2011-11-19 09:16:48scodersetrecipients: + scoder
2011-11-19 09:16:48scodersetmessageid: <1321694208.82.0.599594610804.issue13431@psf.upfronthosting.co.za>
2011-11-19 09:16:48scoderlinkissue13431 messages
2011-11-19 09:16:47scodercreate