-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Fix #1290: Py3.5's @ operator/assertion rewriting. #1361
Conversation
@pytest.mark.skipif("sys.version_info < (3,5)") | ||
def test_at_operator_issue1290(self): | ||
def f(): | ||
class Matrix: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess you will have to use eval
or exec
here to avoid syntax errors in Python versions < 3.5. 😁
Thanks a lot @tomviner! 😄 |
35d6bbf
to
552cfa7
Compare
@nicoddemus I've had another go with |
552cfa7
to
f63b706
Compare
|
||
def test_multmat_operator(): | ||
assert Matrix(2) @ Matrix(3) == 42""") | ||
testdir.runpytest().assert_outcomes(failed=1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm doesn't this test also pass if you take out your fix in rewrite.py
? Wouldn't be better to make the the inner test pass?
f63b706
to
7d10701
Compare
@nicoddemus good point, I got confused in thinking that a failing inner test was required to engage the rewrite code, but that's obviously not true as shown in @Shinkenjoe's original test case. Changed. |
Excellent, thanks! 😄 |
Fix for #1290
Support
ast.MatMult
when it's present. And add a test that runs on Python 3.5+. See PEP 465 -- A dedicated infix operator for matrix multiplication