[pypy-svn] commit/pypy: 3 new changesets
Bitbucket
commits-noreply at bitbucket.org
Fri Dec 17 15:11:07 CET 2010
3 new changesets in pypy:
http://bitbucket.org/pypy/pypy/changeset/c066a0b0727e/
changeset: r40077:c066a0b0727e
branch: fast-forward
user: amauryfa
date: 2010-12-15 13:21:38
summary: remove a DONE item
affected #: 1 file (107 bytes)
--- a/pypy/module/cpyext/TODO Wed Dec 15 00:56:54 2010 +0100
+++ b/pypy/module/cpyext/TODO Wed Dec 15 13:21:38 2010 +0100
@@ -24,6 +24,3 @@
- sort out pypy's buffer protocol. PyPy's buffer right now don't support
raw memory (except array which supports it in a hackish way), which
should be fixed in order to make it nicely work with cpyext.
-
- - Fix Makefile generation on Windows when --shared is used (mandatory when
- cpyext is used with -Ojit)
http://bitbucket.org/pypy/pypy/changeset/20722e71d732/
changeset: r40078:20722e71d732
branch: fast-forward
user: amauryfa
date: 2010-12-17 15:08:34
summary: merge heads
affected #: 0 files (0 bytes)
http://bitbucket.org/pypy/pypy/changeset/01a874cc154a/
changeset: r40079:01a874cc154a
branch: fast-forward
user: amauryfa
date: 2010-12-17 15:10:02
summary: hg merge default
affected #: 12 files (3.9 KB)
--- a/lib_pypy/_ctypes/dll.py Fri Dec 17 15:08:34 2010 +0100
+++ b/lib_pypy/_ctypes/dll.py Fri Dec 17 15:10:02 2010 +0100
@@ -3,5 +3,6 @@
def dlopen(name, mode):
# XXX mode is ignored
if name is None:
- return None # XXX this should return *all* loaded libs, dlopen(NULL)
+ # XXX this should return *all* loaded libs, dlopen(NULL).
+ raise NotImplementedError("dlopen(None)")
return _rawffi.CDLL(name)
--- a/py/_path/local.py Fri Dec 17 15:08:34 2010 +0100
+++ b/py/_path/local.py Fri Dec 17 15:10:02 2010 +0100
@@ -589,7 +589,7 @@
else:
paths = [re.sub('%SystemRoot%', systemroot, path)
for path in paths]
- tryadd = '', '.exe', '.com', '.bat' # XXX add more?
+ tryadd = '', '.exe', '.com', '.bat', '.cmd' # XXX add more?
else:
paths = py.std.os.environ['PATH'].split(':')
tryadd = ('',)
--- a/pypy/config/pypyoption.py Fri Dec 17 15:08:34 2010 +0100
+++ b/pypy/config/pypyoption.py Fri Dec 17 15:10:02 2010 +0100
@@ -303,7 +303,7 @@
default=False),
BoolOption("newshortcut",
"cache and shortcut calling __new__ from builtin types",
- default=False),
+ default=False),
BoolOption("logspaceoptypes",
"a instrumentation option: before exit, print the types seen by "
@@ -312,8 +312,9 @@
ChoiceOption("multimethods", "the multimethod implementation to use",
["doubledispatch", "mrd"],
default="mrd"),
- BoolOption("immutable_builtintypes",
- "Forbid the changing of builtin types", default=True),
+ BoolOption("mutable_builtintypes",
+ "Allow the changing of builtin types", default=False,
+ requires=[("objspace.std.builtinshortcut", True)]),
]),
])
--- a/pypy/doc/config/objspace.std.immutable_builtintypes.txt Fri Dec 17 15:08:34 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-Disallow modification of builtin types. Enabled by default.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pypy/doc/config/objspace.std.mutable_builtintypes.txt Fri Dec 17 15:10:02 2010 +0100
@@ -0,0 +1,1 @@
+Allow modification of builtin types. Disabled by default.
--- a/pypy/doc/cpython_differences.txt Fri Dec 17 15:08:34 2010 +0100
+++ b/pypy/doc/cpython_differences.txt Fri Dec 17 15:10:02 2010 +0100
@@ -204,4 +204,16 @@
lets the exception propagate instead.
+Miscellaneous
+-------------
+
+* ``sys.setrecursionlimit()`` is ignored (and not needed) on
+ PyPy. On CPython it would set the maximum number of nested
+ calls that can occur before a RuntimeError is raised; on PyPy
+ overflowing the stack also causes RuntimeErrors, but the limit
+ is checked at a lower level. (The limit is currenty hard-coded
+ at 768 KB, corresponding to roughly 1480 Python calls on
+ Linux.)
+
+
.. include:: _ref.txt
--- a/pypy/module/cpyext/conftest.py Fri Dec 17 15:08:34 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,16 +0,0 @@
-import py
-from pypy.conftest import option, gettestobjspace
-
-def pytest_ignore_collect(path, config):
- if config.option.runappdirect:
- return True # "cannot be run by py.test -A"
- # ensure additional functions are registered
- import pypy.module.cpyext.test.test_cpyext
- return False
-
-def pytest_funcarg__space(request):
- return gettestobjspace(usemodules=['cpyext', 'thread', '_rawffi'])
-
-def pytest_funcarg__api(request):
- return request.cls.api
-
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pypy/module/cpyext/test/conftest.py Fri Dec 17 15:10:02 2010 +0100
@@ -0,0 +1,16 @@
+import py
+from pypy.conftest import option, gettestobjspace
+
+def pytest_ignore_collect(path, config):
+ if config.option.runappdirect:
+ return True # "cannot be run by py.test -A"
+ # ensure additional functions are registered
+ import pypy.module.cpyext.test.test_cpyext
+ return False
+
+def pytest_funcarg__space(request):
+ return gettestobjspace(usemodules=['cpyext', 'thread', '_rawffi'])
+
+def pytest_funcarg__api(request):
+ return request.cls.api
+
--- a/pypy/module/posix/app_posix.py Fri Dec 17 15:08:34 2010 +0100
+++ b/pypy/module/posix/app_posix.py Fri Dec 17 15:10:02 2010 +0100
@@ -109,7 +109,7 @@
def close(self):
import os
- file.close(self)
+ super(popenfile, self).close()
pid = self._childpid
if pid is not None:
self._childpid = None
--- a/pypy/module/posix/test/test_posix_libfile.py Fri Dec 17 15:08:34 2010 +0100
+++ b/pypy/module/posix/test/test_posix_libfile.py Fri Dec 17 15:10:02 2010 +0100
@@ -50,3 +50,18 @@
f.close() # should wait here
end_time = time.time()
assert end_time - start_time >= 1.9
+
+ def test_popen_and_rebind_file_in___builtin__(self):
+ import sys
+ if sys.platform.startswith('win'):
+ skip("unix specific")
+ #
+ import __builtin__
+ posix = self.posix
+ orig_file = file
+ try:
+ f = posix.popen('true')
+ __builtin__.file = lambda x : explode
+ f.close()
+ finally:
+ __builtin__.file = orig_file
--- a/pypy/module/sys/vm.py Fri Dec 17 15:08:34 2010 +0100
+++ b/pypy/module/sys/vm.py Fri Dec 17 15:10:02 2010 +0100
@@ -43,19 +43,24 @@
return space.wrap(f)
def setrecursionlimit(space, w_new_limit):
- """DEPRECATED on PyPy. Will issue warning and not work
- """
+ """setrecursionlimit() is ignored (and not needed) on PyPy.
+
+On CPython it would set the maximum number of nested calls that can
+occur before a RuntimeError is raised. On PyPy overflowing the stack
+also causes RuntimeErrors, but the limit is checked at a lower level.
+(The limit is currenty hard-coded at 768 KB, corresponding to roughly
+1480 Python calls on Linux.)"""
new_limit = space.int_w(w_new_limit)
if new_limit <= 0:
raise OperationError(space.w_ValueError,
space.wrap("recursion limit must be positive"))
- # global recursion_limit
- # we need to do it without writing globals.
- space.warn('setrecursionlimit() is ignored (and not needed) on PyPy', space.w_DeprecationWarning)
+ # for now, don't rewrite a warning but silently ignore the
+ # recursion limit.
+ #space.warn('setrecursionlimit() is ignored (and not needed) on PyPy', space.w_RuntimeWarning)
space.sys.recursionlimit = new_limit
def getrecursionlimit(space):
- """DEPRECATED on PyPy. Will issue warning and not work
+ """Return the last value set by setrecursionlimit().
"""
return space.wrap(space.sys.recursionlimit)
--- a/pypy/objspace/std/dictmultiobject.py Fri Dec 17 15:08:34 2010 +0100
+++ b/pypy/objspace/std/dictmultiobject.py Fri Dec 17 15:10:02 2010 +0100
@@ -819,42 +819,6 @@
space.wrap("popitem(): dictionary is empty"))
return space.newtuple([w_key, w_value])
-app = gateway.applevel('''
- def dictrepr(currently_in_repr, d):
- # Now we only handle one implementation of dicts, this one.
- # The fix is to move this to dicttype.py, and do a
- # multimethod lookup mapping str to StdObjSpace.str
- # This cannot happen until multimethods are fixed. See dicttype.py
- dict_id = id(d)
- if dict_id in currently_in_repr:
- return '{...}'
- currently_in_repr[dict_id] = 1
- try:
- items = []
- # XXX for now, we cannot use iteritems() at app-level because
- # we want a reasonable result instead of a RuntimeError
- # even if the dict is mutated by the repr() in the loop.
- for k, v in dict.items(d):
- items.append(repr(k) + ": " + repr(v))
- return "{" + ', '.join(items) + "}"
- finally:
- try:
- del currently_in_repr[dict_id]
- except:
- pass
-''', filename=__file__)
-
-dictrepr = app.interphook("dictrepr")
-
-def repr__DictMulti(space, w_dict):
- if w_dict.length() == 0:
- return space.wrap('{}')
- ec = space.getexecutioncontext()
- w_currently_in_repr = ec._py_repr
- if w_currently_in_repr is None:
- w_currently_in_repr = ec._py_repr = space.newdict()
- return dictrepr(space, w_currently_in_repr, w_dict)
-
# ____________________________________________________________
# Iteration
--- a/pypy/objspace/std/dicttype.py Fri Dec 17 15:08:34 2010 +0100
+++ b/pypy/objspace/std/dicttype.py Fri Dec 17 15:10:02 2010 +0100
@@ -1,183 +1,214 @@
-from pypy.interpreter.baseobjspace import ObjSpace, W_Root
-from pypy.interpreter.error import OperationError
-from pypy.interpreter.mixedmodule import MixedModule
-from pypy.interpreter import gateway
-from pypy.objspace.std.stdtypedef import StdTypeDef, SMM
-from pypy.objspace.std.register_all import register_all
-
-dict_copy = SMM('copy', 1,
- doc='D.copy() -> a shallow copy of D')
-dict_items = SMM('items', 1,
- doc="D.items() -> list of D's (key, value) pairs, as"
- ' 2-tuples')
-dict_keys = SMM('keys', 1,
- doc="D.keys() -> list of D's keys")
-dict_values = SMM('values', 1,
- doc="D.values() -> list of D's values")
-dict_has_key = SMM('has_key', 2,
- doc='D.has_key(k) -> True if D has a key k, else False')
-dict_clear = SMM('clear', 1,
- doc='D.clear() -> None. Remove all items from D.')
-dict_get = SMM('get', 3, defaults=(None,),
- doc='D.get(k[,d]) -> D[k] if k in D, else d. d defaults'
- ' to None.')
-dict_pop = SMM('pop', 2, w_varargs=True,
- doc='D.pop(k[,d]) -> v, remove specified key and return'
- ' the corresponding value\nIf key is not found, d is'
- ' returned if given, otherwise KeyError is raised')
-dict_popitem = SMM('popitem', 1,
- doc='D.popitem() -> (k, v), remove and return some (key,'
- ' value) pair as a\n2-tuple; but raise KeyError if D'
- ' is empty')
-dict_setdefault = SMM('setdefault', 3, defaults=(None,),
- doc='D.setdefault(k[,d]) -> D.get(k,d), also set D[k]=d'
- ' if k not in D')
-dict_update = SMM('update', 1, general__args__=True,
- doc='D.update(E, **F) -> None. Update D from E and F:'
- ' for k in E: D[k] = E[k]\n(if E has keys else: for'
- ' (k, v) in E: D[k] = v) then: for k in F: D[k] ='
- ' F[k]')
-dict_iteritems = SMM('iteritems', 1,
- doc='D.iteritems() -> an iterator over the (key, value)'
- ' items of D')
-dict_iterkeys = SMM('iterkeys', 1,
- doc='D.iterkeys() -> an iterator over the keys of D')
-dict_itervalues = SMM('itervalues', 1,
- doc='D.itervalues() -> an iterator over the values of D')
-dict_viewkeys = SMM('viewkeys', 1,
- doc="D.viewkeys() -> a set-like object providing a view on D's keys")
-dict_viewitems = SMM('viewitems', 1,
- doc="D.viewitems() -> a set-like object providing a view on D's items")
-dict_viewvalues = SMM('viewvalues', 1,
- doc="D.viewvalues() -> an object providing a view on D's values")
-dict_reversed = SMM('__reversed__', 1)
-
-def dict_reversed__ANY(space, w_dict):
- raise OperationError(space.w_TypeError, space.wrap('argument to reversed() must be a sequence'))
-
-#dict_fromkeys = MultiMethod('fromkeys', 2, varargs=True)
-# This can return when multimethods have been fixed
-#dict_str = StdObjSpace.str
-
-register_all(vars(), globals())
-
- at gateway.unwrap_spec(ObjSpace, W_Root, W_Root, W_Root)
-def descr_fromkeys(space, w_type, w_keys, w_fill=None):
- from pypy.objspace.std.dictmultiobject import W_DictMultiObject
- if w_fill is None:
- w_fill = space.w_None
- if w_type is space.w_dict:
- w_dict = W_DictMultiObject.allocate_and_init_instance(space, w_type)
- for w_key in space.listview(w_keys):
- w_dict.setitem(w_key, w_fill)
- else:
- w_dict = space.call_function(w_type)
- for w_key in space.listview(w_keys):
- space.setitem(w_dict, w_key, w_fill)
- return w_dict
-
-
-# ____________________________________________________________
-
-def descr__new__(space, w_dicttype, __args__):
- from pypy.objspace.std.dictmultiobject import W_DictMultiObject
- w_obj = W_DictMultiObject.allocate_and_init_instance(space, w_dicttype)
- return w_obj
-
-# ____________________________________________________________
-
-dict_typedef = StdTypeDef("dict",
- __doc__ = '''dict() -> new empty dictionary.
-dict(mapping) -> new dictionary initialized from a mapping object\'s
- (key, value) pairs.
-dict(seq) -> new dictionary initialized as if via:
- d = {}
- for k, v in seq:
- d[k] = v
-dict(**kwargs) -> new dictionary initialized with the name=value pairs
- in the keyword argument list. For example: dict(one=1, two=2)''',
- __new__ = gateway.interp2app(descr__new__,
- unwrap_spec=
- [gateway.ObjSpace,
- gateway.W_Root,gateway.Arguments]),
- __hash__ = None,
- fromkeys = gateway.interp2app(descr_fromkeys, as_classmethod=True),
- )
-dict_typedef.registermethods(globals())
-
-# ____________________________________________________________
-
-def descr_dictiter__reduce__(w_self, space):
- """
- This is a slightly special case of pickling.
- Since iteration over a dict is a bit hairy,
- we do the following:
- - create a clone of the dict iterator
- - run it to the original position
- - collect all remaining elements into a list
- At unpickling time, we just use that list
- and create an iterator on it.
- This is of course not the standard way.
-
- XXX to do: remove this __reduce__ method and do
- a registration with copy_reg, instead.
- """
- w_mod = space.getbuiltinmodule('_pickle_support')
- mod = space.interp_w(MixedModule, w_mod)
- new_inst = mod.get('dictiter_surrogate_new')
- w_typeobj = space.gettypeobject(dictiter_typedef)
-
- raise OperationError(
- space.w_RuntimeError,
- space.wrap("cannot pickle dictiters with multidicts"))
- # XXXXXX get that working again
-
- # we cannot call __init__ since we don't have the original dict
- if isinstance(w_self, W_DictIter_Keys):
- w_clone = space.allocate_instance(W_DictIter_Keys, w_typeobj)
- elif isinstance(w_self, W_DictIter_Values):
- w_clone = space.allocate_instance(W_DictIter_Values, w_typeobj)
- elif isinstance(w_self, W_DictIter_Items):
- w_clone = space.allocate_instance(W_DictIter_Items, w_typeobj)
- else:
- msg = "unsupported dictiter type '%s' during pickling" % (w_self, )
- raise OperationError(space.w_TypeError, space.wrap(msg))
- w_clone.space = space
- w_clone.content = w_self.content
- w_clone.len = w_self.len
- w_clone.pos = 0
- w_clone.setup_iterator()
- # spool until we have the same pos
- while w_clone.pos < w_self.pos:
- w_obj = w_clone.next_entry()
- w_clone.pos += 1
- stuff = [w_clone.next_entry() for i in range(w_clone.pos, w_clone.len)]
- w_res = space.newlist(stuff)
- tup = [
- w_res
- ]
- w_ret = space.newtuple([new_inst, space.newtuple(tup)])
- return w_ret
-
-# ____________________________________________________________
-
-
-dictiter_typedef = StdTypeDef("dictionaryiterator",
- __reduce__ = gateway.interp2app(descr_dictiter__reduce__,
- unwrap_spec=[gateway.W_Root, gateway.ObjSpace]),
- )
-
-# ____________________________________________________________
-# Dict views
-
-dict_keys_typedef = StdTypeDef(
- "dict_keys",
- )
-
-dict_items_typedef = StdTypeDef(
- "dict_items",
- )
-
-dict_values_typedef = StdTypeDef(
- "dict_values",
- )
+from pypy.interpreter.baseobjspace import ObjSpace, W_Root
+from pypy.interpreter.error import OperationError
+from pypy.interpreter.mixedmodule import MixedModule
+from pypy.interpreter import gateway
+from pypy.objspace.std.stdtypedef import StdTypeDef, SMM
+from pypy.objspace.std.register_all import register_all
+
+dict_copy = SMM('copy', 1,
+ doc='D.copy() -> a shallow copy of D')
+dict_items = SMM('items', 1,
+ doc="D.items() -> list of D's (key, value) pairs, as"
+ ' 2-tuples')
+dict_keys = SMM('keys', 1,
+ doc="D.keys() -> list of D's keys")
+dict_values = SMM('values', 1,
+ doc="D.values() -> list of D's values")
+dict_has_key = SMM('has_key', 2,
+ doc='D.has_key(k) -> True if D has a key k, else False')
+dict_clear = SMM('clear', 1,
+ doc='D.clear() -> None. Remove all items from D.')
+dict_get = SMM('get', 3, defaults=(None,),
+ doc='D.get(k[,d]) -> D[k] if k in D, else d. d defaults'
+ ' to None.')
+dict_pop = SMM('pop', 2, w_varargs=True,
+ doc='D.pop(k[,d]) -> v, remove specified key and return'
+ ' the corresponding value\nIf key is not found, d is'
+ ' returned if given, otherwise KeyError is raised')
+dict_popitem = SMM('popitem', 1,
+ doc='D.popitem() -> (k, v), remove and return some (key,'
+ ' value) pair as a\n2-tuple; but raise KeyError if D'
+ ' is empty')
+dict_setdefault = SMM('setdefault', 3, defaults=(None,),
+ doc='D.setdefault(k[,d]) -> D.get(k,d), also set D[k]=d'
+ ' if k not in D')
+dict_update = SMM('update', 1, general__args__=True,
+ doc='D.update(E, **F) -> None. Update D from E and F:'
+ ' for k in E: D[k] = E[k]\n(if E has keys else: for'
+ ' (k, v) in E: D[k] = v) then: for k in F: D[k] ='
+ ' F[k]')
+dict_iteritems = SMM('iteritems', 1,
+ doc='D.iteritems() -> an iterator over the (key, value)'
+ ' items of D')
+dict_iterkeys = SMM('iterkeys', 1,
+ doc='D.iterkeys() -> an iterator over the keys of D')
+dict_itervalues = SMM('itervalues', 1,
+ doc='D.itervalues() -> an iterator over the values of D')
+dict_viewkeys = SMM('viewkeys', 1,
+ doc="D.viewkeys() -> a set-like object providing a view on D's keys")
+dict_viewitems = SMM('viewitems', 1,
+ doc="D.viewitems() -> a set-like object providing a view on D's items")
+dict_viewvalues = SMM('viewvalues', 1,
+ doc="D.viewvalues() -> an object providing a view on D's values")
+dict_reversed = SMM('__reversed__', 1)
+
+def dict_reversed__ANY(space, w_dict):
+ raise OperationError(space.w_TypeError, space.wrap('argument to reversed() must be a sequence'))
+
+register_all(vars(), globals())
+
+ at gateway.unwrap_spec(ObjSpace, W_Root, W_Root, W_Root)
+def descr_fromkeys(space, w_type, w_keys, w_fill=None):
+ from pypy.objspace.std.dictmultiobject import W_DictMultiObject
+ if w_fill is None:
+ w_fill = space.w_None
+ if space.is_w(w_type, space.w_dict):
+ w_dict = W_DictMultiObject.allocate_and_init_instance(space, w_type)
+ for w_key in space.listview(w_keys):
+ w_dict.setitem(w_key, w_fill)
+ else:
+ w_dict = space.call_function(w_type)
+ for w_key in space.listview(w_keys):
+ space.setitem(w_dict, w_key, w_fill)
+ return w_dict
+
+
+app = gateway.applevel('''
+ def dictrepr(currently_in_repr, d):
+ if len(d) == 0:
+ return "{}"
+ dict_id = id(d)
+ if dict_id in currently_in_repr:
+ return '{...}'
+ currently_in_repr[dict_id] = 1
+ try:
+ items = []
+ # XXX for now, we cannot use iteritems() at app-level because
+ # we want a reasonable result instead of a RuntimeError
+ # even if the dict is mutated by the repr() in the loop.
+ for k, v in dict.items(d):
+ items.append(repr(k) + ": " + repr(v))
+ return "{" + ', '.join(items) + "}"
+ finally:
+ try:
+ del currently_in_repr[dict_id]
+ except:
+ pass
+''', filename=__file__)
+
+dictrepr = app.interphook("dictrepr")
+
+
+def descr_repr(space, w_dict):
+ ec = space.getexecutioncontext()
+ w_currently_in_repr = ec._py_repr
+ if w_currently_in_repr is None:
+ w_currently_in_repr = ec._py_repr = space.newdict()
+ return dictrepr(space, w_currently_in_repr, w_dict)
+
+
+# ____________________________________________________________
+
+def descr__new__(space, w_dicttype, __args__):
+ from pypy.objspace.std.dictmultiobject import W_DictMultiObject
+ w_obj = W_DictMultiObject.allocate_and_init_instance(space, w_dicttype)
+ return w_obj
+
+# ____________________________________________________________
+
+dict_typedef = StdTypeDef("dict",
+ __doc__ = '''dict() -> new empty dictionary.
+dict(mapping) -> new dictionary initialized from a mapping object\'s
+ (key, value) pairs.
+dict(seq) -> new dictionary initialized as if via:
+ d = {}
+ for k, v in seq:
+ d[k] = v
+dict(**kwargs) -> new dictionary initialized with the name=value pairs
+ in the keyword argument list. For example: dict(one=1, two=2)''',
+ __new__ = gateway.interp2app(descr__new__,
+ unwrap_spec=
+ [gateway.ObjSpace,
+ gateway.W_Root,gateway.Arguments]),
+ __hash__ = None,
+ __repr__ = gateway.interp2app(descr_repr),
+ fromkeys = gateway.interp2app(descr_fromkeys, as_classmethod=True),
+ )
+dict_typedef.registermethods(globals())
+
+# ____________________________________________________________
+
+def descr_dictiter__reduce__(w_self, space):
+ """
+ This is a slightly special case of pickling.
+ Since iteration over a dict is a bit hairy,
+ we do the following:
+ - create a clone of the dict iterator
+ - run it to the original position
+ - collect all remaining elements into a list
+ At unpickling time, we just use that list
+ and create an iterator on it.
+ This is of course not the standard way.
+
+ XXX to do: remove this __reduce__ method and do
+ a registration with copy_reg, instead.
+ """
+ w_mod = space.getbuiltinmodule('_pickle_support')
+ mod = space.interp_w(MixedModule, w_mod)
+ new_inst = mod.get('dictiter_surrogate_new')
+ w_typeobj = space.gettypeobject(dictiter_typedef)
+
+ raise OperationError(
+ space.w_RuntimeError,
+ space.wrap("cannot pickle dictiters with multidicts"))
+ # XXXXXX get that working again
+
+ # we cannot call __init__ since we don't have the original dict
+ if isinstance(w_self, W_DictIter_Keys):
+ w_clone = space.allocate_instance(W_DictIter_Keys, w_typeobj)
+ elif isinstance(w_self, W_DictIter_Values):
+ w_clone = space.allocate_instance(W_DictIter_Values, w_typeobj)
+ elif isinstance(w_self, W_DictIter_Items):
+ w_clone = space.allocate_instance(W_DictIter_Items, w_typeobj)
+ else:
+ msg = "unsupported dictiter type '%s' during pickling" % (w_self, )
+ raise OperationError(space.w_TypeError, space.wrap(msg))
+ w_clone.space = space
+ w_clone.content = w_self.content
+ w_clone.len = w_self.len
+ w_clone.pos = 0
+ w_clone.setup_iterator()
+ # spool until we have the same pos
+ while w_clone.pos < w_self.pos:
+ w_obj = w_clone.next_entry()
+ w_clone.pos += 1
+ stuff = [w_clone.next_entry() for i in range(w_clone.pos, w_clone.len)]
+ w_res = space.newlist(stuff)
+ tup = [
+ w_res
+ ]
+ w_ret = space.newtuple([new_inst, space.newtuple(tup)])
+ return w_ret
+
+# ____________________________________________________________
+
+
+dictiter_typedef = StdTypeDef("dictionaryiterator",
+ __reduce__ = gateway.interp2app(descr_dictiter__reduce__,
+ unwrap_spec=[gateway.W_Root, gateway.ObjSpace]),
+ )
+
+# ____________________________________________________________
+# Dict views
+
+dict_keys_typedef = StdTypeDef(
+ "dict_keys",
+ )
+
+dict_items_typedef = StdTypeDef(
+ "dict_items",
+ )
+
+dict_values_typedef = StdTypeDef(
+ "dict_values",
+ )
--- a/pypy/objspace/std/test/test_typeobject.py Fri Dec 17 15:08:34 2010 +0100
+++ b/pypy/objspace/std/test/test_typeobject.py Fri Dec 17 15:10:02 2010 +0100
@@ -982,7 +982,7 @@
class AppTestMutableBuiltintypes:
def setup_class(cls):
- cls.space = gettestobjspace(**{"objspace.std.immutable_builtintypes": False})
+ cls.space = gettestobjspace(**{"objspace.std.mutable_builtintypes": True})
def test_del_type_mro(self):
del type.mro
--- a/pypy/objspace/std/typeobject.py Fri Dec 17 15:08:34 2010 +0100
+++ b/pypy/objspace/std/typeobject.py Fri Dec 17 15:10:02 2010 +0100
@@ -136,7 +136,7 @@
def mutated(w_self):
space = w_self.space
- assert w_self.is_heaptype() or not space.config.objspace.std.immutable_builtintypes
+ assert w_self.is_heaptype() or space.config.objspace.std.mutable_builtintypes
if (not space.config.objspace.std.withtypeversion and
not space.config.objspace.std.getattributeshortcut and
not space.config.objspace.std.newshortcut):
@@ -159,8 +159,8 @@
w_subclass.mutated()
def version_tag(w_self):
- if (not we_are_jitted() or w_self.is_heaptype() or not
- w_self.space.config.objspace.std.immutable_builtintypes):
+ if (not we_are_jitted() or w_self.is_heaptype() or
+ w_self.space.config.objspace.std.mutable_builtintypes):
return w_self._version_tag
# heap objects cannot get their version_tag changed
return w_self._pure_version_tag()
@@ -798,7 +798,7 @@
space.set(w_descr, w_type, w_value)
return
- if (space.config.objspace.std.immutable_builtintypes
+ if (not space.config.objspace.std.mutable_builtintypes
and not w_type.is_heaptype()):
msg = "can't set attributes on type object '%s'"
raise operationerrfmt(space.w_TypeError, msg, w_type.name)
@@ -820,7 +820,7 @@
if space.is_data_descr(w_descr):
space.delete(w_descr, w_type)
return
- if (space.config.objspace.std.immutable_builtintypes
+ if (not space.config.objspace.std.mutable_builtintypes
and not w_type.is_heaptype()):
msg = "can't delete attributes on type object '%s'"
raise operationerrfmt(space.w_TypeError, msg, w_type.name)
--- a/pypy/tool/logparser.py Fri Dec 17 15:08:34 2010 +0100
+++ b/pypy/tool/logparser.py Fri Dec 17 15:10:02 2010 +0100
@@ -1,7 +1,7 @@
#! /usr/bin/env python
"""
Syntax:
- python logparser.py <action><logfilename><options...>
+ python logparser.py <action><logfilename><output><options...>
Actions:
draw-time draw a timeline image of the log (format PNG by default)
Repository URL: https://bitbucket.org/pypy/pypy/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
More information about the Pypy-commit
mailing list