Skip to content

Commit 51a5b8c

Browse files
authored
Fix Py_XDECREF (#172)
1 parent 561e830 commit 51a5b8c

File tree

2 files changed

+2
-20
lines changed

2 files changed

+2
-20
lines changed

abi3audit/_audit.py

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,6 @@
1818

1919
logger = logging.getLogger(__name__)
2020

21-
# A handpicked exclusion list of symbols that are not strictly in the limited API
22-
# or stable ABI, but in practice always appear in ABI3-compatible code.
23-
# Since they are not listed in CPython's `stable_abi.toml`, we maintain them here separately.
24-
# For more information, see https://github.com/pypa/abi3audit/issues/85
25-
# and https://github.com/wjakob/nanobind/discussions/500 .
26-
_ALLOWED_SYMBOLS: set[str] = {
27-
"Py_XDECREF", # not stable ABI, but defined as static inline in limited API
28-
}
29-
3021

3122
class AuditError(Exception):
3223
pass
@@ -134,7 +125,7 @@ def audit(so: SharedObject, assume_minimum_abi3: PyVersion = PyVersion(3, 2)) ->
134125
continue
135126
# Local symbols are fine, since they are inlined functions
136127
# from the CPython limited API.
137-
if sym.name not in _ALLOWED_SYMBOLS and sym.visibility != "local":
128+
if sym.visibility != "local":
138129
non_abi3_symbols.add(sym)
139130
except Exception as exc:
140131
raise AuditError(f"failed to collect symbols in shared object: {exc}") from exc

test/test_audit_unit.py

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -48,23 +48,14 @@ def __iter__(self) -> Iterator[Symbol]:
4848
),
4949
],
5050
),
51-
SharedObject(
52-
baseline=PyVersion(3, 10),
53-
computed=PyVersion(3, 10),
54-
symbols=[
55-
Symbol("PyType_GetModule", "global"),
56-
# This test is just to assert the existing behaviour. Py_XDECREF is never a global
57-
# symbol and will always be local.
58-
Symbol("Py_XDECREF", "global"),
59-
],
60-
),
6151
SharedObject(
6252
baseline=PyVersion(3, 9),
6353
computed=PyVersion(3, 14),
6454
symbols=[
6555
Symbol("PyType_GetModule", "global"),
6656
Symbol("Py_TYPE", "global"),
6757
Symbol("Py_REFCNT", "local"),
58+
Symbol("Py_XDECREF", "local"),
6859
],
6960
future_abi3_objects=[
7061
Function(

0 commit comments

Comments
 (0)