File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -722,12 +722,15 @@ def strip_string(value, max_length=None):
722722 return value
723723
724724
725- def _is_threading_local_monkey_patched ():
725+ def _is_contextvars_broken ():
726726 # type: () -> bool
727727 try :
728728 from gevent .monkey import is_object_patched # type: ignore
729729
730730 if is_object_patched ("threading" , "local" ):
731+ if is_object_patched ("contextvars" , "ContextVar" ):
732+ return False
733+
731734 return True
732735 except ImportError :
733736 pass
@@ -752,7 +755,7 @@ def _get_contextvars():
752755
753756 https://github.com/gevent/gevent/issues/1407
754757 """
755- if not _is_threading_local_monkey_patched ():
758+ if not _is_contextvars_broken ():
756759 # aiocontextvars is a PyPI package that ensures that the contextvars
757760 # backport (also a PyPI package) works with asyncio under Python 3.6
758761 #
Original file line number Diff line number Diff line change 33import time
44
55
6- from sentry_sdk .utils import _is_threading_local_monkey_patched
7-
8-
9- @pytest .mark .forked
10- def test_thread_local_is_patched (maybe_monkeypatched_threading ):
11- if maybe_monkeypatched_threading is None :
12- assert not _is_threading_local_monkey_patched ()
13- else :
14- assert _is_threading_local_monkey_patched ()
15-
16-
176@pytest .mark .forked
187def test_leaks (maybe_monkeypatched_threading ):
198 import threading
You can’t perform that action at this time.
0 commit comments