]> granicus.if.org Git - python/commitdiff
Issue #19034: repr() for tkinter.Tcl_Obj now exposes string reperesentation.
authorSerhiy Storchaka <storchaka@gmail.com>
Mon, 23 Sep 2013 19:49:02 +0000 (22:49 +0300)
committerSerhiy Storchaka <storchaka@gmail.com>
Mon, 23 Sep 2013 19:49:02 +0000 (22:49 +0300)
Misc/NEWS
Modules/_tkinter.c

index 79ab3a7f172f736713488410867c172c896195c2..e2b7944ed7b05e88727b1d06fba09d83f0792c19 100644 (file)
--- 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__``.
 
index 7b58fd8225657c4afc1160d9026feda4bc9750c7..e022a7a7e1564ef50a77e6e4b9bae1fbd1440f66 100644 (file)
@@ -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)