callidus / tinypy

Automatically exported from code.google.com/p/tinypy
Other
0 stars 0 forks source link

Improper results of bitwise operator |, |=, and &= #21

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

for example, running the following script:
-------------------------
num = 0
num = num | 1
print(num)

num = 0
num |= 1
print(num)

num = 0
num &= 1
print(num)
-------------------------

What is the expected output? What do you see instead?

The expected results should be:
1
1
0
But tinypy output exceptions for those bitwise operators. For | and |=, the
exception is:
Exception:
error: tokenize
   6: num |= 1
          ^
For &= operator, the exception is:
Exception:
tp_get: KeyError: nud

Please use labels and text to provide additional information.

The problem jump out in revision 74 of tinypy. I haven't tested it on other
versions. But I guess the problem still exists on previous versions.

Besides, My operation system is  Microsoft Windows XP [version 5.1.2600].
And I compiled tinypy under mingw.

Original issue reported on code.google.com by ybc2084@gmail.com on 30 Jun 2008 at 8:39

GoogleCodeExporter commented 9 years ago
Does the attached patch (against revision 74) fix it?

Original comment by allef...@gmail.com on 30 Jun 2008 at 6:15

Attachments:

GoogleCodeExporter commented 9 years ago
Confirming that your patch fixes the issue (Slackware Linux and Windows XP 
under mingw).

Original comment by denis.ka...@gmail.com on 4 Jul 2008 at 6:18

GoogleCodeExporter commented 9 years ago
Attached another patch replacing the previous, this time also fixing ^ and ^= 
which
also were missing.

Original comment by allef...@gmail.com on 6 Jul 2008 at 8:10

Attachments:

GoogleCodeExporter commented 9 years ago
Ok, should be fixed as of revision 84.

Original comment by allef...@gmail.com on 18 Jul 2008 at 5:08