New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Default arguments in methods are not preserved for introspection #4061
Comments
I think the underlying cause of this is a known limitation cython/Cython/Compiler/ExprNodes.py Lines 9375 to 9380 in 8609e0f
It might be possible to change it to make the introspection work without using the |
|
Sorry, can you please explain why |
For the global
The
i.e. extract the defaults from the introspectable variable stored on the CyFunction. For the
Thus it does not have access the the defaults field stored in the
None of this is insurmountable, but it's defined like that for historic reasons (and to keep the implementation looking basically the same whether the is generated with |
out of curiosity: can Cython generate some equivalent of this as a workaround (with preserving identity of default values):
|
Yes - having read-only default values that only exist for introspection (i.e. aren't read during the function call) is probably the easiest fix in the short-term. |
It looks like the versions we make make available for introspection are different from the values used in the implementation anyway so there's really very little reason not to populate the attributes. |
I can try to fix this if somebody can point me to the right direction :) |
It will be around the comment that I linked to. I think you will need to make sure that You don't want to change is |
ok, if my reading of the code is correct, this block should become:
so |
That looks reasonable to me (but that doesn't guarantee it works!) |
At glance with this change simple test now outputs correct signature. Will try with more exhaustive testing tomorrow. |
Tried on the latest master:
The text was updated successfully, but these errors were encountered: