[pypy-svn] r24154 - in pypy/dist/pypy: rpython/ootypesystem rpython/ootypesystem/test rpython/test translator/squeak

nik at codespeak.net nik at codespeak.net
Thu Mar 9 10:47:59 CET 2006


Author: nik
Date: Thu Mar  9 10:47:57 2006
New Revision: 24154

Modified:
   pypy/dist/pypy/rpython/ootypesystem/ootype.py
   pypy/dist/pypy/rpython/ootypesystem/test/test_oopbc.py
   pypy/dist/pypy/rpython/test/test_rpbc.py
   pypy/dist/pypy/translator/squeak/gensqueak.py
Log:
remove Instance._package, leave handling of package in class name completely
to backend. fix some tests that relied on previous behaviour.
add a comment about possible nameclashes that can't be avoided with the
current state of ootypesystem.


Modified: pypy/dist/pypy/rpython/ootypesystem/ootype.py
==============================================================================
--- pypy/dist/pypy/rpython/ootypesystem/ootype.py	(original)
+++ pypy/dist/pypy/rpython/ootypesystem/ootype.py	Thu Mar  9 10:47:57 2006
@@ -24,9 +24,7 @@
     """this is the type of user-defined objects"""
     def __init__(self, name, superclass, fields={}, methods={},
             _is_root=False):
-        package_parts = name.split(".")
-        self._name = package_parts[-1]
-        self._package = ".".join(package_parts[:-1])
+        self._name = name
 
         if _is_root:
             self._superclass = None

Modified: pypy/dist/pypy/rpython/ootypesystem/test/test_oopbc.py
==============================================================================
--- pypy/dist/pypy/rpython/ootypesystem/test/test_oopbc.py	(original)
+++ pypy/dist/pypy/rpython/ootypesystem/test/test_oopbc.py	Thu Mar  9 10:47:57 2006
@@ -28,9 +28,9 @@
             cls = A
         return cls()
     res = interpret(f, [0], type_system='ootype')
-    assert ootype.typeOf(res)._name == 'A'
+    assert ootype.typeOf(res)._name.split(".")[-1] == 'A'
     res = interpret(f, [1], type_system='ootype')
-    assert ootype.typeOf(res)._name == 'B'
+    assert ootype.typeOf(res)._name.split(".")[-1] == 'B'
 
 def test_call_classes_init():
     class A: 

Modified: pypy/dist/pypy/rpython/test/test_rpbc.py
==============================================================================
--- pypy/dist/pypy/rpython/test/test_rpbc.py	(original)
+++ pypy/dist/pypy/rpython/test/test_rpbc.py	Thu Mar  9 10:47:57 2006
@@ -1386,7 +1386,7 @@
     ts = "ootype"
 
     def class_name(self, value):
-        return typeOf(value)._name 
+        return typeOf(value)._name.split(".")[-1] 
 
     def read_attr(self, value, attr):
         return getattr(value, "o" + attr)

Modified: pypy/dist/pypy/translator/squeak/gensqueak.py
==============================================================================
--- pypy/dist/pypy/translator/squeak/gensqueak.py	(original)
+++ pypy/dist/pypy/translator/squeak/gensqueak.py	Thu Mar  9 10:47:57 2006
@@ -232,9 +232,11 @@
         # classes like Root with classes defined in __main__, but
         # in practice it should never happen because __main__ will
         # never contain user classes.
-        class_name = INSTANCE._name
-        if INSTANCE._package:
-            class_name = "%s.%s" % (INSTANCE._package, class_name)
+        # XXX It's impossible with the current ootypesystem to
+        # distinguish two equally named classes in the same
+        # package. For now, just hope that this never actually
+        # occurs within PyPy.
+        class_name = INSTANCE._name 
         class_name = class_name[0].upper() + class_name[1:]
         squeak_class_name = self.unique_name(class_name)
         return "Py%s" % squeak_class_name



More information about the Pypy-commit mailing list