[Python-checkins] r79644 - in python/trunk: Lib/test/test_structmembers.py Misc/NEWS Modules/_testcapimodule.c Python/structmember.c
Mark Dickinson
dickinsm at gmail.com
Sat Apr 3 11:43:34 CEST 2010
On Sat, Apr 3, 2010 at 2:28 AM, benjamin.peterson
<python-checkins at python.org> wrote:
> Author: benjamin.peterson
> Date: Sat Apr 3 03:28:57 2010
> New Revision: 79644
>
> Log:
> give TypeError when trying to set T_STRING_INPLACE
>
> Modified:
> python/trunk/Lib/test/test_structmembers.py
> python/trunk/Misc/NEWS
> python/trunk/Modules/_testcapimodule.c
> python/trunk/Python/structmember.c
This commit seems to be causing a segfault in test_capi on my machine,
and also on at least some of the buildbots.
> Modified: python/trunk/Modules/_testcapimodule.c
> ==============================================================================
> --- python/trunk/Modules/_testcapimodule.c (original)
> +++ python/trunk/Modules/_testcapimodule.c Sat Apr 3 03:28:57 2010
> @@ -1749,17 +1751,19 @@
> static char *keywords[] = {
> "T_BOOL", "T_BYTE", "T_UBYTE", "T_SHORT", "T_USHORT",
> "T_INT", "T_UINT", "T_LONG", "T_ULONG",
> - "T_FLOAT", "T_DOUBLE",
> + "T_FLOAT", "T_DOUBLE", "T_INPLACE_STRING",
Any reason for using "T_INPLACE_STRING" rather than "T_STRING_INPLACE" here?
> @@ -1784,6 +1789,12 @@
> Py_DECREF(ob);
> return NULL;
> }
> + if (string_len > 5) {
> + Py_DECREF(ob);
> + PyErr_SetString(PyExc_ValueError, "string too long");
> + return NULL;
> + }
> + strcpy(ob->structmembers.inplace_member, s);
I think this added block should be conditional on s being non-NULL
(and s should be initialized to NULL in the earlier declaration).
Mark
More information about the Python-checkins
mailing list