[pypy-svn] r57423 - pypy/branch/2.5-features/lib-python/modified-2.5.1
bgola at codespeak.net
bgola at codespeak.net
Mon Aug 18 15:25:19 CEST 2008
Author: bgola
Date: Mon Aug 18 15:25:17 2008
New Revision: 57423
Added:
pypy/branch/2.5-features/lib-python/modified-2.5.1/__future__.py
- copied, changed from r57197, pypy/branch/2.5-features/lib-python/2.5.1/__future__.py
pypy/branch/2.5-features/lib-python/modified-2.5.1/cmd.py
- copied, changed from r57197, pypy/branch/2.5-features/lib-python/2.5.1/cmd.py
pypy/branch/2.5-features/lib-python/modified-2.5.1/decimal.py
- copied, changed from r57197, pypy/branch/2.5-features/lib-python/2.5.1/decimal.py
pypy/branch/2.5-features/lib-python/modified-2.5.1/doctest.py
- copied, changed from r57197, pypy/branch/2.5-features/lib-python/2.5.1/doctest.py
pypy/branch/2.5-features/lib-python/modified-2.5.1/inspect.py
- copied, changed from r57197, pypy/branch/2.5-features/lib-python/2.5.1/inspect.py
pypy/branch/2.5-features/lib-python/modified-2.5.1/opcode.py
- copied, changed from r57197, pypy/branch/2.5-features/lib-python/2.5.1/opcode.py
pypy/branch/2.5-features/lib-python/modified-2.5.1/pickle.py
- copied, changed from r57197, pypy/branch/2.5-features/lib-python/2.5.1/pickle.py
pypy/branch/2.5-features/lib-python/modified-2.5.1/pickletools.py
- copied, changed from r57197, pypy/branch/2.5-features/lib-python/2.5.1/pickletools.py
pypy/branch/2.5-features/lib-python/modified-2.5.1/popen2.py
- copied, changed from r57197, pypy/branch/2.5-features/lib-python/2.5.1/popen2.py
pypy/branch/2.5-features/lib-python/modified-2.5.1/pprint.py
- copied, changed from r57197, pypy/branch/2.5-features/lib-python/2.5.1/pprint.py
pypy/branch/2.5-features/lib-python/modified-2.5.1/pydoc.py
- copied, changed from r57197, pypy/branch/2.5-features/lib-python/2.5.1/pydoc.py
pypy/branch/2.5-features/lib-python/modified-2.5.1/site.py
- copied, changed from r57197, pypy/branch/2.5-features/lib-python/2.5.1/site.py
pypy/branch/2.5-features/lib-python/modified-2.5.1/socket.py
- copied, changed from r57197, pypy/branch/2.5-features/lib-python/2.5.1/socket.py
pypy/branch/2.5-features/lib-python/modified-2.5.1/sre_compile.py
- copied, changed from r57197, pypy/branch/2.5-features/lib-python/2.5.1/sre_compile.py
pypy/branch/2.5-features/lib-python/modified-2.5.1/sre_constants.py
- copied, changed from r57197, pypy/branch/2.5-features/lib-python/2.5.1/sre_constants.py
pypy/branch/2.5-features/lib-python/modified-2.5.1/subprocess.py
- copied, changed from r57197, pypy/branch/2.5-features/lib-python/2.5.1/subprocess.py
pypy/branch/2.5-features/lib-python/modified-2.5.1/types.py
- copied, changed from r57197, pypy/branch/2.5-features/lib-python/2.5.1/types.py
pypy/branch/2.5-features/lib-python/modified-2.5.1/uu.py
- copied, changed from r57197, pypy/branch/2.5-features/lib-python/2.5.1/uu.py
pypy/branch/2.5-features/lib-python/modified-2.5.1/warnings.py
- copied, changed from r57197, pypy/branch/2.5-features/lib-python/2.5.1/warnings.py
Log:
svn cp 2.5.1/ modifiled/ and changes applied
Copied: pypy/branch/2.5-features/lib-python/modified-2.5.1/__future__.py (from r57197, pypy/branch/2.5-features/lib-python/2.5.1/__future__.py)
==============================================================================
--- pypy/branch/2.5-features/lib-python/2.5.1/__future__.py (original)
+++ pypy/branch/2.5-features/lib-python/modified-2.5.1/__future__.py Mon Aug 18 15:25:17 2008
@@ -64,7 +64,7 @@
CO_NESTED = 0x0010 # nested_scopes
CO_GENERATOR_ALLOWED = 0 # generators (obsolete, was 0x1000)
CO_FUTURE_DIVISION = 0x2000 # division
-CO_FUTURE_ABSOLUTE_IMPORT = 0x4000 # perform absolute imports by default
+CO_FUTURE_ABSIMPORT = 0x4000 # absolute_import
CO_FUTURE_WITH_STATEMENT = 0x8000 # with statement
class _Feature:
@@ -109,7 +109,7 @@
absolute_import = _Feature((2, 5, 0, "alpha", 1),
(2, 7, 0, "alpha", 0),
- CO_FUTURE_ABSOLUTE_IMPORT)
+ CO_FUTURE_ABSIMPORT)
with_statement = _Feature((2, 5, 0, "alpha", 1),
(2, 6, 0, "alpha", 0),
Copied: pypy/branch/2.5-features/lib-python/modified-2.5.1/cmd.py (from r57197, pypy/branch/2.5-features/lib-python/2.5.1/cmd.py)
==============================================================================
--- pypy/branch/2.5-features/lib-python/2.5.1/cmd.py (original)
+++ pypy/branch/2.5-features/lib-python/modified-2.5.1/cmd.py Mon Aug 18 15:25:17 2008
@@ -113,7 +113,7 @@
self.old_completer = readline.get_completer()
readline.set_completer(self.complete)
readline.parse_and_bind(self.completekey+": complete")
- except ImportError:
+ except (ImportError, AttributeError):
pass
try:
if intro is not None:
@@ -147,7 +147,7 @@
try:
import readline
readline.set_completer(self.old_completer)
- except ImportError:
+ except (ImportError, AttributeError):
pass
Copied: pypy/branch/2.5-features/lib-python/modified-2.5.1/decimal.py (from r57197, pypy/branch/2.5-features/lib-python/2.5.1/decimal.py)
==============================================================================
--- pypy/branch/2.5-features/lib-python/2.5.1/decimal.py (original)
+++ pypy/branch/2.5-features/lib-python/modified-2.5.1/decimal.py Mon Aug 18 15:25:17 2008
@@ -1939,6 +1939,7 @@
ans = self._check_nans(context=context)
if ans:
return ans
+ return self
if self._exp >= 0:
return self
if context is None:
Copied: pypy/branch/2.5-features/lib-python/modified-2.5.1/doctest.py (from r57197, pypy/branch/2.5-features/lib-python/2.5.1/doctest.py)
==============================================================================
--- pypy/branch/2.5-features/lib-python/2.5.1/doctest.py (original)
+++ pypy/branch/2.5-features/lib-python/modified-2.5.1/doctest.py Mon Aug 18 15:25:17 2008
@@ -839,12 +839,12 @@
return module.__dict__ is object.func_globals
elif inspect.isclass(object):
return module.__name__ == object.__module__
+ elif isinstance(object, property):
+ return True # [XX] no way not be sure.
elif inspect.getmodule(object) is not None:
return module is inspect.getmodule(object)
elif hasattr(object, '__module__'):
return module.__name__ == object.__module__
- elif isinstance(object, property):
- return True # [XX] no way not be sure.
else:
raise ValueError("object must be a class or function")
Copied: pypy/branch/2.5-features/lib-python/modified-2.5.1/inspect.py (from r57197, pypy/branch/2.5-features/lib-python/2.5.1/inspect.py)
==============================================================================
--- pypy/branch/2.5-features/lib-python/2.5.1/inspect.py (original)
+++ pypy/branch/2.5-features/lib-python/modified-2.5.1/inspect.py Mon Aug 18 15:25:17 2008
@@ -677,9 +677,15 @@
'varargs' and 'varkw' are the names of the * and ** arguments or None."""
if not iscode(co):
- raise TypeError('arg is not a code object')
+ if hasattr(len, 'func_code') and type(co) is type(len.func_code):
+ # PyPy extension: built-in function objects have a func_code too.
+ # There is no co_code on it, but co_argcount and co_varnames and
+ # co_flags are present.
+ pass
+ else:
+ raise TypeError('arg is not a code object')
- code = co.co_code
+ code = getattr(co, 'co_code', '')
nargs = co.co_argcount
names = co.co_varnames
args = list(names[:nargs])
@@ -739,7 +745,9 @@
if ismethod(func):
func = func.im_func
- if not isfunction(func):
+ if not (isfunction(func) or
+ isbuiltin(func) and hasattr(func, 'func_code')):
+ # PyPy extension: this works for built-in functions too
raise TypeError('arg is not a Python function')
args, varargs, varkw = getargs(func.func_code)
return args, varargs, varkw, func.func_defaults
Copied: pypy/branch/2.5-features/lib-python/modified-2.5.1/opcode.py (from r57197, pypy/branch/2.5-features/lib-python/2.5.1/opcode.py)
==============================================================================
--- pypy/branch/2.5-features/lib-python/2.5.1/opcode.py (original)
+++ pypy/branch/2.5-features/lib-python/modified-2.5.1/opcode.py Mon Aug 18 15:25:17 2008
@@ -182,4 +182,10 @@
def_op('EXTENDED_ARG', 143)
EXTENDED_ARG = 143
+# pypy modification, experimental bytecode
+def_op('CALL_LIKELY_BUILTIN', 144) # #args + (#kwargs << 8)
+def_op('LOOKUP_METHOD', 145) # Index in name list
+def_op('CALL_METHOD', 146) # #args not including 'self'
+
+
del def_op, name_op, jrel_op, jabs_op
Copied: pypy/branch/2.5-features/lib-python/modified-2.5.1/pickle.py (from r57197, pypy/branch/2.5-features/lib-python/2.5.1/pickle.py)
==============================================================================
--- pypy/branch/2.5-features/lib-python/2.5.1/pickle.py (original)
+++ pypy/branch/2.5-features/lib-python/modified-2.5.1/pickle.py Mon Aug 18 15:25:17 2008
@@ -32,7 +32,6 @@
import marshal
import sys
import struct
-import re
__all__ = ["PickleError", "PicklingError", "UnpicklingError", "Pickler",
"Unpickler", "dump", "dumps", "load", "loads"]
@@ -162,7 +161,7 @@
_tuplesize2code = [EMPTY_TUPLE, TUPLE1, TUPLE2, TUPLE3]
-__all__.extend([x for x in dir() if re.match("[A-Z][A-Z0-9_]+$",x)])
+__all__.extend([x for x in dir() if x[0].isalpha() and x == x.upper()])
del x
@@ -205,6 +204,31 @@
self.proto = int(protocol)
self.bin = protocol >= 1
self.fast = 0
+
+ def _pickle_moduledict(self, obj):
+ try:
+ modict = self.module_dict_ids
+ except AttributeError:
+ modict = {}
+ from sys import modules
+ for mod in modules.values():
+ if isinstance(mod, ModuleType):
+ try:
+ modict[id(mod.__dict__)] = mod
+ except KeyboardInterrupt:
+ raise
+ except: # obscure: the above can fail for
+ # arbitrary reasons, because of the py lib
+ pass
+ self.module_dict_ids = modict
+
+ thisid = id(obj)
+ try:
+ themodule = modict[thisid]
+ except KeyError:
+ return None
+ from __builtin__ import getattr
+ return getattr, (themodule, '__dict__')
def clear_memo(self):
"""Clears the pickler's "memo".
@@ -638,6 +662,12 @@
# else tmp is empty, and we're done
def save_dict(self, obj):
+ ## Stackless addition BEGIN
+ modict_saver = self._pickle_moduledict(obj)
+ if modict_saver is not None:
+ return self.save_reduce(*modict_saver)
+ ## Stackless addition END
+
write = self.write
if self.bin:
@@ -767,8 +797,30 @@
write(GLOBAL + module + '\n' + name + '\n')
self.memoize(obj)
+ def save_function(self, obj):
+ try:
+ return self.save_global(obj)
+ except PicklingError, e:
+ pass
+ # Check copy_reg.dispatch_table
+ reduce = dispatch_table.get(type(obj))
+ if reduce:
+ rv = reduce(obj)
+ else:
+ # Check for a __reduce_ex__ method, fall back to __reduce__
+ reduce = getattr(obj, "__reduce_ex__", None)
+ if reduce:
+ rv = reduce(self.proto)
+ else:
+ reduce = getattr(obj, "__reduce__", None)
+ if reduce:
+ rv = reduce()
+ else:
+ raise e
+ return self.save_reduce(obj=obj, *rv)
+
dispatch[ClassType] = save_global
- dispatch[FunctionType] = save_global
+ dispatch[FunctionType] = save_function
dispatch[BuiltinFunctionType] = save_global
dispatch[TypeType] = save_global
Copied: pypy/branch/2.5-features/lib-python/modified-2.5.1/pickletools.py (from r57197, pypy/branch/2.5-features/lib-python/2.5.1/pickletools.py)
==============================================================================
--- pypy/branch/2.5-features/lib-python/2.5.1/pickletools.py (original)
+++ pypy/branch/2.5-features/lib-python/modified-2.5.1/pickletools.py Mon Aug 18 15:25:17 2008
@@ -2058,11 +2058,10 @@
Exercise the INST/OBJ/BUILD family.
->>> import random
->>> dis(pickle.dumps(random.random, 0))
- 0: c GLOBAL 'random random'
- 15: p PUT 0
- 18: . STOP
+>>> dis(pickle.dumps(zip, 0))
+ 0: c GLOBAL '__builtin__ zip'
+ 17: p PUT 0
+ 20: . STOP
highest protocol among opcodes = 0
>>> from pickletools import _Example
Copied: pypy/branch/2.5-features/lib-python/modified-2.5.1/popen2.py (from r57197, pypy/branch/2.5-features/lib-python/2.5.1/popen2.py)
==============================================================================
--- pypy/branch/2.5-features/lib-python/2.5.1/popen2.py (original)
+++ pypy/branch/2.5-features/lib-python/modified-2.5.1/popen2.py Mon Aug 18 15:25:17 2008
@@ -50,14 +50,18 @@
c2pread, c2pwrite = os.pipe()
if capturestderr:
errout, errin = os.pipe()
- self.pid = os.fork()
- if self.pid == 0:
- # Child
- os.dup2(p2cread, 0)
- os.dup2(c2pwrite, 1)
- if capturestderr:
- os.dup2(errin, 2)
- self._run_child(cmd)
+ gc.disable_finalizers()
+ try:
+ self.pid = os.fork()
+ if self.pid == 0:
+ # Child
+ os.dup2(p2cread, 0)
+ os.dup2(c2pwrite, 1)
+ if capturestderr:
+ os.dup2(errin, 2)
+ self._run_child(cmd)
+ finally:
+ gc.enable_finalizers()
os.close(p2cread)
self.tochild = os.fdopen(p2cwrite, 'w', bufsize)
os.close(c2pwrite)
@@ -122,13 +126,17 @@
self.cmd = cmd
p2cread, p2cwrite = os.pipe()
c2pread, c2pwrite = os.pipe()
- self.pid = os.fork()
- if self.pid == 0:
- # Child
- os.dup2(p2cread, 0)
- os.dup2(c2pwrite, 1)
- os.dup2(c2pwrite, 2)
- self._run_child(cmd)
+ gc.disable_finalizers()
+ try:
+ self.pid = os.fork()
+ if self.pid == 0:
+ # Child
+ os.dup2(p2cread, 0)
+ os.dup2(c2pwrite, 1)
+ os.dup2(c2pwrite, 2)
+ self._run_child(cmd)
+ finally:
+ gc.enable_finalizers()
os.close(p2cread)
self.tochild = os.fdopen(p2cwrite, 'w', bufsize)
os.close(c2pwrite)
Copied: pypy/branch/2.5-features/lib-python/modified-2.5.1/pprint.py (from r57197, pypy/branch/2.5-features/lib-python/2.5.1/pprint.py)
==============================================================================
--- pypy/branch/2.5-features/lib-python/2.5.1/pprint.py (original)
+++ pypy/branch/2.5-features/lib-python/modified-2.5.1/pprint.py Mon Aug 18 15:25:17 2008
@@ -133,7 +133,7 @@
if sepLines:
r = getattr(typ, "__repr__", None)
- if issubclass(typ, dict) and r is dict.__repr__:
+ if issubclass(typ, dict) and r == dict.__repr__:
write('{')
if self._indent_per_level > 1:
write((self._indent_per_level - 1) * ' ')
@@ -160,8 +160,8 @@
write('}')
return
- if (issubclass(typ, list) and r is list.__repr__) or \
- (issubclass(typ, tuple) and r is tuple.__repr__):
+ if (issubclass(typ, list) and r == list.__repr__) or \
+ (issubclass(typ, tuple) and r == tuple.__repr__):
if issubclass(typ, list):
write('[')
endchar = ']'
@@ -231,7 +231,7 @@
return ("%s%s%s" % (closure, sio.getvalue(), closure)), True, False
r = getattr(typ, "__repr__", None)
- if issubclass(typ, dict) and r is dict.__repr__:
+ if issubclass(typ, dict) and r == dict.__repr__:
if not object:
return "{}", True, False
objid = _id(object)
@@ -256,8 +256,8 @@
del context[objid]
return "{%s}" % _commajoin(components), readable, recursive
- if (issubclass(typ, list) and r is list.__repr__) or \
- (issubclass(typ, tuple) and r is tuple.__repr__):
+ if (issubclass(typ, list) and r == list.__repr__) or \
+ (issubclass(typ, tuple) and r == tuple.__repr__):
if issubclass(typ, list):
if not object:
return "[]", True, False
Copied: pypy/branch/2.5-features/lib-python/modified-2.5.1/pydoc.py (from r57197, pypy/branch/2.5-features/lib-python/2.5.1/pydoc.py)
==============================================================================
--- pypy/branch/2.5-features/lib-python/2.5.1/pydoc.py (original)
+++ pypy/branch/2.5-features/lib-python/modified-2.5.1/pydoc.py Mon Aug 18 15:25:17 2008
@@ -874,7 +874,9 @@
reallink = realname
title = '<a name="%s"><strong>%s</strong></a> = %s' % (
anchor, name, reallink)
- if inspect.isfunction(object):
+ if inspect.isfunction(object) or (
+ inspect.isbuiltin(object) and hasattr(object, 'func_code')):
+ # PyPy extension: the code below works for built-in functions too
args, varargs, varkw, defaults = inspect.getargspec(object)
argspec = inspect.formatargspec(
args, varargs, varkw, defaults, formatvalue=self.formatvalue)
@@ -1240,7 +1242,9 @@
cl.__dict__[realname] is object):
skipdocs = 1
title = self.bold(name) + ' = ' + realname
- if inspect.isfunction(object):
+ if (inspect.isfunction(object) or
+ inspect.isbuiltin(object) and hasattr(object, 'func_code')):
+ # PyPy extension: the code below works for built-in functions too
args, varargs, varkw, defaults = inspect.getargspec(object)
argspec = inspect.formatargspec(
args, varargs, varkw, defaults, formatvalue=self.formatvalue)
Copied: pypy/branch/2.5-features/lib-python/modified-2.5.1/site.py (from r57197, pypy/branch/2.5-features/lib-python/2.5.1/site.py)
==============================================================================
--- pypy/branch/2.5-features/lib-python/2.5.1/site.py (original)
+++ pypy/branch/2.5-features/lib-python/modified-2.5.1/site.py Mon Aug 18 15:25:17 2008
@@ -73,7 +73,10 @@
if hasattr(m, '__loader__'):
continue # don't mess with a PEP 302-supplied __file__
try:
- m.__file__ = os.path.abspath(m.__file__)
+ prev = m.__file__
+ new = os.path.abspath(m.__file__)
+ if prev != new:
+ m.__file__ = new
except AttributeError:
continue
@@ -314,22 +317,32 @@
if key == 'q':
break
+##def setcopyright():
+## """Set 'copyright' and 'credits' in __builtin__"""
+## __builtin__.copyright = _Printer("copyright", sys.copyright)
+## if sys.platform[:4] == 'java':
+## __builtin__.credits = _Printer(
+## "credits",
+## "Jython is maintained by the Jython developers (www.jython.org).")
+## else:
+## __builtin__.credits = _Printer("credits", """\
+## Thanks to CWI, CNRI, BeOpen.com, Zope Corporation and a cast of thousands
+## for supporting Python development. See www.python.org for more information.""")
+## here = os.path.dirname(os.__file__)
+## __builtin__.license = _Printer(
+## "license", "See http://www.python.org/%.3s/license.html" % sys.version,
+## ["LICENSE.txt", "LICENSE"],
+## [os.path.join(here, os.pardir), here, os.curdir])
+
def setcopyright():
- """Set 'copyright' and 'credits' in __builtin__"""
- __builtin__.copyright = _Printer("copyright", sys.copyright)
- if sys.platform[:4] == 'java':
- __builtin__.credits = _Printer(
- "credits",
- "Jython is maintained by the Jython developers (www.jython.org).")
- else:
- __builtin__.credits = _Printer("credits", """\
- Thanks to CWI, CNRI, BeOpen.com, Zope Corporation and a cast of thousands
- for supporting Python development. See www.python.org for more information.""")
- here = os.path.dirname(os.__file__)
+ # XXX this is the PyPy-specific version. Should be unified with the above.
+ __builtin__.credits = _Printer(
+ "credits",
+ "PyPy is maintained by the PyPy developers: http://codespeak.net/pypy")
__builtin__.license = _Printer(
- "license", "See http://www.python.org/%.3s/license.html" % sys.version,
- ["LICENSE.txt", "LICENSE"],
- [os.path.join(here, os.pardir), here, os.curdir])
+ "license",
+ "See http://codespeak.net/svn/pypy/dist/LICENSE")
+
class _Helper(object):
@@ -355,7 +368,7 @@
if sys.platform == 'win32':
import locale, codecs
enc = locale.getdefaultlocale()[1]
- if enc.startswith('cp'): # "cp***" ?
+ if enc is not None and enc.startswith('cp'): # "cp***" ?
try:
codecs.lookup(enc)
except LookupError:
Copied: pypy/branch/2.5-features/lib-python/modified-2.5.1/socket.py (from r57197, pypy/branch/2.5-features/lib-python/2.5.1/socket.py)
==============================================================================
--- pypy/branch/2.5-features/lib-python/2.5.1/socket.py (original)
+++ pypy/branch/2.5-features/lib-python/modified-2.5.1/socket.py Mon Aug 18 15:25:17 2008
@@ -139,6 +139,10 @@
__slots__ = []
def _dummy(*args):
raise error(EBADF, 'Bad file descriptor')
+ def _drop(self):
+ pass
+ def _reuse(self):
+ pass
# All _delegate_methods must also be initialized here.
send = recv = recv_into = sendto = recvfrom = recvfrom_into = _dummy
__getattr__ = _dummy
@@ -156,7 +160,14 @@
for method in _delegate_methods:
setattr(self, method, getattr(_sock, method))
+ def __del__(self):
+ self.close()
+
+
+
+
def close(self):
+ self._sock._drop()
self._sock = _closedsocket()
dummy = self._sock._dummy
for method in _delegate_methods:
@@ -172,6 +183,7 @@
"""dup() -> socket object
Return a new socket object connected to the same system resource."""
+ self._sock._reuse()
return _socketobject(_sock=self._sock)
def makefile(self, mode='r', bufsize=-1):
@@ -179,6 +191,7 @@
Return a regular file object corresponding to the socket. The mode
and bufsize arguments are as for the built-in open() function."""
+ self._sock._reuse()
return _fileobject(self._sock, mode, bufsize)
family = property(lambda self: self._sock.family, doc="the socket family")
@@ -227,13 +240,14 @@
closed = property(_getclosed, doc="True if the file is closed")
def close(self):
- try:
- if self._sock:
+ if self._sock:
+ try:
self.flush()
- finally:
- if self._close:
- self._sock.close()
- self._sock = None
+ finally:
+ if self._sock:
+ s = self._sock
+ self._sock = None
+ s._drop()
def __del__(self):
try:
Copied: pypy/branch/2.5-features/lib-python/modified-2.5.1/sre_compile.py (from r57197, pypy/branch/2.5-features/lib-python/2.5.1/sre_compile.py)
==============================================================================
--- pypy/branch/2.5-features/lib-python/2.5.1/sre_compile.py (original)
+++ pypy/branch/2.5-features/lib-python/modified-2.5.1/sre_compile.py Mon Aug 18 15:25:17 2008
@@ -14,7 +14,8 @@
from sre_constants import *
-assert _sre.MAGIC == MAGIC, "SRE module mismatch"
+# XXX see PyPy hack in sre_constants to support both the 2.3 and 2.4 _sre.c implementation.
+#assert _sre.MAGIC == MAGIC, "SRE module mismatch"
if _sre.CODESIZE == 2:
MAXCODE = 65535
Copied: pypy/branch/2.5-features/lib-python/modified-2.5.1/sre_constants.py (from r57197, pypy/branch/2.5-features/lib-python/2.5.1/sre_constants.py)
==============================================================================
--- pypy/branch/2.5-features/lib-python/2.5.1/sre_constants.py (original)
+++ pypy/branch/2.5-features/lib-python/modified-2.5.1/sre_constants.py Mon Aug 18 15:25:17 2008
@@ -127,6 +127,13 @@
]
+# PyPy hack to make the sre_*.py files from 2.4.1 work on the _sre
+# engine of 2.3.
+import _sre
+if _sre.MAGIC < 20031017:
+ OPCODES.remove(GROUPREF_EXISTS)
+del _sre
+
ATCODES = [
AT_BEGINNING, AT_BEGINNING_LINE, AT_BEGINNING_STRING, AT_BOUNDARY,
AT_NON_BOUNDARY, AT_END, AT_END_LINE, AT_END_STRING,
Copied: pypy/branch/2.5-features/lib-python/modified-2.5.1/subprocess.py (from r57197, pypy/branch/2.5-features/lib-python/2.5.1/subprocess.py)
==============================================================================
--- pypy/branch/2.5-features/lib-python/2.5.1/subprocess.py (original)
+++ pypy/branch/2.5-features/lib-python/modified-2.5.1/subprocess.py Mon Aug 18 15:25:17 2008
@@ -1002,7 +1002,14 @@
errpipe_read, errpipe_write = os.pipe()
self._set_cloexec_flag(errpipe_write)
- self.pid = os.fork()
+ in_child = False
+ gc.disable_finalizers()
+ try:
+ self.pid = os.fork()
+ in_child = (self.pid == 0)
+ finally:
+ if not in_child:
+ gc.enable_finalizers()
self._child_created = True
if self.pid == 0:
# Child
Copied: pypy/branch/2.5-features/lib-python/modified-2.5.1/types.py (from r57197, pypy/branch/2.5-features/lib-python/2.5.1/types.py)
==============================================================================
--- pypy/branch/2.5-features/lib-python/2.5.1/types.py (original)
+++ pypy/branch/2.5-features/lib-python/modified-2.5.1/types.py Mon Aug 18 15:25:17 2008
@@ -54,10 +54,10 @@
class _C:
def _m(self): pass
-ClassType = type(_C)
+ClassType = _classobj # PyPy-specific, from __builtin__
UnboundMethodType = type(_C._m) # Same as MethodType
_x = _C()
-InstanceType = type(_x)
+InstanceType = _instance # PyPy-specific, from __builtin__
MethodType = type(_x._m)
BuiltinFunctionType = type(len)
Copied: pypy/branch/2.5-features/lib-python/modified-2.5.1/uu.py (from r57197, pypy/branch/2.5-features/lib-python/2.5.1/uu.py)
==============================================================================
--- pypy/branch/2.5-features/lib-python/2.5.1/uu.py (original)
+++ pypy/branch/2.5-features/lib-python/modified-2.5.1/uu.py Mon Aug 18 15:25:17 2008
@@ -120,7 +120,7 @@
elif isinstance(out_file, basestring):
fp = open(out_file, 'wb')
try:
- os.path.chmod(out_file, mode)
+ os.chmod(out_file, mode)
except AttributeError:
pass
out_file = fp
Copied: pypy/branch/2.5-features/lib-python/modified-2.5.1/warnings.py (from r57197, pypy/branch/2.5-features/lib-python/2.5.1/warnings.py)
==============================================================================
--- pypy/branch/2.5-features/lib-python/2.5.1/warnings.py (original)
+++ pypy/branch/2.5-features/lib-python/modified-2.5.1/warnings.py Mon Aug 18 15:25:17 2008
@@ -151,8 +151,8 @@
assert action in ("error", "ignore", "always", "default", "module",
"once"), "invalid action: %r" % (action,)
assert isinstance(message, basestring), "message must be a string"
- assert isinstance(category, (type, types.ClassType)), \
- "category must be a class"
+# assert isinstance(category, (type, types.ClassType)), \
+# "category must be a class"
assert issubclass(category, Warning), "category must be a Warning subclass"
assert isinstance(module, basestring), "module must be a string"
assert isinstance(lineno, int) and lineno >= 0, \
More information about the Pypy-commit
mailing list