[Python-checkins] r56968 - sandbox/trunk/import_in_py/NOTES

brett.cannon python-checkins at python.org
Mon Aug 13 00:19:49 CEST 2007


Author: brett.cannon
Date: Mon Aug 13 00:19:48 2007
New Revision: 56968

Modified:
   sandbox/trunk/import_in_py/NOTES
Log:
Flesh out even more how to find out how to handle get_code().


Modified: sandbox/trunk/import_in_py/NOTES
==============================================================================
--- sandbox/trunk/import_in_py/NOTES	(original)
+++ sandbox/trunk/import_in_py/NOTES	Mon Aug 13 00:19:48 2007
@@ -6,7 +6,8 @@
     Return the text for a source module.
     XXX Consider just using get_source from PEP 302 optional extensions.
 * bytecode(module_name) -> bytes
-    Return the bytes for a bytecode module.
+    Return the bytes for a bytecode-stored module (including timestamp and
+    cookie).
     XXX Rename to get_bytecode if get_source is viable for source().
 * write_bytecode(module_name, data:bytes) -> bool
     Write out the new representation of a bytecode module.  Returns a boolean
@@ -38,7 +39,11 @@
     importer/loader.  For simplicity, naively compile source and fall back on
     bytecode only if no source (require a check for the bytecode cookie?).
     Might be prudent to end up with a function in imp that takes a loader and
-    can handle the proper thing to do based on source() and bytecode().
+    can handle the proper thing to do based on source() and bytecode().  As PEP
+    302 does not specify that get_code necessarily deals with this issue, can
+    probably cheat and just use bytecode blindly if no source is available, but
+    test first (generate a zip of .pyc files from 2.4, open with zipimport in
+    2.5 and see what get_code() does).
 * get_source(fullname:str) -> str
 
 


More information about the Python-checkins mailing list