Skip to content

Sync main with release#308

Merged
wool-labs[bot] merged 3 commits into
mainfrom
release
Jul 13, 2026
Merged

Sync main with release#308
wool-labs[bot] merged 3 commits into
mainfrom
release

Conversation

@wool-labs

@wool-labs wool-labs Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Auto-generated by the sync branches workflow.

conradbzura and others added 3 commits July 13, 2026 16:02
Pushing a guarded context manager onto an ExitStack or AsyncExitStack
raised TypeError, the error the decorator emits for bare functions.
contextlib looks special methods up on the type and calls them unbound,
so type(cm).__enter__(cm) reaches the descriptor itself rather than a
bound wrapper, and __call__ rejected it. WorkerPool was affected: a pool
could not be composed onto a stack alongside other resources.

Record the owning class via __set_name__ and treat an owned descriptor
invoked with an instance of its owner as the bound call it actually is,
delegating through __get__ so the guard, the coroutine-ness, and the
wrapper cache all still apply. Class-level access keeps returning the
descriptor, so introspection is unchanged, and a bare function still has
no owner and is still rejected. Teardown works the same way: contextlib
registers exit as a method of the type, so a guarded __exit__ receives
its exception triple through the same path.
Pin the reported failure at both the utility and the WorkerPool level:
a guarded manager enters through ExitStack and AsyncExitStack, and the
guard still rejects a second entry there.

Guard the argument-forwarding half of the contract, which nothing
exercised. contextlib registers teardown as a method of the type, so a
guarded exit is routed through the descriptor with its exception triple
as trailing arguments; every prior test entered with no arguments at
all, so an implementation that dropped them silently passed. Cover the
exception details reaching a guarded exit through both stacks, and
argument forwarding on a direct unbound call.

Pin the guard as shared across the bound and unbound call forms, by
example and by a property over arbitrary interleavings of the two, so
the widened dispatch cannot become a way around single-use semantics.
Cover a subclass entering through a stack, since dispatch admits any
instance of the owning class rather than only exact instances, and the
plain statement form, which had no coverage of its own.

Rename the bare-function test to say what it asserts: it calls an owned
descriptor with no instance, which is a distinct rejection branch from a
genuinely unowned function. Drop the unbound-access test, whose only
assertion could not fail.
@wool-labs wool-labs Bot merged commit a4bedba into main Jul 13, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant