bpo-36251: Fix format strings used in match_repr() and stdprinter_rep… · python/cpython@e4be205 (original) (raw)

Skip to content

Provide feedback

Saved searches

Use saved searches to filter your results more quickly

Sign up

Appearance settings

Commit e4be205

miss-islingtonsth

and

authored

bpo-36251: Fix format strings used in match_repr() and stdprinter_repr(). (GH-12252)

(cherry picked from commit 8b91eda) Co-authored-by: sth sth.dev@tejp.de

File tree

3 files changed

lines changed

3 files changed

lines changed

Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
1 +Fix format strings used for stderrprinter and re.Match reprs. Patch by
2 +Stephan Hohe.
Original file line number Diff line number Diff line change
@@ -2319,7 +2319,7 @@ match_repr(MatchObject *self)
2319 2319 if (group0 == NULL)
2320 2320 return NULL;
2321 2321 result = PyUnicode_FromFormat(
2322 -"<%s object; span=(%d, %d), match=%.50R>",
2322 +"<%s object; span=(%zd, %zd), match=%.50R>",
2323 2323 Py_TYPE(self)->tp_name,
2324 2324 self->mark[0], self->mark[1], group0);
2325 2325 Py_DECREF(group0);
Original file line number Diff line number Diff line change
@@ -407,7 +407,7 @@ stdprinter_fileno(PyStdPrinter_Object *self)
407 407 static PyObject *
408 408 stdprinter_repr(PyStdPrinter_Object *self)
409 409 {
410 -return PyUnicode_FromFormat("<stdprinter(fd=%d) object at 0x%x>",
410 +return PyUnicode_FromFormat("<stdprinter(fd=%d) object at %p>",
411 411 self->fd, self);
412 412 }
413 413