Skip to content
Permalink
Browse files

Fixes an error when unloading plugins

Custom utils._import was never called, because
builtins was correctly imported (even if it missed __import__)
and  _import was then monkey patched to builtins instead of __builtin__

Tested on python 2
  • Loading branch information
elpaso committed Mar 25, 2016
1 parent 8af5edc commit 2d3b813d227ca5d87690dd9eca1164c48dae594a
Showing with 5 additions and 4 deletions.
  1. +5 −4 python/utils.py
@@ -581,13 +581,13 @@ def startServerPlugin(packageName):
#######################
# IMPORT wrapper

_uses_builtins = True
try:
import builtins

_builtin_import = builtins.__import__
except AttributeError:
_uses_builtins = False
import __builtin__

_builtin_import = __builtin__.__import__

_plugin_modules = {}
@@ -616,7 +616,8 @@ def _import(name, globals={}, locals={}, fromlist=[], level=None):

return mod

try:

if _uses_builtins:
builtins.__import__ = _import
except AttributeError:
else:
__builtin__.__import__ = _import

0 comments on commit 2d3b813

Please sign in to comment.
You can’t perform that action at this time.