fix: isolate ICDB checks and recover scoped native sessions
This commit is contained in:
1 parent
1acfbd6374
commit
1bd7589fef
82 files changed
+7770
-1583
No files matched your search
@@ -112,7 +112,8 @@ def _without_authorized_checkpoint_cleanup(text):
|
||||
"""Exempt exact protocol-checkpoint callsites, never the whole module."""
|
||||
tree = ast.parse(text)
|
||||
parents = {child: parent for parent in ast.walk(tree) for child in ast.iter_child_nodes(parent)}
|
||||
allowed = {('LibraryLock', '_exit_owned'): 'marker', ('release_retained_library',): 'checkpoint'}
|
||||
allowed = {('LibraryLock', '_exit_owned'): 'marker', ('LibraryLock', '__enter__'): 'marker',
|
||||
('release_retained_library',): 'checkpoint'}
|
||||
used, spans = set(), []
|
||||
for call in ast.walk(tree):
|
||||
if not (isinstance(call, ast.Call) and isinstance(call.func, ast.Attribute)
|
||||
@@ -126,7 +127,7 @@ def _without_authorized_checkpoint_cleanup(text):
|
||||
scope = tuple(scope)
|
||||
if scope in used or allowed.get(scope) != call.func.value.id:
|
||||
continue
|
||||
expected = ([] if scope == ('release_retained_library',) else [('missing_ok', True)])
|
||||
expected = ([('missing_ok', True)] if scope == ('LibraryLock', '_exit_owned') else [])
|
||||
keywords = [(k.arg, k.value.value if isinstance(k.value, ast.Constant) else None) for k in call.keywords]
|
||||
if keywords == expected and call.lineno == call.end_lineno:
|
||||
spans.append((call.lineno - 1, call.col_offset, call.end_col_offset))
|
||||
|
||||
Reference in new issue
Block a user