]> granicus.if.org Git - python/commitdiff
bpo-36251: Fix format strings used in match_repr() and stdprinter_repr(). (GH-12252)
authorsth <sth.dev@tejp.de>
Sun, 10 Mar 2019 10:29:14 +0000 (11:29 +0100)
committerSerhiy Storchaka <storchaka@gmail.com>
Sun, 10 Mar 2019 10:29:14 +0000 (12:29 +0200)
Misc/NEWS.d/next/Library/2019-03-09-18-01-24.bpo-36251.zOp9l0.rst [new file with mode: 0644]
Modules/_sre.c
Objects/fileobject.c

diff --git a/Misc/NEWS.d/next/Library/2019-03-09-18-01-24.bpo-36251.zOp9l0.rst b/Misc/NEWS.d/next/Library/2019-03-09-18-01-24.bpo-36251.zOp9l0.rst
new file mode 100644 (file)
index 0000000..5138b0a
--- /dev/null
@@ -0,0 +1,2 @@
+Fix format strings used for stderrprinter and re.Match reprs. Patch by
+Stephan Hohe.
index 5cea7562f2807a2a70d539231477dee03e1167b3..014cc546e345d9a8d3c4bce913d053a522d54a7d 100644 (file)
@@ -2306,7 +2306,7 @@ match_repr(MatchObject *self)
     if (group0 == NULL)
         return NULL;
     result = PyUnicode_FromFormat(
-            "<%s object; span=(%d, %d), match=%.50R>",
+            "<%s object; span=(%zd, %zd), match=%.50R>",
             Py_TYPE(self)->tp_name,
             self->mark[0], self->mark[1], group0);
     Py_DECREF(group0);
index babaa05bdbc49e201014d265a40295cc11eb9712..39c7c109979a4816c9dc47dd97c550aed08a85bf 100644 (file)
@@ -411,7 +411,7 @@ stdprinter_fileno(PyStdPrinter_Object *self, PyObject *Py_UNUSED(ignored))
 static PyObject *
 stdprinter_repr(PyStdPrinter_Object *self)
 {
-    return PyUnicode_FromFormat("<stdprinter(fd=%d) object at 0x%x>",
+    return PyUnicode_FromFormat("<stdprinter(fd=%d) object at %p>",
                                 self->fd, self);
 }