expect_same("000000000000007", 7)
expect_same("000000000000008.", 8.)
expect_same("000000000000009.", 9.)
+
+# Verify treatment of unary minus on negative numbers SF bug #660455
+expect_same("0xffffffff", -1)
+expect_same("-0xffffffff", 1)
Release date: XX-XXX-2003
============================
+- Through a bytecode optimizer bug (and I bet you didn't even know
+ Python *had* a bytecode optimizer :-), "unsigned" hex/oct constants
+ with a leading minus sign would come out with the wrong sign.
+ ("Unsigned" hex/oct constants are those with a face value in the
+ range sys.maxint+1 through sys.maxint*2+1, inclusive; these have
+ always been interpreted as negative numbers through sign folding.)
+ E.g. 0xffffffff is -1, and -(0xffffffff) is 1, but -0xffffffff would
+ come out as -4294967295. This was the case in Python 2.2 through
+ 2.2.2 and 2.3a1, and in Python 2.4 it will once again have that
+ value, but according to PEP 237 it really needs to be 1 in Python
+ 2.2.3 and 2.3. (SF #660455)
+
- SF bug #678518: fix some bugs in the parser module.
- Bastion.py and rexec.py are disabled. These modules are not safe in
&& NCH(ppower) == 1
&& TYPE((patom = CHILD(ppower, 0))) == atom
&& TYPE((pnum = CHILD(patom, 0))) == NUMBER
- && !(childtype == MINUS && is_float_zero(STR(pnum)))) {
+ && !(childtype == MINUS &&
+ (STR(pnum)[0] == '0' || is_float_zero(STR(pnum))))) {
if (childtype == TILDE) {
com_invert_constant(c, pnum);
return;