[Python-checkins] r51379 - python/trunk/Modules/_ctypes/_ctypes.c

Neal Norwitz nnorwitz at gmail.com
Fri Aug 18 20:06:42 CEST 2006


On 8/18/06, thomas.heller <python-checkins at python.org> wrote:
> Log:
> Add asserts to check for 'impossible' NULL values, with comments.
> In one place where I'n not 1000% sure about the non-NULL, raise
> a RuntimeError for safety.
>
> This should fix the klocwork issues that Neal sent me.  If so,
> it should be applied to the release25-maint branch also.
>
> Modified: python/trunk/Modules/_ctypes/_ctypes.c
> ==============================================================================
> --- python/trunk/Modules/_ctypes/_ctypes.c      (original)
> +++ python/trunk/Modules/_ctypes/_ctypes.c      Fri Aug 18 16:38:46 2006
> @@ -3129,6 +3130,13 @@
>                         }
>                         ob = PyTuple_GET_ITEM(argtypes, i);
>                         dict = PyType_stgdict(ob);
> +                       if (dict == NULL) {
> +                               /* Cannot happen: _validate_paramflags()
> +                                 would not accept such an object */
> +                               PyErr_Format(PyExc_RuntimeError,
> +                                            "NULL stgdict unexpected");
> +                               goto error;
> +                       }

Would a SystemError be better?

n


More information about the Python-checkins mailing list