ext/pycall/libpython.c in pycall-1.3.0.dev vs ext/pycall/libpython.c in pycall-1.3.0

- old
+ new

@@ -28,10 +28,16 @@ int state; arg.libpython_handle = libpython_handle; arg.name = name; addr = rb_protect((VALUE (*)(VALUE))lookup_libpython_api_0, (VALUE)&arg, &state); - return (state || NIL_P(addr)) ? NULL : NUM2PTR(addr); + if (state) { + rb_set_errinfo(Qnil); + return NULL; + } + else { + return NIL_P(addr) ? NULL : NUM2PTR(addr); + } } #define LOOKUP_API_ENTRY(api_name) lookup_libpython_api(libpython_handle, #api_name) #define CHECK_API_ENTRY(api_name) (LOOKUP_API_ENTRY(api_name) != NULL)