[Python-checkins] cpython: Issue #19034: repr() for tkinter.Tcl_Obj now exposes string reperesentation.

serhiy.storchaka python-checkins at python.org
Mon Sep 23 21:49:24 CEST 2013


http://hg.python.org/cpython/rev/ece634a69ba8
changeset: 85791:ece634a69ba8
user: Serhiy Storchaka <storchaka at gmail.com>
date: Mon Sep 23 22:49:02 2013 +0300
summary:
 Issue #19034: repr() for tkinter.Tcl_Obj now exposes string reperesentation.
files:
 Misc/NEWS | 2 ++
 Modules/_tkinter.c | 9 +++++++--
 2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -12,6 +12,8 @@
 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
--- a/Modules/_tkinter.c
+++ b/Modules/_tkinter.c
@@ -737,8 +737,13 @@
 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)
-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /