[Python-checkins] r57376 - sandbox/trunk/import_in_py/_importlib.py

brett.cannon python-checkins at python.org
Fri Aug 24 06:18:24 CEST 2007


Author: brett.cannon
Date: Fri Aug 24 06:18:24 2007
New Revision: 57376

Modified:
   sandbox/trunk/import_in_py/_importlib.py
Log:
Flesh out handle_code's docstring to cover what the loader must implement.


Modified: sandbox/trunk/import_in_py/_importlib.py
==============================================================================
--- sandbox/trunk/import_in_py/_importlib.py	(original)
+++ sandbox/trunk/import_in_py/_importlib.py	Fri Aug 24 06:18:24 2007
@@ -314,7 +314,26 @@
 
 def handle_code(loader, name, source_path, bytecode_path):
     """Return the code object and the location of the code used to create the
-    code object in a two-item sequence."""
+    code object in a two-item sequence.
+    
+    The loader is expected to implement:
+
+    + get_bytecode(name:str) -> str
+        Read bytecode.
+        Only called if bytecode_path is true.
+    + mod_time(name:str) -> int
+        Return the last modification time for the source of the specified
+        module.
+        Only called if both source_path and bytecode_path are true.
+    + get_source(name:str) -> str
+        Return the source code for the module.
+        Only called if source_path is true.
+    + write_bytecode(name:str, timestamp:int, data:str) -> bool
+        Write out bytecode for the module with the specified timestamp,
+        returning a boolean based on whether any actual storage of the bytecode
+        was done.
+    
+    """
     # Request paths instead of just booleans since 'compile' needs it for
     # source.
     if not source_path and not bytecode_path:


More information about the Python-checkins mailing list