• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

zopefoundation / AccessControl / 42772184423
83%

Build:
DEFAULT BRANCH: master
Ran 10 Nov 2026 07:03AM UTC
Jobs 1
Files 59
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

10 Nov 2026 06:59AM UTC coverage: 82.64% (+0.3%) from 82.305%
42772184423

push

github

web-flow
Let the C SecurityManager take part in garbage collection (#178)

* Let the C SecurityManager take part in garbage collection

The C SecurityManager keeps its context, policy and cached bound policy
methods in struct fields, but the type had no tp_traverse and no
tp_clear.  Reference cycles through a security manager were therefore
never collected and leaked everything reachable from them.

The type was declared "old-style" for ExtensionClass (tp_flags == 0),
where the tp_traverse and tp_clear slots carry the method chain and the
ExtensionClass flags.  Declare it "new-style" instead, with
Py_TPFLAGS_HAVE_GC, a tp_traverse and a tp_clear, and untrack the object
in tp_dealloc.  PyExtensionClass_Export_ then installs PyType_GenericNew,
which does not INCREF the type per instance, so the matching DECREF in
tp_dealloc goes away.

Fixes #177

Assisted-by: Claude Fable 5.1

* Drop the Py_TPFLAGS_HAVE_GC constant from the tests

gc.is_tracked() is only true for instances of types that have the
flag, so the flag check duplicated the tracking assertion with a
copied CPython-internal constant.

Assisted-by: Claude Fable 5.1

* Drop the redundant tp_new assignment

PyExtensionClass_Export_ installs PyType_GenericNew when tp_new is
NULL, as the comment above the type says.

Assisted-by: Claude Fable 5.1

* Report a missing security context as _context

CHECK_SECURITY_MANAGER_STATE raised AttributeError('_policy') for a
missing context, a copy-and-paste slip.

Assisted-by: Claude Fable 5.1

* Store new values before releasing old ones in SecurityManager_setattro

ASSIGN released the old context, policy or thread id before storing
the new one, and the _policy branch released the cached bound policy
methods before clearing the fields.  Code that runs while the old
object is torn down, for example a __del__, could reach the dying
object through the manager.  Use Py_XSETREF and Py_CLEAR, which store
first and release afterwards.

Assisted-by: Claude Fable 5.1

735 of 1240 branches covered (59.27%)

Branch coverage included in aggregate %.

140 of 140 new or added lines in 1 file covered. (100.0%)

5658 of 6496 relevant lines covered (87.1%)

4.35 hits per line

Jobs
ID Job ID Ran Files Coverage
1 42772184423.1 10 Nov 2026 07:03AM UTC 59
82.64
GitHub Action Run
Source Files on build 42772184423
  • Tree
  • List 59
  • Changed 1
  • Source Changed 1
  • Coverage Changed 1
Coverage ∆ File Lines Relevant Covered Missed Hits/Line Branch Hits Branch Misses
  • Back to Repo
  • Github Actions Build #42772184423
  • 6583e9b5 on github
  • Prev Build on master (#42504498074)
  • Next Build on master (#42773671446)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc