Commit 9ad4c8d4 authored by Arnaud Fontaine's avatar Arnaud Fontaine Committed by Łukasz Nowak

Remove useless locks acquisition.

Followup of a29456bc.
(cherry picked from commit f73c1f57962f275246da0e125ceb4f312e0399fb)
parent 12830504
...@@ -31,7 +31,6 @@ ...@@ -31,7 +31,6 @@
from __future__ import absolute_import from __future__ import absolute_import
import sys import sys
import threading
from Products.ERP5.ERP5Site import getSite from Products.ERP5.ERP5Site import getSite
from Products.ERP5Type.Base import Base from Products.ERP5Type.Base import Base
...@@ -202,7 +201,7 @@ class ComponentDynamicPackage(ModuleType): ...@@ -202,7 +201,7 @@ class ComponentDynamicPackage(ModuleType):
return version_package return version_package
def __load_module(self, fullname): def load_module(self, fullname):
""" """
Load a module with given fullname (see PEP 302) if it's not already in Load a module with given fullname (see PEP 302) if it's not already in
sys.modules. It is assumed that imports are filtered properly in sys.modules. It is assumed that imports are filtered properly in
...@@ -216,6 +215,9 @@ class ComponentDynamicPackage(ModuleType): ...@@ -216,6 +215,9 @@ class ComponentDynamicPackage(ModuleType):
As per PEP-302, raise an ImportError if the Loader could not load the As per PEP-302, raise an ImportError if the Loader could not load the
module for any reason... module for any reason...
Import is protected by Python Import Lock, but if this method is not
called through Import, it must be protected by Base.aq_method_lock
""" """
site = getSite() site = getSite()
name = fullname[len(self._namespace_prefix):] name = fullname[len(self._namespace_prefix):]
...@@ -311,14 +313,6 @@ class ComponentDynamicPackage(ModuleType): ...@@ -311,14 +313,6 @@ class ComponentDynamicPackage(ModuleType):
return module return module
def load_module(self, fullname):
"""
Make sure that loading module is thread-safe using aq_method_lock to make
sure that modules do not disappear because of an ongoing reset
"""
with Base.aq_method_lock:
return self.__load_module(fullname)
def reset(self, sub_package=None): def reset(self, sub_package=None):
""" """
Reset the content of the current package and its version package as well Reset the content of the current package and its version package as well
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment