summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2017-06-23 13:11:12 (GMT)
committerGitHub <noreply@github.com>2017-06-23 13:11:12 (GMT)
commitf87b85f80853c580b1c8bf78a51b0e9a25f6e1a7 (patch)
tree8417421b14db403e4df4b264c4e4ec09e7c1f4b9 /Modules
parenta4b091e135ccf345cfafdd8477aef897c5214f82 (diff)
downloadcpython-f87b85f80853c580b1c8bf78a51b0e9a25f6e1a7.zip
cpython-f87b85f80853c580b1c8bf78a51b0e9a25f6e1a7.tar.gz
cpython-f87b85f80853c580b1c8bf78a51b0e9a25f6e1a7.tar.bz2
bpo-21071: struct.Struct.format type is now str (#845)
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_struct.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/Modules/_struct.c b/Modules/_struct.c
index 46e7b40..b4febf7 100644
--- a/Modules/_struct.c
+++ b/Modules/_struct.c
@@ -1957,8 +1957,8 @@ s_pack_into(PyObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames
static PyObject *
s_get_format(PyStructObject *self, void *unused)
{
- Py_INCREF(self->s_format);
- return self->s_format;
+ return PyUnicode_FromStringAndSize(PyBytes_AS_STRING(self->s_format),
+ PyBytes_GET_SIZE(self->s_format));
}
static PyObject *