Windows: Use 32-bit distribution of python
This commit is contained in:
@@ -2,10 +2,13 @@
|
||||
"""gevent friendly implementations of builtin functions."""
|
||||
from __future__ import absolute_import
|
||||
|
||||
import imp # deprecated since 3.4; issues PendingDeprecationWarning in 3.5
|
||||
import sys
|
||||
import weakref
|
||||
|
||||
from gevent.lock import RLock
|
||||
from gevent._compat import imp_acquire_lock
|
||||
from gevent._compat import imp_release_lock
|
||||
|
||||
|
||||
# Normally we'd have the "expected" case inside the try
|
||||
# (Python 3, because Python 3 is the way forward). But
|
||||
@@ -14,15 +17,15 @@ from gevent.lock import RLock
|
||||
# So we test for the old, deprecated version first
|
||||
|
||||
try: # Py2
|
||||
import __builtin__ as builtins
|
||||
import __builtin__ as __gbuiltins__
|
||||
_allowed_module_name_types = (basestring,) # pylint:disable=undefined-variable
|
||||
__target__ = '__builtin__'
|
||||
except ImportError:
|
||||
import builtins # pylint: disable=import-error
|
||||
import builtins as __gbuiltins__ # pylint: disable=import-error
|
||||
_allowed_module_name_types = (str,)
|
||||
__target__ = 'builtins'
|
||||
|
||||
_import = builtins.__import__
|
||||
_import = __gbuiltins__.__import__
|
||||
|
||||
# We need to protect imports both across threads and across greenlets.
|
||||
# And the order matters. Note that under 3.4, the global import lock
|
||||
@@ -86,7 +89,7 @@ def __import__(*args, **kwargs):
|
||||
return _import(*args, **kwargs)
|
||||
|
||||
module_lock = __module_lock(args[0]) # Get a lock for the module name
|
||||
imp.acquire_lock()
|
||||
imp_acquire_lock()
|
||||
try:
|
||||
module_lock.acquire()
|
||||
try:
|
||||
@@ -94,7 +97,7 @@ def __import__(*args, **kwargs):
|
||||
finally:
|
||||
module_lock.release()
|
||||
finally:
|
||||
imp.release_lock()
|
||||
imp_release_lock()
|
||||
return result
|
||||
|
||||
|
||||
@@ -120,6 +123,13 @@ def _lock_imports():
|
||||
|
||||
if sys.version_info[:2] >= (3, 3):
|
||||
__implements__ = []
|
||||
__import__ = _import
|
||||
else:
|
||||
__implements__ = ['__import__']
|
||||
__all__ = __implements__
|
||||
|
||||
|
||||
from gevent._util import copy_globals
|
||||
|
||||
__imports__ = copy_globals(__gbuiltins__, globals(),
|
||||
names_to_ignore=__implements__)
|
||||
|
||||
Reference in New Issue
Block a user