[pypy-commit] pypy py3k: merge default
pjenvey
noreply at buildbot.pypy.org
Tue May 28 23:45:02 CEST 2013
Author: Philip Jenvey <pjenvey at underboss.org>
Branch: py3k
Changeset: r64643:83978aef9853
Date: 2013-05-28 14:42 -0700
http://bitbucket.org/pypy/pypy/changeset/83978aef9853/
Log: merge default
diff --git a/pypy/doc/whatsnew-head.rst b/pypy/doc/whatsnew-head.rst
--- a/pypy/doc/whatsnew-head.rst
+++ b/pypy/doc/whatsnew-head.rst
@@ -40,3 +40,9 @@
.. branch: on-abort-resops
Added list of resops to the pypyjit on_abort hook.
+
+.. branch: logging-perf
+Speeds up the stdlib logging module
+
+.. branch: operrfmt-NT
+Adds a couple convenient format specifiers to operationerrfmt
diff --git a/pypy/interpreter/error.py b/pypy/interpreter/error.py
--- a/pypy/interpreter/error.py
+++ b/pypy/interpreter/error.py
@@ -355,7 +355,7 @@
_fmtcache = {}
_fmtcache2 = {}
-_FMTS = tuple('8dsNT')
+_FMTS = tuple('8NRTds')
def decompose_valuefmt(valuefmt):
"""Returns a tuple of string parts extracted from valuefmt,
@@ -409,6 +409,8 @@
elif fmt == '8':
result, _ = str_decode_utf_8(value, len(value),
'strict')
+ elif fmt == 'R':
+ result = space.unicode_w(space.repr(value))
elif fmt in 'NT':
if fmt == 'T':
value = space.type(value)
@@ -448,6 +450,7 @@
%8 - The result of arg.decode('utf-8', 'strict')
%N - The result of w_arg.getname(space)
+ %R - The result of space.str_w(space.repr(w_arg))
%T - The result of space.type(w_arg).getname(space)
"""
diff --git a/pypy/interpreter/test/test_error.py b/pypy/interpreter/test/test_error.py
--- a/pypy/interpreter/test/test_error.py
+++ b/pypy/interpreter/test/test_error.py
@@ -65,8 +65,14 @@
space.wrap('foo'), 'foo')
assert operr._compute_value(space) == "'?' object has no attribute 'foo'"
-def test_operationerrfmt_empty():
- py.test.raises(AssertionError, operationerrfmt, "w_type", "foobar")
+def test_operationerrfmt_R(space):
+ operr = operationerrfmt(space.w_ValueError, "illegal newline value: %R",
+ space.wrap('foo'))
+ assert operr._compute_value(space) == "illegal newline value: 'foo'"
+ operr = operationerrfmt(space.w_ValueError, "illegal newline value: %R",
+ space.wrap("'PyLadies'"))
+ expected = "illegal newline value: \"'PyLadies'\""
+ assert operr._compute_value(space) == expected
def test_operationerrfmt_unicode(space):
operr = operationerrfmt("w_type", "abc %s", u"àèìòù")
diff --git a/pypy/module/_io/interp_io.py b/pypy/module/_io/interp_io.py
--- a/pypy/module/_io/interp_io.py
+++ b/pypy/module/_io/interp_io.py
@@ -49,9 +49,7 @@
if not (space.isinstance_w(w_file, space.w_unicode) or
space.isinstance_w(w_file, space.w_str) or
space.isinstance_w(w_file, space.w_int)):
- raise operationerrfmt(space.w_TypeError,
- "invalid file: %s", space.str_w(space.repr(w_file))
- )
+ raise operationerrfmt(space.w_TypeError, "invalid file: %R", w_file)
reading = writing = appending = updating = text = binary = universal = False
diff --git a/pypy/objspace/std/objspace.py b/pypy/objspace/std/objspace.py
--- a/pypy/objspace/std/objspace.py
+++ b/pypy/objspace/std/objspace.py
@@ -387,8 +387,8 @@
instance.user_setup(self, w_subtype)
else:
raise operationerrfmt(self.w_TypeError,
- "%s.__new__(%s): only for the type %s",
- w_type.name, w_subtype.getname(self), w_type.name)
+ "%N.__new__(%N): only for the type %N",
+ w_type, w_subtype, w_type)
return instance
allocate_instance._annspecialcase_ = "specialize:arg(1)"
More information about the pypy-commit
mailing list