[pypy-svn] r7384 - pypy/trunk/src/pypy/translator

hpk at codespeak.net hpk at codespeak.net
Thu Nov 18 16:20:44 CET 2004


Author: hpk
Date: Thu Nov 18 16:20:43 2004
New Revision: 7384

Modified:
   pypy/trunk/src/pypy/translator/genc.py
Log:
added a few types
changed a few errors to warnings ... (mwh)



Modified: pypy/trunk/src/pypy/translator/genc.py
==============================================================================
--- pypy/trunk/src/pypy/translator/genc.py	(original)
+++ pypy/trunk/src/pypy/translator/genc.py	Thu Nov 18 16:20:43 2004
@@ -123,7 +123,9 @@
 
     def nameof_function(self, func):
         if self.translator.frozen:
-            assert func in self.translator.flowgraphs, func
+            if func not in self.translator.flowgraphs:
+                print "NOT GENERATING", func
+                return self.nameof(None)
         name = self.uniquename('gfunc_' + func.__name__)
         self.globaldecl.append('static PyObject* %s;' % name)
         self.initcode.append('INITCHK(%s = PyCFunction_New('
@@ -239,13 +241,16 @@
         tuple:  'PyTuple_Type',
         dict:   'PyDict_Type',
         str:    'PyString_Type',
+        float:  'PyFloat_Type',
+        type:   'PyType_Type',
+        complex:'PyComplex_Type',
         }
 
     def nameof_type(self, cls):
         if cls in self.typename_mapping:
             return '(PyObject*) &%s' % self.typename_mapping[cls]
-        assert hasattr(cls, '__weakref__'), (
-            "built-in class %r not found in typename_mapping" % (cls,))
+        assert cls.__module__ != '__builtin__', \
+            "built-in class %r not found in typename_mapping" % (cls,)
         return self.nameof_classobj(cls)
 
     def nameof_tuple(self, tup):



More information about the Pypy-commit mailing list