[pypy-svn] r68381 - pypy/branch/improve-kwd-args/pypy/objspace/std
pedronis at codespeak.net
pedronis at codespeak.net
Tue Oct 13 16:42:08 CEST 2009
Author: pedronis
Date: Tue Oct 13 16:42:08 2009
New Revision: 68381
Modified:
pypy/branch/improve-kwd-args/pypy/objspace/std/dictmultiobject.py
pypy/branch/improve-kwd-args/pypy/objspace/std/dictobject.py
pypy/branch/improve-kwd-args/pypy/objspace/std/listmultiobject.py
pypy/branch/improve-kwd-args/pypy/objspace/std/listobject.py
pypy/branch/improve-kwd-args/pypy/objspace/std/setobject.py
Log:
(cfbolz, pedronis) oops, adjust these too. improve dict creation a tiny bit,
while we are at it.
Modified: pypy/branch/improve-kwd-args/pypy/objspace/std/dictmultiobject.py
==============================================================================
--- pypy/branch/improve-kwd-args/pypy/objspace/std/dictmultiobject.py (original)
+++ pypy/branch/improve-kwd-args/pypy/objspace/std/dictmultiobject.py Tue Oct 13 16:42:08 2009
@@ -922,12 +922,13 @@
def init__DictMulti(space, w_dict, __args__):
- w_src, w_kwds = __args__.parse('dict',
- (['seq_or_map'], None, 'kwargs'), # signature
- [W_DictMultiObject(space)]) # default argument
- # w_dict.implementation = space.emptydictimpl
- # ^^^ disabled only for CPython compatibility
- if space.findattr(w_src, space.wrap("keys")) is None:
+ w_src, w_kwds = __args__.parse_obj(
+ None, 'dict',
+ (['seq_or_map'], None, 'kwargs'), # signature
+ [None]) # default argument
+ if w_src is None:
+ pass
+ elif space.findattr(w_src, space.wrap("keys")) is None:
list_of_w_pairs = space.unpackiterable(w_src)
for w_pair in list_of_w_pairs:
pair = space.unpackiterable(w_pair)
Modified: pypy/branch/improve-kwd-args/pypy/objspace/std/dictobject.py
==============================================================================
--- pypy/branch/improve-kwd-args/pypy/objspace/std/dictobject.py (original)
+++ pypy/branch/improve-kwd-args/pypy/objspace/std/dictobject.py Tue Oct 13 16:42:08 2009
@@ -58,11 +58,13 @@
def init__Dict(space, w_dict, __args__):
- w_src, w_kwds = __args__.parse('dict',
- (['seq_or_map'], None, 'kwargs'), # signature
- [W_DictObject(space)]) # default argument
- # w_dict.content.clear() - disabled only for CPython compatibility
- if space.findattr(w_src, space.wrap("keys")) is None:
+ w_src, w_kwds = __args__.parse_obj(
+ None, 'dict',
+ (['seq_or_map'], None, 'kwargs'), # signature
+ [None]) # default argument
+ if w_src is None:
+ pass
+ elif space.findattr(w_src, space.wrap("keys")) is None:
list_of_w_pairs = space.unpackiterable(w_src)
for w_pair in list_of_w_pairs:
pair = space.unpackiterable(w_pair)
Modified: pypy/branch/improve-kwd-args/pypy/objspace/std/listmultiobject.py
==============================================================================
--- pypy/branch/improve-kwd-args/pypy/objspace/std/listmultiobject.py (original)
+++ pypy/branch/improve-kwd-args/pypy/objspace/std/listmultiobject.py Tue Oct 13 16:42:08 2009
@@ -895,9 +895,10 @@
def init__ListMulti(space, w_list, __args__):
EMPTY_LIST = space.fromcache(State).empty_list
- w_iterable, = __args__.parse('list',
- (['sequence'], None, None), # signature
- [EMPTY_LIST]) # default argument
+ w_iterable, = __args__.parse_obj(
+ None, 'list',
+ (['sequence'], None, None), # signature
+ [EMPTY_LIST]) # default argument
if w_iterable is not EMPTY_LIST:
list_w = space.unpackiterable(w_iterable)
if list_w:
Modified: pypy/branch/improve-kwd-args/pypy/objspace/std/listobject.py
==============================================================================
--- pypy/branch/improve-kwd-args/pypy/objspace/std/listobject.py (original)
+++ pypy/branch/improve-kwd-args/pypy/objspace/std/listobject.py Tue Oct 13 16:42:08 2009
@@ -30,9 +30,11 @@
EMPTY_LIST = W_ListObject([])
def init__List(space, w_list, __args__):
- w_iterable, = __args__.parse('list',
- (['sequence'], None, None), # signature
- [EMPTY_LIST]) # default argument
+ # this is on the silly side
+ w_iterable, = __args__.parse_obj(
+ None, 'list',
+ (['sequence'], None, None), # signature
+ [EMPTY_LIST]) # default argument
#
# this is the old version of the loop at the end of this function:
#
Modified: pypy/branch/improve-kwd-args/pypy/objspace/std/setobject.py
==============================================================================
--- pypy/branch/improve-kwd-args/pypy/objspace/std/setobject.py (original)
+++ pypy/branch/improve-kwd-args/pypy/objspace/std/setobject.py Tue Oct 13 16:42:08 2009
@@ -600,15 +600,17 @@
cmp__Frozenset_frozensettypedef = cmp__Set_settypedef
def init__Set(space, w_set, __args__):
- w_iterable, = __args__.parse('set',
- (['some_iterable'], None, None),
- [space.newtuple([])])
+ w_iterable, = __args__.parse_obj(
+ None, 'set',
+ (['some_iterable'], None, None),
+ [space.newtuple([])])
_initialize_set(space, w_set, w_iterable)
def init__Frozenset(space, w_set, __args__):
- w_iterable, = __args__.parse('set',
- (['some_iterable'], None, None),
- [space.newtuple([])])
+ w_iterable, = __args__.parse_obj(
+ None, 'set',
+ (['some_iterable'], None, None),
+ [space.newtuple([])])
if w_set.hash == -1:
_initialize_set(space, w_set, w_iterable)
hash__Frozenset(space, w_set)
More information about the Pypy-commit
mailing list