Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/c/_cffi_backend.c
Original file line number Diff line number Diff line change
Expand Up @@ -1762,7 +1762,7 @@ convert_from_object(char *data, CTypeDescrObject *ct, PyObject *init)
switch (ct->ct_size) {
case sizeof(char): {
int res = _convert_to_char(init);
if (res < 0)
if (res < 0 && PyErr_Occurred())
return -1;
data[0] = res;
return 0;
Expand Down Expand Up @@ -5009,6 +5009,7 @@ static PyObject *new_struct_or_union_type(const char *name, int flag)
int namelen = strlen(name);
CTypeDescrObject *td = ctypedescr_new(namelen + 1);
if (td == NULL)
PyErr_NoMemory(); /* ctypedescr_new does not set an exception on OOM */
return NULL;

td->ct_size = -1;
Expand Down
5 changes: 5 additions & 0 deletions src/c/ffi_obj.c
Original file line number Diff line number Diff line change
Expand Up @@ -1014,7 +1014,12 @@ static PyObject *ffi_init_once(FFIObject *self, PyObject *args, PyObject *kwds)
if (tup == NULL) {
lock = PyThread_allocate_lock();
if (lock == NULL)
{
PyErr_SetString(PyExc_RuntimeError,
"failed to allocate thread lock for init_once");
return NULL;
}

x = PyCapsule_New(lock, "cffi_init_once_lock", _free_init_once_lock);
if (x == NULL) {
PyThread_free_lock(lock);
Expand Down