summaryrefslogtreecommitdiff
path: root/Python
diff options
context:
space:
mode:
authorAmaury Forgeot d'Arc <amauryfa@gmail.com>2007-11-30 21:53:17 +0000
committerAmaury Forgeot d'Arc <amauryfa@gmail.com>2007-11-30 21:53:17 +0000
commit8334a4fc313be34d3b76f8635b160159c10f8b0e (patch)
treec63137138fef73ff603e61965d68a1dd3a0b7bc9 /Python
parenta5463ab7de21ed6f9252a655156fbc6f48909bd5 (diff)
downloadcpython-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.c7
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(