Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def find_module(self, fullname, path = None):
# Prevent re-entry by the underlying importer
if self._running:
return
try:
self._running = True
cppimport.importer.imp(fullname, opt_in = True)
except ImportError as e:
# ImportError should be quashed because that simply means cppimport
# didn't find anything, and probably shouldn't have found anything!
if self.print_exceptions:
import traceback
print(traceback.format_exc())
finally:
self._running = False