opendreambox 2.0
[opendreambox.git] / meta-opendreambox / recipes-devtools / python / python / ctypes-error-handling-fix.patch
1 --- a/Modules/_ctypes/_ctypes.c 2012-01-26 15:41:30.000000000 +0100
2 +++ b/Modules/_ctypes/_ctypes.c 2012-01-26 15:44:41.046977137 +0100
3 @@ -602,10 +602,16 @@
4  #ifdef __CYGWIN__
5  /* dlerror() isn't very helpful on cygwin */
6          PyErr_Format(PyExc_ValueError,
7 -                     "symbol '%s' not found (%s) ",
8 +                     "symbol '%s' not found",
9                       name);
10  #else
11 -        PyErr_SetString(PyExc_ValueError, ctypes_dlerror());
12 +        const char *err = ctypes_dlerror();
13 +        if (!err)
14 +            PyErr_Format(PyExc_ValueError,
15 +                         "symbol '%s' not found",
16 +                         name);
17 +        else
18 +            PyErr_SetString(PyExc_ValueError, err);
19  #endif
20          return NULL;
21      }
22 @@ -3290,10 +3296,16 @@
23  #ifdef __CYGWIN__
24  /* dlerror() isn't very helpful on cygwin */
25          PyErr_Format(PyExc_AttributeError,
26 -                     "function '%s' not found (%s) ",
27 +                     "function '%s' not found",
28                       name);
29  #else
30 -        PyErr_SetString(PyExc_AttributeError, ctypes_dlerror());
31 +        const char *err = ctypes_dlerror();
32 +        if (!err)
33 +            PyErr_Format(PyExc_AttributeError,
34 +                         "function '%s' not found",
35 +                         name);
36 +        else
37 +            PyErr_SetString(PyExc_AttributeError, err);
38  #endif
39          return NULL;
40      }