Displaying 2 results from an estimated 2 matches for "pymapping_getitemstr".
2019 Jun 25
3
[PATCH libnbd] generator: Add Mutable type to the generator.
...len;
pr " PyList_SET_ITEM (py_%s, i, PyLong_FromUnsignedLong (%s[i]));\n" n n
| BytesIn _ -> ()
+ | Mutable (Int n) ->
+ pr " PyObject *py_%s_dict = PyImport_GetModuleDict ();\n" n;
+ pr " PyObject *py_%s_mod = PyMapping_GetItemString (py_%s_dict, \"ctypes\");\n" n n;
+ pr " PyObject *py_%s = PyObject_CallMethod (py_%s_mod, \"c_int\", \"i\", *%s);\n" n n n
| Opaque n ->
pr " struct %s_%s_data *_data = %s;\n" name cb_name n...
2019 Jun 25
0
Re: [PATCH libnbd] generator: Add Mutable type to the generator.
..." PyList_SET_ITEM (py_%s, i, PyLong_FromUnsignedLong (%s[i]));\n" n n
> | BytesIn _ -> ()
> + | Mutable (Int n) ->
> + pr " PyObject *py_%s_dict = PyImport_GetModuleDict ();\n" n;
> + pr " PyObject *py_%s_mod = PyMapping_GetItemString (py_%s_dict, \"ctypes\");\n" n n;
> + pr " PyObject *py_%s = PyObject_CallMethod (py_%s_mod, \"c_int\", \"i\", *%s);\n" n n n
PyMapping_GetItemString() is returning NULL, then the program is
segfaulting on PyObject_CallMethod. This cod...