[pypy-svn] r45577 - in pypy/dist/pypy/objspace/flow: . test
fijal at codespeak.net
fijal at codespeak.net
Thu Aug 9 20:49:16 CEST 2007
Author: fijal
Date: Thu Aug 9 20:49:15 2007
New Revision: 45577
Modified:
pypy/dist/pypy/objspace/flow/objspace.py
pypy/dist/pypy/objspace/flow/test/test_objspace.py
Log:
Explode when encountering generators (heh, I'm curious whether I did
the right thing)
Modified: pypy/dist/pypy/objspace/flow/objspace.py
==============================================================================
--- pypy/dist/pypy/objspace/flow/objspace.py (original)
+++ pypy/dist/pypy/objspace/flow/objspace.py Thu Aug 9 20:49:15 2007
@@ -237,6 +237,9 @@
if func.func_doc and func.func_doc.lstrip().startswith('NOT_RPYTHON'):
raise Exception, "%r is tagged as NOT_RPYTHON" % (func,)
code = func.func_code
+ if code.co_flags & 32:
+ # generator
+ raise TypeError("%r is a generator" % (func,))
code = PyCode._from_code(self, code)
if func.func_closure is None:
closure = None
Modified: pypy/dist/pypy/objspace/flow/test/test_objspace.py
==============================================================================
--- pypy/dist/pypy/objspace/flow/test/test_objspace.py (original)
+++ pypy/dist/pypy/objspace/flow/test/test_objspace.py Thu Aug 9 20:49:15 2007
@@ -825,6 +825,11 @@
assert all_ops['simple_call'] == 2
assert all_ops['getattr'] == 1
+ def test_generator(self):
+ def f():
+ yield 3
+
+ py.test.raises(TypeError, "self.codetest(f)")
class TestFlowObjSpaceDelay(Base):
def setup_class(cls):
More information about the pypy-svn
mailing list