Author: Antonio Cuni <anto.c...@gmail.com> Branch: py3k Changeset: r56800:e8678fb55920 Date: 2012-08-22 14:25 +0200 http://bitbucket.org/pypy/pypy/changeset/e8678fb55920/
Log: merge heads diff --git a/TODO b/TODO --- a/TODO +++ b/TODO @@ -10,5 +10,6 @@ re-enable StdObjSpace.listview_str re-enable the kwargs dict strategy in dictmultiobject.py +re-enable view_as_kwargs unskip numpypy tests in module/test_lib_pypy/numpypy/ diff --git a/pypy/interpreter/argument.py b/pypy/interpreter/argument.py --- a/pypy/interpreter/argument.py +++ b/pypy/interpreter/argument.py @@ -5,6 +5,7 @@ from pypy.interpreter.error import OperationError, operationerrfmt from pypy.rlib.debug import make_sure_not_resized from pypy.rlib import jit +from pypy.rlib.debug import check_annotation from pypy.rlib.objectmodel import enforceargs class Signature(object): @@ -93,15 +94,19 @@ raise IndexError -def assert_list_of_unicode(value): - from pypy.rlib.debug import check_annotation - def checker(ann, bk): - from pypy.annotation.model import SomeList, SomeUnicodeString - if not isinstance(ann, SomeList): - raise TypeError - if not isinstance(ann.listdef.listitem.s_value, SomeUnicodeString): - raise TypeError - check_annotation(value, checker) + +def check_list_of_unicode(ann, bk): + from pypy.annotation.model import (SomeList, SomeUnicodeString, + s_None, s_ImpossibleValue) + if ann is s_None: + return + if not isinstance(ann, SomeList): + raise TypeError + s_item = ann.listdef.listitem.s_value + if s_item is s_ImpossibleValue: + return + if not isinstance(s_item, SomeUnicodeString): + raise TypeError class Arguments(object): @@ -116,13 +121,13 @@ """ ### Construction ### - @enforceargs(keywords=[unicode]) + #@enforceargs(keywords=[unicode]) def __init__(self, space, args_w, keywords=None, keywords_w=None, w_stararg=None, w_starstararg=None, keyword_names_w=None): self.space = space assert isinstance(args_w, list) self.arguments_w = args_w - assert_list_of_unicode(keywords) + check_annotation(keywords, check_list_of_unicode) self.keywords = keywords self.keywords_w = keywords_w @@ -198,7 +203,7 @@ # unpack the ** arguments space = self.space keywords, values_w = space.view_as_kwargs(w_starstararg) - assert_list_of_unicode(keywords) + check_annotation(keywords, check_list_of_unicode) if keywords is not None: # this path also taken for empty dicts if self.keywords is None: self.keywords = keywords diff --git a/pypy/module/__builtin__/compiling.py b/pypy/module/__builtin__/compiling.py --- a/pypy/module/__builtin__/compiling.py +++ b/pypy/module/__builtin__/compiling.py @@ -6,7 +6,7 @@ from pypy.interpreter.error import OperationError from pypy.interpreter.astcompiler import consts, ast from pypy.interpreter.gateway import unwrap_spec -from pypy.interpreter.argument import Arguments, assert_list_of_unicode +from pypy.interpreter.argument import Arguments, check_annotation, check_list_of_unicode from pypy.interpreter.nestedscope import Cell @unwrap_spec(filename=str, mode=str, flags=int, dont_inherit=int, optimize=int) @@ -114,7 +114,7 @@ def build_class(space, w_func, w_name, __args__): bases_w, kwds_w = __args__.unpack() w_bases = space.newtuple(bases_w) - w_meta = kwds_w.pop('metaclass', None) + w_meta = kwds_w.pop(u'metaclass', None) if w_meta is None: if bases_w: w_meta = space.type(bases_w[0]) @@ -129,7 +129,7 @@ w_namespace = space.newdict() else: keywords = kwds_w.keys() - assert_list_of_unicode(keywords) + check_annotation(keywords, check_list_of_unicode) args = Arguments(space, args_w=[w_name, w_bases], keywords=keywords, @@ -137,7 +137,7 @@ w_namespace = space.call_args(w_prep, args) w_cell = space.call_function(w_func, w_namespace) keywords = kwds_w.keys() - assert_list_of_unicode(keywords) + check_annotation(keywords, check_list_of_unicode) args = Arguments(space, args_w=[w_name, w_bases, w_namespace], keywords=keywords, diff --git a/pypy/objspace/flow/flowcontext.py b/pypy/objspace/flow/flowcontext.py --- a/pypy/objspace/flow/flowcontext.py +++ b/pypy/objspace/flow/flowcontext.py @@ -11,6 +11,7 @@ from pypy.objspace.flow.framestate import (FrameState, recursively_unflatten, recursively_flatten) from pypy.tool.stdlib_opcode import host_bytecode_spec +from pypy.rlib import jit class StopFlowing(Exception): pass diff --git a/pypy/objspace/std/dictmultiobject.py b/pypy/objspace/std/dictmultiobject.py --- a/pypy/objspace/std/dictmultiobject.py +++ b/pypy/objspace/std/dictmultiobject.py @@ -529,6 +529,7 @@ @jit.look_inside_iff(lambda self, w_dict: w_dict_unrolling_heuristic(w_dict)) def view_as_kwargs(self, w_dict): + return (None, None) # XXX: fix me to return unicode keys d = self.unerase(w_dict.dstorage) l = len(d) keys, values = [None] * l, [None] * l _______________________________________________ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit