diff options
author | Amaury Forgeot d'Arc <amauryfa@gmail.com> | 2007-11-30 21:53:17 +0000 |
---|---|---|
committer | Amaury Forgeot d'Arc <amauryfa@gmail.com> | 2007-11-30 21:53:17 +0000 |
commit | 8334a4fc313be34d3b76f8635b160159c10f8b0e (patch) | |
tree | c63137138fef73ff603e61965d68a1dd3a0b7bc9 /Python | |
parent | a5463ab7de21ed6f9252a655156fbc6f48909bd5 (diff) | |
download | cpython-git-8334a4fc313be34d3b76f8635b160159c10f8b0e.tar.gz |
Backport of r59241: str.decode fails on very long strings on 64bit platforms.
PyArgs_ParseTuple t# and w# formats truncated the lengths to 32bit.
Diffstat (limited to 'Python')
-rw-r--r-- | Python/getargs.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/Python/getargs.c b/Python/getargs.c index d625598632..d94edce50b 100644 --- a/Python/getargs.c +++ b/Python/getargs.c @@ -894,7 +894,8 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags, char **buffer; const char *encoding; PyObject *s; - int size, recode_strings; + Py_ssize_t size; + int recode_strings; /* Get 'e' parameter: the encoding name */ encoding = (const char *)va_arg(*p_va, const char *); @@ -1144,7 +1145,7 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags, case 'w': { /* memory buffer, read-write access */ void **p = va_arg(*p_va, void **); PyBufferProcs *pb = arg->ob_type->tp_as_buffer; - int count; + Py_ssize_t count; if (pb == NULL || pb->bf_getwritebuffer == NULL || @@ -1166,7 +1167,7 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags, case 't': { /* 8-bit character buffer, read-only access */ char **p = va_arg(*p_va, char **); PyBufferProcs *pb = arg->ob_type->tp_as_buffer; - int count; + Py_ssize_t count; if (*format++ != '#') return converterr( |