Message147931
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. |
|
Date |
User |
Action |
Args |
2011-11-19 09:16:48 | scoder | set | recipients:
+ scoder |
2011-11-19 09:16:48 | scoder | set | messageid: <1321694208.82.0.599594610804.issue13431@psf.upfronthosting.co.za> |
2011-11-19 09:16:48 | scoder | link | issue13431 messages |
2011-11-19 09:16:47 | scoder | create | |
|