Skip to content

Commit

Permalink
bpo-36251: Fix format strings used in match_repr() and stdprinter_rep…
Browse files Browse the repository at this point in the history
…r(). (pythonGH-12252)
  • Loading branch information
sth authored and serhiy-storchaka committed Mar 10, 2019
1 parent ca7fe50 commit 8b91eda
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Fix format strings used for stderrprinter and re.Match reprs. Patch by
Stephan Hohe.
2 changes: 1 addition & 1 deletion Modules/_sre.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion Objects/fileobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down

0 comments on commit 8b91eda

Please sign in to comment.