Commit 53214925 authored by Robert Bradshaw's avatar Robert Bradshaw

...

parents b3c67d1d d4d5dc49
......@@ -2741,7 +2741,7 @@ def unop_node(pos, operator, operand):
# Construct unnop node of appropriate class for
# given operator.
if isinstance(operand, IntNode) and operator == '-':
return IntNode(pos = operand.pos, value = -int(operand.value))
return IntNode(pos = operand.pos, value = str(-int(operand.value, 0)))
elif isinstance(operand, UnopNode) and operand.operator == operator:
warning(pos, "Python has no increment/decrement operator: %s%sx = %s(%sx) = x" % ((operator,)*4), 5)
return unop_node_classes[operator](pos,
......
__doc__ = """
>>> c()
120
>>> i0() == -1
True
>>> i1() == 42
True
>>> i2() == 0x42
True
>>> i3() == 042
True
>>> i4() == -0x42
True
>>> l()
666
>>> f()
......@@ -27,9 +31,11 @@ DEF TUPLE = (1, 2, "buckle my shoe")
DEF TRUE_FALSE = (True, False)
DEF CHAR = c'x'
DEF INT0 = -1
DEF INT1 = 42
DEF INT2 = 0x42
DEF INT3 = 042
DEF INT4 = -0x42
DEF LONG = 666L
DEF FLOAT = 12.5
DEF STR = "spam"
......@@ -43,6 +49,11 @@ def c():
c = CHAR
return c
def i0():
cdef int i
i = INT0
return i
def i1():
cdef int i
i = INT1
......@@ -58,6 +69,11 @@ def i3():
i = INT3
return i
def i4():
cdef int i
i = INT4
return i
def l():
cdef long l
l = LONG
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment