pyodide/packages/python-dateutil/patches/dummy-thread-lock.patch

80 lines
2.4 KiB
Diff

diff -ru python-dateutil-2.7.2.orig/dateutil/tz/tz.py python-dateutil-2.7.2/dateutil/tz/tz.py
--- python-dateutil-2.8.1/dateutil/tz/tz.py.orig 2019-11-24 17:23:10.395546087 -0500
+++ python-dateutil-2.8.1/dateutil/tz/tz.py 2019-11-24 17:24:06.125760830 -0500
@@ -18,7 +18,6 @@
import six
from six import string_types
-from six.moves import _thread
from ._common import tzname_in_python2, _tzinfo
from ._common import tzrangebase, enfold
from ._common import _validate_fromutc_inputs
@@ -38,6 +37,14 @@
EPOCHORDINAL = EPOCH.toordinal()
+class _dummy_lock:
+ def __enter__(self, *args, **kwargs):
+ pass
+
+ def __exit__(self, *args, **kwargs):
+ pass
+
+
@six.add_metaclass(_TzSingleton)
class tzutc(datetime.tzinfo):
"""
@@ -1172,7 +1179,7 @@
self._comps = comps
self._cachedate = []
self._cachecomp = []
- self._cache_lock = _thread.allocate_lock()
+ self._cache_lock = _dummy_lock()
def _find_comp(self, dt):
if len(self._comps) == 1:
@@ -1547,7 +1554,7 @@
self.__instances = weakref.WeakValueDictionary()
self.__strong_cache_size = 8
self.__strong_cache = OrderedDict()
- self._cache_lock = _thread.allocate_lock()
+ self._cache_lock = _dummy_lock()
def __call__(self, name=None):
with self._cache_lock:
diff -ur python-dateutil-2.7.2/dateutil/rrule.py python-dateutil-2.7.2.bak/dateutil/rrule.py
--- python-dateutil-2.7.2/dateutil/rrule.py 2018-03-24 11:53:31.000000000 -0400
+++ python-dateutil-2.7.2.bak/dateutil/rrule.py 2018-05-17 09:36:33.295290743 -0400
@@ -17,7 +17,20 @@
from fractions import gcd
from six import advance_iterator, integer_types
-from six.moves import _thread, range
+try:
+ from six.moves._thread import allocate_lock
+except ModuleNotFoundError:
+ class allocate_lock:
+ def locked(self):
+ return False
+
+ def release(self):
+ pass
+
+ def acquire(self):
+ pass
+
+from six.moves import range
import heapq
from ._common import weekday as weekdaybase
@@ -94,7 +107,7 @@
def __init__(self, cache=False):
if cache:
self._cache = []
- self._cache_lock = _thread.allocate_lock()
+ self._cache_lock = allocate_lock()
self._invalidate_cache()
else:
self._cache = None