[IronPython] patch to enable codeop.py on fepy
Anthony Baxter
anthonybaxter at gmail.com
Sat Dec 9 06:48:06 CET 2006
The following patch makes codeop.py (and therefore stuff that depends
on it, such as code.py) work on IronPython. I needed this for the talk
I did on Thursday, where I had an interactive interpreter example
built on a rough port of Bruce (http://bruce.python-hosting.com)
outputting to SDL. It would be nice if the builtin compile() supported
this flag - I assume there's some support for it, since the
interactive interpreter does the right thing with it. This patch makes
codeop.py "work", but it does cause a slight change in behaviour,
damn.
--- /usr/lib/python2.4/codeop.py 2006-10-12 07:51:03.000000000 +1000
+++ codeop.py 2006-12-09 16:30:41.000000000 +1100
@@ -135,7 +135,7 @@
statement, it "remembers" and compiles all subsequent program texts
with the statement in force."""
def __init__(self):
- self.flags = PyCF_DONT_IMPLY_DEDENT
+ self.flags = 0
def __call__(self, source, filename, symbol):
codeob = compile(source, filename, symbol, self.flags, 1)
The docs for compile() don't actually mention this flag - I've logged
an SF bugreport about that.
And yes, I plan to clean up and release the Bruce on
IronPython+sdldotnet code. Not today, though - still recovering from
the conference. :-)
More information about the Ironpython-users
mailing list