Author: Amaury Forgeot d'Arc <[email protected]>
Branch: py3.3
Changeset: r75249:c27d75f38838
Date: 2015-01-05 22:35 +0100
http://bitbucket.org/pypy/pypy/changeset/c27d75f38838/
Log: Function.__repr__ now uses the __qualname__ attribute.
diff --git a/pypy/interpreter/astcompiler/codegen.py
b/pypy/interpreter/astcompiler/codegen.py
--- a/pypy/interpreter/astcompiler/codegen.py
+++ b/pypy/interpreter/astcompiler/codegen.py
@@ -307,7 +307,7 @@
def _make_function(self, code, num_defaults=0, qualname=None):
"""Emit the opcodes to turn a code object into a function."""
- w_qualname = self.space.wrap(qualname or code.co_name)
+ w_qualname = self.space.wrap((qualname or
code.co_name).decode('utf-8'))
if code.co_freevars:
# Load cell and free vars to pass on.
for free in code.co_freevars:
diff --git a/pypy/interpreter/function.py b/pypy/interpreter/function.py
--- a/pypy/interpreter/function.py
+++ b/pypy/interpreter/function.py
@@ -247,8 +247,7 @@
return self.call_args(__args__)
def descr_function_repr(self):
- return self.getrepr(self.space, u'function %s' %
- (self.name.decode('utf-8'),))
+ return self.getrepr(self.space, u'function %s' % self.qualname)
# delicate
_all = {'': None}
diff --git a/pypy/interpreter/test/test_function.py
b/pypy/interpreter/test/test_function.py
--- a/pypy/interpreter/test/test_function.py
+++ b/pypy/interpreter/test/test_function.py
@@ -153,7 +153,8 @@
"""
def 日本():
pass
- assert repr(日本).startswith('<function 日本
at ')
+ assert repr(日本).startswith(
+ '<function test_func_nonascii.<locals>.日本 at ')
assert 日本.__name__ == '日本'
"""
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit