]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-36251: Fix format strings used in match_repr() and stdprinter_repr(). (GH-12252)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Sun, 10 Mar 2019 10:52:44 +0000 (03:52 -0700)
committerGitHub <noreply@github.com>
Sun, 10 Mar 2019 10:52:44 +0000 (03:52 -0700)
(cherry picked from commit 8b91edadc06dcb0d391a65d1ecdf07dcb429df1b)

Co-authored-by: sth <sth.dev@tejp.de>
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 a97ce7790e393d4a8c7a6d526b6d11be5ce9b17c..4d2bdcc209679d1d5ce4c0c706db1a6d9b4660ee 100644 (file)
@@ -2319,7 +2319,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 ed4e12ba8a8deedd2fb3447d85bd934824060b84..d886e96e0f9b78d56f662d7560fb9d5590cb1696 100644 (file)
@@ -407,7 +407,7 @@ stdprinter_fileno(PyStdPrinter_Object *self)
 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);
 }