[pypy-svn] r50647 - pypy/branch/clr-module-improvements/pypy/module/clr
antocuni at codespeak.net
antocuni at codespeak.net
Tue Jan 15 19:15:00 CET 2008
Author: antocuni
Date: Tue Jan 15 19:14:59 2008
New Revision: 50647
Modified:
pypy/branch/clr-module-improvements/pypy/module/clr/app_importer.py
Log:
load extra info just the first time they are needed, else they break
translation (thanks cfbolz again)
Modified: pypy/branch/clr-module-improvements/pypy/module/clr/app_importer.py
==============================================================================
--- pypy/branch/clr-module-improvements/pypy/module/clr/app_importer.py (original)
+++ pypy/branch/clr-module-improvements/pypy/module/clr/app_importer.py Tue Jan 15 19:14:59 2008
@@ -20,15 +20,17 @@
been imported and added to sys.modules.
'''
def __init__(self):
- import clr
- # this might not be the correct place to load the valid NameSpaces
- valid_namespaces, generic_mappings = clr.get_extra_type_info()
- self.valid_namespaces = set(valid_namespaces)
- self.generic_mappings = dict(generic_mappings)
+ self.valid_namespaces = None
+ self.generic_mappings = None
def find_module(self, fullname, path=None):
- # check for true NAMESPACE or .NET TYPE
import clr
+ if self.valid_namespaces is None:
+ # this might not be the correct place to load the valid NameSpaces
+ valid_namespaces, generic_mappings = clr.get_extra_type_info()
+ self.valid_namespaces = set(valid_namespaces)
+ self.generic_mappings = dict(generic_mappings)
+
if fullname in self.valid_namespaces or fullname in self.generic_mappings or clr.isDotNetType(fullname):
# fullname is a .Net Module
return self
More information about the Pypy-commit
mailing list