From: Serhiy Storchaka Date: Mon, 23 Sep 2013 19:49:02 +0000 (+0300) Subject: Issue #19034: repr() for tkinter.Tcl_Obj now exposes string reperesentation. X-Git-Tag: v3.4.0a3~24 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=463bd4b5c6046f2501b36978ea2732e5bcd4ea19;p=thirdparty%2FPython%2Fcpython.git Issue #19034: repr() for tkinter.Tcl_Obj now exposes string reperesentation. --- diff --git a/Misc/NEWS b/Misc/NEWS index 79ab3a7f172f..e2b7944ed7b0 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -12,6 +12,8 @@ Core and Builtins Library ------- +- Issue #19034: repr() for tkinter.Tcl_Obj now exposes string reperesentation. + - Issue #18978: ``urllib.request.Request`` now allows the method to be indicated on the class and no longer sets it to None in ``__init__``. diff --git a/Modules/_tkinter.c b/Modules/_tkinter.c index 7b58fd822565..e022a7a7e156 100644 --- a/Modules/_tkinter.c +++ b/Modules/_tkinter.c @@ -737,8 +737,13 @@ PyTclObject_str(PyTclObject *self, void *ignored) static PyObject * PyTclObject_repr(PyTclObject *self) { - return PyUnicode_FromFormat("<%s object at %p>", - self->value->typePtr->name, self->value); + PyObject *repr, *str = PyTclObject_str(self, NULL); + if (str == NULL) + return NULL; + repr = PyUnicode_FromFormat("<%s object: %R>", + self->value->typePtr->name, str); + Py_DECREF(str); + return repr; } #define TEST_COND(cond) ((cond) ? Py_True : Py_False)