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

[BUG] rshift overflow #6148

Open
yahahawork opened this issue Apr 19, 2024 · 0 comments
Open

[BUG] rshift overflow #6148

yahahawork opened this issue Apr 19, 2024 · 0 comments

Comments

@yahahawork
Copy link

yahahawork commented Apr 19, 2024

Describe the bug

When rshift a int in class, it may overflow. Same code in Linux no problem.

Code to reproduce the behaviour:

class Test(object):

    def __init__(self) -> None:
        self.v = 0

    def values(self) -> list[int]:
        _v = [0] * 4
        _v[0] = self.v
        _v[1] = self.v >> 8
        _v[2] = self.v >> 32
        _v[3] = self.v >> 40
        return _v

Expected behaviour

t = Test()
t.v = 1

print(t.values())

in pure python, it shows [1, 0, 0, 0]
in cython, it shows [1, 0, 1, 0]

OS

windows

Python version

3.11

Cython version

3.0.10

Additional context

No response

@yahahawork yahahawork changed the title [BUG?] int rshift overflow [BUG] rshift overflow Apr 19, 2024
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

1 participant