[Python-checkins] bpo-36251: Fix format strings used in match_repr() and stdprinter_repr(). (GH-12252)
Miss Islington (bot)
webhook-mailer at python.org
Sun Mar 10 06:52:59 EDT 2019
https://github.com/python/cpython/commit/e4be2057d4bd06eb56fbfef4e4ed88fff7fb47cd
commit: e4be2057d4bd06eb56fbfef4e4ed88fff7fb47cd
branch: 3.7
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: GitHub <noreply at github.com>
date: 2019-03-10T03:52:44-07:00
summary:
bpo-36251: Fix format strings used in match_repr() and stdprinter_repr(). (GH-12252)
(cherry picked from commit 8b91edadc06dcb0d391a65d1ecdf07dcb429df1b)
Co-authored-by: sth <sth.dev at tejp.de>
files:
A Misc/NEWS.d/next/Library/2019-03-09-18-01-24.bpo-36251.zOp9l0.rst
M Modules/_sre.c
M 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
index 000000000000..5138b0a0cb8b
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2019-03-09-18-01-24.bpo-36251.zOp9l0.rst
@@ -0,0 +1,2 @@
+Fix format strings used for stderrprinter and re.Match reprs. Patch by
+Stephan Hohe.
diff --git a/Modules/_sre.c b/Modules/_sre.c
index a97ce7790e39..4d2bdcc20967 100644
--- a/Modules/_sre.c
+++ b/Modules/_sre.c
@@ -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);
diff --git a/Objects/fileobject.c b/Objects/fileobject.c
index ed4e12ba8a8d..d886e96e0f9b 100644
--- a/Objects/fileobject.c
+++ b/Objects/fileobject.c
@@ -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);
}
More information about the Python-checkins
mailing list