[pypy-commit] pypy py3.5: hg merge py3k
arigo
pypy.commits at gmail.com
Thu Aug 18 16:14:27 EDT 2016
Author: Armin Rigo <arigo at tunes.org>
Branch: py3.5
Changeset: r86294:3c9a0b0aa820
Date: 2016-08-18 22:13 +0200
http://bitbucket.org/pypy/pypy/changeset/3c9a0b0aa820/
Log: hg merge py3k
diff --git a/pypy/interpreter/astcompiler/optimize.py b/pypy/interpreter/astcompiler/optimize.py
--- a/pypy/interpreter/astcompiler/optimize.py
+++ b/pypy/interpreter/astcompiler/optimize.py
@@ -118,7 +118,7 @@
# don't constant-fold if "w_left" and "w_right" are integers and
# the estimated bit length of the power is unreasonably large
space.appexec([w_left, w_right], """(left, right):
- if isinstance(left, (int, long)) and isinstance(right, (int, long)):
+ if isinstance(left, int) and isinstance(right, int):
if left.bit_length() * right > 5000:
raise OverflowError
""")
diff --git a/pypy/interpreter/gateway.py b/pypy/interpreter/gateway.py
--- a/pypy/interpreter/gateway.py
+++ b/pypy/interpreter/gateway.py
@@ -612,7 +612,10 @@
# First extract the signature from the (CPython-level) code object
from pypy.interpreter import pycode
- argnames, varargname, kwargname = pycode.cpython_code_signature(func.func_code)
+ sig = pycode.cpython_code_signature(func.func_code)
+ argnames = sig.argnames
+ varargname = sig.varargname
+ kwargname = sig.kwargname
self._argnames = argnames
if unwrap_spec is None:
@@ -636,7 +639,9 @@
app_sig = SignatureBuilder(func)
UnwrapSpec_Check(orig_sig).apply_over(unwrap_spec, app_sig)
- self.sig = argnames, varargname, kwargname = app_sig.signature()
+ self.sig = app_sig.signature()
+ argnames = self.sig.argnames
+ varargname = self.sig.varargname
self.minargs = len(argnames)
if varargname:
@@ -972,7 +977,7 @@
defs_w.append(space.wrap(defaultval))
if self._code._unwrap_spec:
UNDEFINED = object()
- alldefs_w = [UNDEFINED] * len(self._code.sig[0])
+ alldefs_w = [UNDEFINED] * len(self._code.sig.argnames)
if defs_w:
alldefs_w[-len(defs_w):] = defs_w
code = self._code
@@ -993,7 +998,7 @@
assert isinstance(w_default, W_Root)
assert argname.startswith('w_')
argname = argname[2:]
- j = self._code.sig[0].index(argname)
+ j = self._code.sig.argnames.index(argname)
assert alldefs_w[j] in (UNDEFINED, None)
alldefs_w[j] = w_default
first_defined = 0
diff --git a/pypy/interpreter/pycode.py b/pypy/interpreter/pycode.py
--- a/pypy/interpreter/pycode.py
+++ b/pypy/interpreter/pycode.py
@@ -45,7 +45,7 @@
# cpython_code_signature helper
def cpython_code_signature(code):
- "([list-of-arg-names], vararg-name-or-None, kwarg-name-or-None)."
+ """Return a Signature instance."""
argcount = code.co_argcount
varnames = code.co_varnames
if we_are_translated():
diff --git a/pypy/interpreter/signature.py b/pypy/interpreter/signature.py
--- a/pypy/interpreter/signature.py
+++ b/pypy/interpreter/signature.py
@@ -68,18 +68,3 @@
if not isinstance(other, Signature):
return NotImplemented
return not self == other
-
-
- # make it look tuply for its use in the annotator
-
- def __len__(self):
- return 3
-
- def __getitem__(self, i):
- if i == 0:
- return self.argnames
- if i == 1:
- return self.varargname
- if i == 2:
- return self.kwargname
- raise IndexError
diff --git a/pypy/interpreter/test/test_argument.py b/pypy/interpreter/test/test_argument.py
--- a/pypy/interpreter/test/test_argument.py
+++ b/pypy/interpreter/test/test_argument.py
@@ -47,13 +47,6 @@
assert sig.find_argname("d") == -1
assert sig.find_argname("kwonly") == 3
- def test_tuply(self):
- sig = Signature(["a", "b", "c"], "d", "e")
- x, y, z = sig
- assert x == ["a", "b", "c"]
- assert y == "d"
- assert z == "e"
-
class dummy_wrapped_dict(dict):
def __nonzero__(self):
raise NotImplementedError
diff --git a/pypy/interpreter/typedef.py b/pypy/interpreter/typedef.py
--- a/pypy/interpreter/typedef.py
+++ b/pypy/interpreter/typedef.py
@@ -202,7 +202,8 @@
name = func.__name__
extra = ', '.join(extraargs)
from pypy.interpreter import pycode
- argnames, _, _ = pycode.cpython_code_signature(func.func_code)
+ sig = pycode.cpython_code_signature(func.func_code)
+ argnames = sig.argnames
if use_closure:
if argnames[1] == 'space':
args = "closure, space, obj"
diff --git a/pypy/module/_jitlog/test/test__jitlog.py b/pypy/module/_jitlog/test/test__jitlog.py
--- a/pypy/module/_jitlog/test/test__jitlog.py
+++ b/pypy/module/_jitlog/test/test__jitlog.py
@@ -10,10 +10,10 @@
def setup_class(cls):
cls.w_tmpfilename = cls.space.wrap(str(udir.join('test__jitlog.1')))
- cls.w_mark_header = cls.space.wrap(jl.MARK_JITLOG_HEADER)
- cls.w_version = cls.space.wrap(jl.JITLOG_VERSION_16BIT_LE)
+ cls.w_mark_header = cls.space.newbytes(jl.MARK_JITLOG_HEADER)
+ cls.w_version = cls.space.newbytes(jl.JITLOG_VERSION_16BIT_LE)
cls.w_is_32bit = cls.space.wrap(sys.maxint == 2**31-1)
- cls.w_machine = cls.space.wrap(platform.machine())
+ cls.w_machine = cls.space.newbytes(platform.machine())
cls.w_resops = cls.space.newdict()
space = cls.space
for key, value in opname.items():
@@ -48,5 +48,3 @@
assert opnum in self.resops
# the name must equal
assert self.resops[opnum] == opname
-
-
diff --git a/pypy/tool/pytest/genreportdata.py b/pypy/tool/pytest/genreportdata.py
--- a/pypy/tool/pytest/genreportdata.py
+++ b/pypy/tool/pytest/genreportdata.py
@@ -17,7 +17,7 @@
resultwc = py.path.svnwc(testresultdir)
print "updating", resultwc
resultwc.update()
- except KeyboardInterrupt as RuntimeError:
+ except (KeyboardInterrupt, RuntimeError):
raise
except Exception as e: #py.process.ExecutionFailed,e:
print >> sys.stderr, "Warning: ",e #Subversion update failed"
More information about the pypy-commit
mailing list