[pypy-svn] r4802 - in pypy/trunk/src/pypy: . appspace appspace/test

hpk at codespeak.net hpk at codespeak.net
Tue Jun 1 14:41:43 CEST 2004


Author: hpk
Date: Tue Jun  1 14:41:42 2004
New Revision: 4802

Added:
   pypy/trunk/src/pypy/appspace/exceptions.py
   pypy/trunk/src/pypy/appspace/test/test_exceptions.py
Modified:
   pypy/trunk/src/pypy/TODO
Log:
added exceptions-module that just assign all builtin exceptions
to the exceptions's module namespace. 

a test to just import that

added String Formatting to the TODO list! 



Modified: pypy/trunk/src/pypy/TODO
==============================================================================
--- pypy/trunk/src/pypy/TODO	(original)
+++ pypy/trunk/src/pypy/TODO	Tue Jun  1 14:41:42 2004
@@ -1,4 +1,11 @@
-* Provide an importer that can import packages.
+* String Formatting: the % mod operator needs to be implemented 
+  for dicts and the current hack for tuples (which just unwraps 
+  to cpython and calls the % operator) needs to be properly 
+  written at interp- or app-level. 
+
+* Provide an importer that can import packages. (we have a 
+  limited __import__ builtin defined) 
+
   Consider PEP 302, new import hooks.
   Try to write as much as possible in app-level.
   How would PyPy import CPython extensions?

Added: pypy/trunk/src/pypy/appspace/exceptions.py
==============================================================================
--- (empty file)
+++ pypy/trunk/src/pypy/appspace/exceptions.py	Tue Jun  1 14:41:42 2004
@@ -0,0 +1,14 @@
+
+
+def _genex():
+    glob = globals()
+    import __builtin__ 
+    for name, value in __builtin__.__dict__.items():
+        try:
+            if issubclass(value, Exception):
+                glob[name] = value 
+        except TypeError:
+            pass
+
+_genex()
+del _genex

Added: pypy/trunk/src/pypy/appspace/test/test_exceptions.py
==============================================================================
--- (empty file)
+++ pypy/trunk/src/pypy/appspace/test/test_exceptions.py	Tue Jun  1 14:41:42 2004
@@ -0,0 +1,10 @@
+import autopath
+from pypy.tool import testit
+
+class A(testit.AppTestCase):
+    def test_import(self):
+        import exceptions
+        assert exceptions.SyntaxError is SyntaxError 
+
+if __name__ == '__main__':
+    testit.main()



More information about the Pypy-commit mailing list