-
Notifications
You must be signed in to change notification settings - Fork 48
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
Python 3.10: TypeError: __add__() got an unexpected keyword argument 'context' #25
Comments
Which version of RP2 are you using? If not the latest, could you upgrade and try again? Also make sure the example ODS and config are the latest version. |
I set everything up yesterday and was using 0.9.29 installed with |
It looks like you are overriding Decimal.__add__() but do not provide the and then being called virtually https://github.com/python/cpython/blob/f33e2c87a83917b5139d97fd8ef7cba7223ebef5/Lib/_pydecimal.py#L1257 (this goes back until at least 3.7) not sure why it would work for others--if that's the case--though. |
Interesting: haven't seen that before. The crypto_example.ods test is ran as part of continuous integration at every checkin on Python 3.7, 3.8, 3.9 and on Linux, Windows and Mac. A few more questions:
|
Updates signature of `RP2Decimal.__add__()` to allow the `context` param which is being invoked at https://github.com/python/cpython/blob/f33e2c87a83917b5139d97fd8ef7cba7223ebef5/Lib/_pydecimal.py#L1257 Fixes eprbell#25
Can confirm elevating that signature of RP2Decimal.py fixes it, (PR at #28) ArchLinux, I used a clean virtualenv with Python3.10 that came with the OS. |
The unit tests are failing in the PR:
The context is probably something that got added in Python 3.10 (unit tests are running on 3.7, 3.8 and 3.9). |
Odd, I see it in 3.7 as well https://github.com/python/cpython/blob/3.7/Lib/_pydecimal.py#L1157 |
Is there some sort of non-strict mode in Python that would allow extra arguments in this particular instance even though it's not part of the signature? |
Not sure... but it looks like RP2 is not working yet on Python 3.10. If you find a way to make the PR work in a backward compatible way, I'll accept it. For now the (not ideal) workaround is to use Python 3.9. |
I tried with Python 3.10 on my personal machine and I couldn't repro this problem. I also added Python 3.10 to continuous integration on Windows, Mac and Linux and it all works well (see 0d7b01a). I think the issue you are seeing might be due to some specific problem with your Python installation. |
Here is continuous integration running on Python 3.10:
You may want to try uninstalling python and reinstalling it. |
I don't think there is anything else actionable on this issue. OK to close? |
FWIW, I think it has to due with the fact that there are two possible backends for the decimal module, see cpython/Lib/decimal.py. I confirmed that on Arch Linux it's loading from |
Found it!
...and TLDR: |
Fantastic! Thanks for the good detective work :-) |
I filed a bug against Python; maybe this could be fixed upstream. |
Good idea. If you also want to submit a PR to add the dependency for RP2 I'll approve it. |
This should now be resolved (see #108). |
Running the example i'm getting this error (tested with Python3.9 and Python3.10)
The text was updated successfully, but these errors were encountered: