summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorFred Drake <fdrake@acm.org>2000-10-05 20:42:44 (GMT)
committerFred Drake <fdrake@acm.org>2000-10-05 20:42:44 (GMT)
commit034c2a9f7ab8c6d1887d258385a13d271bc20d32 (patch)
tree158376d501f32f79a99add97bea7fcb86bb6f87a /Lib
parent410cb6be8f15b102caddce0e70bbe4cb37ec24e9 (diff)
downloadcpython-034c2a9f7ab8c6d1887d258385a13d271bc20d32.zip
cpython-034c2a9f7ab8c6d1887d258385a13d271bc20d32.tar.gz
cpython-034c2a9f7ab8c6d1887d258385a13d271bc20d32.tar.bz2
Add support for "import re" -- it uses pre, but user code does not need
to.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/rexec.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/Lib/rexec.py b/Lib/rexec.py
index 6ad53b5..8ba3553 100644
--- a/Lib/rexec.py
+++ b/Lib/rexec.py
@@ -153,6 +153,9 @@ class RExec(ihooks._Verbose):
self.make_sys()
self.loader = RModuleLoader(self.hooks, verbose)
self.importer = RModuleImporter(self.loader, verbose)
+ # but since re isn't normally built-in, we can add it at the end;
+ # we need the imported to be set before this can be imported.
+ self.make_re()
def set_trusted_path(self):
# Set the path from which dynamic modules may be loaded.
@@ -198,6 +201,13 @@ class RExec(ihooks._Verbose):
for key, value in os.environ.items():
e[key] = value
+ def make_re(self):
+ dst = self.add_module("re")
+ src = self.r_import("pre")
+ for name in dir(src):
+ if name != "__name__":
+ setattr(dst, name, getattr(src, name))
+
def make_sys(self):
m = self.copy_only(sys, self.ok_sys_names)
m.modules = self.modules