Skip to content

Extract "Unsupported operand types" exception to separate method #199

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

Closed
BojanKogoj opened this issue Nov 17, 2018 · 2 comments
Closed

Extract "Unsupported operand types" exception to separate method #199

BojanKogoj opened this issue Nov 17, 2018 · 2 comments

Comments

@BojanKogoj
Copy link
Contributor

Returning exception in call_or_unsupported should be extracted to a separate method.
Also, use it to replace incorrect exceptions in objfloat.rs (and others).

This should fix wrong exceptions, such as

>>>>> 1.1 - "a"
Traceback (most recent call last):
  File <unknown>, line 0, in <module>
TypeError: Cannot add RefCell { value: [PyObj float 1.1] } and RefCell { value: [PyObj str "a"] }

should be

>>> 1.1 - "a"
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: unsupported operand type(s) for -: 'float' and 'str'
@cthulahoops
Copy link
Collaborator

The type error being raised in float_sub is wrong anyway? It should raise NotImplemented, which call_or_supported should turn into the correct type error.

I don't know if this is true in every case, but it feels like it probably is.

@OddCoincidence
Copy link
Contributor

This was done in #433, I think it can be closed.

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

No branches or pull requests

3 participants