-
Notifications
You must be signed in to change notification settings - Fork 1.3k
cached_property issue / descriptor issue #1833
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
Comments
Thanks for the bug report, this definitely looks weird! I'll look into it. |
Oh, I think CPython calls |
Fixed (I think) in #1835 |
I don't know that much about the python spec / implementation in this regard, but my code works with #1835! Apart from that rfc a big thank you for your work! That was quick! Wow! |
I think that would be fine! As you said, testing a real world project on RustPython would definitely be a good kind of stress-test.
I actually just implemented that yesterday in #1834 😄. It should be merged soon. |
Feature
I have a class like this:
(For the exact implementation see ep12/PyOPM, but the implementation is not really important in this case.)
Something like
results in an error:
I think it might be related to the descriptor implementation, but
__set_name__
does not seem to be called using rustpython. Everything works fine with cpython and pypy.Since the
cached_property
implementation of rustpython and cpython is exactly the same, this might be an internal issue. I think thatcached_property.__set_name__
should be called withname=func.__name__
(which is'calculated_data'
, of course)... I think python itself performs this call (I could not find a line of python where__set_name__
gets called), so maybe the rustpython implementation does not do that at the moment.I haven't looked at the rustpython source code (my rust skills are extremely limited) but maybe someone else knows where to have a look...
Python Documentation
cpython doc: implementing descriptors
The text was updated successfully, but these errors were encountered: