Skip to content

Commit 1b4f8d3

Browse files
authored
Fix threading run patch (#4610)
Since we're using `current_thread` for `self` explicitly, we need to remove the first argument from `*a`. This actually doesn't matter since `*a, **kw` are actually both empty but since this is the way the patch is implemented (presumably for forward compat), I don't want to change the signature. This fixes the following warning in CI since what actually happens is this: * `Thread.run` is being patched at each `Thread.start` (and not just once as other patches do) * So the current thread keeps getting accumulated in `*a` giving the `TypeError` for subsequent thread runs except the first ```python TypeError: Thread.run() takes 1 positional argument but 5 were given tests/integrations/redis/cluster_asyncio/test_redis_cluster_asyncio.py::test_async_span_origin /Users/neel/sentry/sdks/sentry-python/.tox/py3.12-redis-v5/lib/python3.12/site-packages/_pytest/threadexception.py:58: PytestUnhandledThreadExceptionWarning: Exception in thread sentry.monitor ``` closes #4361
1 parent 7339704 commit 1b4f8d3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

sentry_sdk/integrations/threading.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ def _run_old_run_func():
120120
# type: () -> Any
121121
try:
122122
self = current_thread()
123-
return old_run_func(self, *a, **kw)
123+
return old_run_func(self, *a[1:], **kw)
124124
except Exception:
125125
reraise(*_capture_exception())
126126

0 commit comments

Comments
 (0)