[pypy-svn] r7233 - in pypy/trunk/src/pypy: tool translator/tool/pygame

bob at codespeak.net bob at codespeak.net
Mon Nov 15 11:32:39 CET 2004


Author: bob
Date: Mon Nov 15 11:32:39 2004
New Revision: 7233

Added:
   pypy/trunk/src/pypy/tool/uid.py
Modified:
   pypy/trunk/src/pypy/translator/tool/pygame/flowviewer.py
Log:
add a uid function that guarantees to return an unsigned int id of an object
make the flowviewer use it


Added: pypy/trunk/src/pypy/tool/uid.py
==============================================================================
--- (empty file)
+++ pypy/trunk/src/pypy/tool/uid.py	Mon Nov 15 11:32:39 2004
@@ -0,0 +1,5 @@
+def uid(obj):
+    rval = id(obj)
+    if rval < 1:
+        rval += 1L << 32
+    return rval

Modified: pypy/trunk/src/pypy/translator/tool/pygame/flowviewer.py
==============================================================================
--- pypy/trunk/src/pypy/translator/tool/pygame/flowviewer.py	(original)
+++ pypy/trunk/src/pypy/translator/tool/pygame/flowviewer.py	Mon Nov 15 11:32:39 2004
@@ -4,6 +4,7 @@
 from pypy.translator.tool.make_dot import DotGen
 from pypy.interpreter.pycode import CO_VARARGS, CO_VARKEYWORDS
 from pypy.annotation import model, factory
+from pypy.tool.uid import uid
 
 
 class SingleGraphLayout(GraphLayout):
@@ -162,7 +163,7 @@
     try:
         return cache[obj]
     except KeyError:
-        result = '%s__0x%x' % (getattr(obj, '__name__', ''), id(obj))
+        result = '%s__0x%x' % (getattr(obj, '__name__', ''), uid(obj))
         cache[obj] = result
         return result
 



More information about the Pypy-commit mailing list