[pypy-svn] r5355 - in pypy/trunk/src: goal pypy/module pypy/objspace/flow
arigo at codespeak.net
arigo at codespeak.net
Sat Jun 26 20:34:26 CEST 2004
Author: arigo
Date: Sat Jun 26 20:34:25 2004
New Revision: 5355
Modified:
pypy/trunk/src/goal/autopath.py
pypy/trunk/src/pypy/module/__builtin__module.py
pypy/trunk/src/pypy/objspace/flow/objspace.py
Log:
Some Python 2.2 compatibility. We still have some test failures and even a
segfault with a Pyrex-compiled module -- but it only shows up in non-debug
builds of Python <= 2.2.2 ! Not sure I want to investigate more.
Modified: pypy/trunk/src/goal/autopath.py
==============================================================================
--- pypy/trunk/src/goal/autopath.py (original)
+++ pypy/trunk/src/goal/autopath.py Sat Jun 26 20:34:25 2004
@@ -1,3 +1,2 @@
import sys, os
-sys.path.insert(0, os.path.join(os.path.dirname(__file__), os.pardir))
-
+sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
Modified: pypy/trunk/src/pypy/module/__builtin__module.py
==============================================================================
--- pypy/trunk/src/pypy/module/__builtin__module.py (original)
+++ pypy/trunk/src/pypy/module/__builtin__module.py Sat Jun 26 20:34:25 2004
@@ -560,7 +560,10 @@
r[s] = value
return r
- dict.fromkeys = classmethod(_fromkeys)
+ try:
+ dict.fromkeys = classmethod(_fromkeys)
+ except TypeError:
+ pass # Python2.2 with trivial object space
del _fromkeys
Modified: pypy/trunk/src/pypy/objspace/flow/objspace.py
==============================================================================
--- pypy/trunk/src/pypy/objspace/flow/objspace.py (original)
+++ pypy/trunk/src/pypy/objspace/flow/objspace.py Sat Jun 26 20:34:25 2004
@@ -192,12 +192,14 @@
def extract_cell_content(c):
"""Get the value contained in a CPython 'cell', as read through
the func_closure of a function object."""
- import new
- def hackout():
- return hackout # this access becomes a cell reference
- # now change the cell to become 'c'
- hackout = new.function(hackout.func_code, {}, '', None, (c,))
- return hackout()
+ # yuk! this is all I could come up with that works in Python 2.2 too
+ class X(object):
+ def __eq__(self, other):
+ self.other = other
+ x = X()
+ x_cell, = (lambda: x).func_closure
+ x_cell == c
+ return x.other
def make_op(name, symbol, arity, specialnames):
if hasattr(FlowObjSpace, name):
More information about the Pypy-commit
mailing list