Skip to content
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

Performance optimization of &-operator causes miscalculation #3258

Closed
Baekalfen opened this issue Dec 4, 2019 · 1 comment
Closed

Performance optimization of &-operator causes miscalculation #3258

Baekalfen opened this issue Dec 4, 2019 · 1 comment
Milestone

Comments

@Baekalfen
Copy link

@Baekalfen Baekalfen commented Dec 4, 2019

Commit 6d9daa0 causes a wrong result to be calculated in the example below. There seems to be something with the negative number, which makes it act unexpectedly.

This code snippet prints 1:

x = -1
x &= 0xFF
print(x)

Before the commit, the code above would print 255, which is also the case in CPython and PyPy without Cython.

@scoder
Copy link
Contributor

@scoder scoder commented Dec 24, 2019

Right, looks like there was a test missing for negative numbers. PR welcome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

2 participants
You can’t perform that action at this time.