Skip to content

Commit 1fdc89b

Browse files
authored
Raise import error on module lookup failure (@overstre #786)
Thanks Brian!
1 parent 0593c37 commit 1fdc89b

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

confluent_kafka/src/confluent_kafka.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2104,10 +2104,10 @@ PyObject *cfl_PyObject_lookup (const char *modulename, const char *typename) {
21042104
PyObject *module = PyImport_ImportModule(modulename);
21052105
PyObject *obj;
21062106

2107-
if (!modulename) {
2108-
PyErr_Format(PyExc_TypeError,
2109-
"Module %s not found when looking up %s.%s",
2110-
modulename, modulename, typename);
2107+
if (!module) {
2108+
PyErr_Format(PyExc_ImportError,
2109+
"Module not found when looking up %s.%s",
2110+
modulename, typename);
21112111
return NULL;
21122112
}
21132113

0 commit comments

Comments
 (0)