cpython: 92dcee426014 (original) (raw)

Mercurial > cpython

changeset 92170:92dcee426014

use __qualname__ to compute bound method repr (closes #21389) Patch from Steven Barker. [#21389]

Benjamin Peterson benjamin@python.org
date Wed, 20 Aug 2014 18:41:57 -0500
parents 10d0a692b1b6
children 5875c50e93fe
files Lib/test/test_defaultdict.py Lib/test/test_descr.py Misc/NEWS Objects/classobject.c
diffstat 4 files changed, 75 insertions(+), 33 deletions(-)[+] [-] Lib/test/test_defaultdict.py 5 Lib/test/test_descr.py 55 Misc/NEWS 3 Objects/classobject.c 45

line wrap: on

line diff

--- a/Lib/test/test_defaultdict.py +++ b/Lib/test/test_defaultdict.py @@ -157,8 +157,9 @@ class TestDefaultDict(unittest.TestCase) def _factory(self): return [] d = sub()

# NOTE: printing a subclass of a builtin type does not call its # tp_print slot. So this part is essentially the same test as above.

--- a/Lib/test/test_descr.py +++ b/Lib/test/test_descr.py @@ -4423,6 +4423,61 @@ order (MRO) for bases """ self.assertIn("dict", Base.dict) self.assertNotIn("dict", Sub.dict)

+ +

+

+ +

+ class DictProxyTests(unittest.TestCase): def setUp(self):

--- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,9 @@ Release date: TBA Core and Builtins ----------------- +- Issue #21389: Displaying the qualname of the underlying function in the

--- a/Objects/classobject.c +++ b/Objects/classobject.c @@ -15,6 +15,7 @@ static int numfree = 0; #endif _Py_IDENTIFIER(name); +_Py_IDENTIFIER(qualname); PyObject * PyMethod_Function(PyObject *im) @@ -243,51 +244,33 @@ method_repr(PyMethodObject *a) { PyObject *self = a->im_self; PyObject *func = a->im_func;

-

+

- /* XXX Shouldn't use repr()/%R here! */

Py_XDECREF(funcname);