Skip to content

Fix stubbing of callable module descriptors like numpy.vstack#120

Merged
kaste merged 1 commit intomasterfrom
reg-np-119
Mar 10, 2026
Merged

Fix stubbing of callable module descriptors like numpy.vstack#120
kaste merged 1 commit intomasterfrom
reg-np-119

Conversation

@kaste
Copy link
Owner

@kaste kaste commented Mar 10, 2026

When validating method stubs, callable objects exposing get were treated as non-callable to keep class-descriptor attributes on the property stubbing path. NumPy's _ArrayFunctionDispatcher (used by np.vstack) matches that shape, so method stubbing regressed with "is not callable".

Pass the active spec into _should_continue_with_stubbed_invocation() and compute descriptor handling inside the helper. Keep the class-spec behavior, but allow callable descriptor-like values for non-class specs (e.g. modules).

Add a numpy regression test that stubs np.vstack.

Ref #119

When validating method stubs, callable objects exposing __get__ were
treated as non-callable to keep class-descriptor attributes on the
property stubbing path. NumPy's _ArrayFunctionDispatcher (used by
`np.vstack`) matches that shape, so method stubbing regressed with
"is not callable".

Pass the active spec into _should_continue_with_stubbed_invocation()
and compute descriptor handling inside the helper. Keep the class-spec
behavior, but allow callable descriptor-like values for non-class specs
(e.g. modules).

Add a numpy regression test that stubs np.vstack.

Ref #119
@kaste kaste merged commit 182b916 into master Mar 10, 2026
50 checks passed
@kaste kaste deleted the reg-np-119 branch March 10, 2026 19:34
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