The cgitb module had imports in its functions. This can cause deadlock with the
import lock if called from within a thread that was triggered by an import.

Partially fixes issue #1665206.
2 files changed