Closed GoogleCodeExporter closed 9 years ago
What do you think about this alternative that attempts to solve the same
problem:
1) Define a plat_modImport() function that is an optional part of the
platform-porting interface. The platform-programmer creates the function and
registers it by calling a new function: mod_registerPlatImportCallback().
2) I modify mod_import() to test if a callback has been registered, if so call
it *first* before pm_global_module_table is searched. This way, a
platform-programmer can override a module that is defined by the p14p builtins.
(In this case, the "override" happens because the platform modules are
searched and found first)
I think the benefits of this method are that (1) the VM (shared by all
platforms) retains simplicity and the complexity of searching other places for
modules is added to the platform and (2) my method is more lightweight than an
implementation of PEP-302.
Original comment by dwhall...@gmail.com
on 8 May 2012 at 3:48
Interesting idea, essentially it has the same purpose that PEP-302 being far
simple :-D Only that instead of add the custom imports at Python side you do it
at virtual machine level. Ok, i like it :-) Maybe one can develop a full
PEP-302 implementation inside this plat_modImport() function... :-P
Another interesting thing is that since this would allow to override p14p
builtins modules, they could be added easily version more compatibles with
standard lib having inside PyMite just the minimal ones to boot :-)
Original comment by piranna
on 8 May 2012 at 4:40
Original comment by dwhall...@gmail.com
on 8 May 2012 at 5:57
This issue was closed by revision ce34afb80c1a.
Original comment by dwhall...@gmail.com
on 16 May 2012 at 3:53
This implementation is for the v10 branch.
Similar work could be done for the r09 branch, but would have to use code
images instead of marshalled code objects.
Original comment by dwhall...@gmail.com
on 16 May 2012 at 3:55
This issue was closed by revision 93ef157dd8f4.
Original comment by dwhall...@gmail.com
on 20 May 2012 at 3:33
Original issue reported on code.google.com by
piranna
on 15 Apr 2012 at 11:56