Author: Carl Friedrich Bolz <[email protected]>
Branch:
Changeset: r87148:0130615b254c
Date: 2016-09-16 12:20 +0200
http://bitbucket.org/pypy/pypy/changeset/0130615b254c/
Log: factor out some invariant code from the unrolling_iterable loop. no
sense in having it be there 13 times, identically.
diff --git a/pypy/module/array/interp_array.py
b/pypy/module/array/interp_array.py
--- a/pypy/module/array/interp_array.py
+++ b/pypy/module/array/interp_array.py
@@ -30,16 +30,19 @@
raise oefmt(space.w_TypeError,
"array.array() does not take keyword arguments")
+ w_initializer_type = None
+ w_initializer = None
+ if len(__args__.arguments_w) > 0:
+ w_initializer = __args__.arguments_w[0]
+ w_initializer_type = space.type(w_initializer)
for tc in unroll_typecodes:
if typecode == tc:
a = space.allocate_instance(types[tc].w_class, w_cls)
a.__init__(space)
-
- if len(__args__.arguments_w) > 0:
- w_initializer = __args__.arguments_w[0]
- if space.type(w_initializer) is space.w_str:
+ if w_initializer is not None:
+ if w_initializer_type is space.w_str:
a.descr_fromstring(space, w_initializer)
- elif space.type(w_initializer) is space.w_list:
+ elif w_initializer_type is space.w_list:
a.descr_fromlist(space, w_initializer)
else:
a.extend(w_initializer, True)
diff --git a/pypy/module/cpyext/pytraceback.py
b/pypy/module/cpyext/pytraceback.py
--- a/pypy/module/cpyext/pytraceback.py
+++ b/pypy/module/cpyext/pytraceback.py
@@ -5,7 +5,6 @@
from pypy.module.cpyext.pyobject import (
PyObject, make_ref, from_ref, Py_DecRef, make_typedescr)
from pypy.module.cpyext.frameobject import PyFrameObject
-from rpython.rlib.unroll import unrolling_iterable
from pypy.interpreter.error import OperationError
from pypy.interpreter.pytraceback import PyTraceback
from pypy.interpreter import pycode
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit