Skip to content

Commit f1a6d4a

Browse files
improved try/catch structure
1 parent acf2ef3 commit f1a6d4a

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

ddtrace/profiling/collector/_lock.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,11 +133,12 @@ def _acquire(self, inner_func: Callable[..., Any], *args: Any, **kwargs: Any) ->
133133
for ddframe in frames:
134134
handle.push_frame(ddframe.function_name, ddframe.file_name, 0, ddframe.lineno)
135135
handle.flush_sample()
136-
except Exception as e:
137-
# _maybe_update_self_name throws AssertionError exceptions which need to propagate
138-
# (but only if assertions are enabled)
139-
if config.enable_asserts and type(e) is AssertionError:
136+
except AssertionError:
137+
if config.enable_asserts:
138+
# _maybe_update_self_name throws AssertionError exceptions which need to propagate
140139
raise
140+
except Exception:
141+
pass
141142

142143
def acquire(self, *args: Any, **kwargs: Any) -> Any:
143144
return self._acquire(self.__wrapped__.acquire, *args, **kwargs)

0 commit comments

Comments
 (0)