[pypy-svn] r13512 - pypy/dist/pypy/translator

pedronis at codespeak.net pedronis at codespeak.net
Fri Jun 17 03:29:15 CEST 2005


Author: pedronis
Date: Fri Jun 17 03:29:14 2005
New Revision: 13512

Modified:
   pypy/dist/pypy/translator/translator.py
Log:
disallow getflowgraph on everything but functions



Modified: pypy/dist/pypy/translator/translator.py
==============================================================================
--- pypy/dist/pypy/translator/translator.py	(original)
+++ pypy/dist/pypy/translator/translator.py	Fri Jun 17 03:29:14 2005
@@ -4,7 +4,7 @@
 translation-related code.  It can be used for interactive testing of the
 translator; see pypy/bin/translator.py.
 """
-import autopath, os, sys
+import autopath, os, sys, types
 
 from pypy.objspace.flow.model import *
 from pypy.translator.simplify import simplify_graph
@@ -51,6 +51,8 @@
     def getflowgraph(self, func=None, called_by=None, call_tag=None):
         """Get the flow graph for a function (default: the entry point)."""
         func = func or self.entrypoint
+        if not isinstance(func, types.FunctionType):
+            raise Exception, "getflowgraph() expects a function, got %s" % func
         try:
             graph = self.flowgraphs[func]
         except KeyError:



More information about the Pypy-commit mailing list