Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
cython
Commits
d4d5dc49
Commit
d4d5dc49
authored
May 08, 2008
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix for negative compile time int constants
parent
85021a88
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
2 deletions
+18
-2
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+2
-2
tests/run/ct_DEF.pyx
tests/run/ct_DEF.pyx
+16
-0
No files found.
Cython/Compiler/ExprNodes.py
View file @
d4d5dc49
...
@@ -2741,7 +2741,7 @@ def unop_node(pos, operator, operand):
...
@@ -2741,7 +2741,7 @@ def unop_node(pos, operator, operand):
# Construct unnop node of appropriate class for
# Construct unnop node of appropriate class for
# given operator.
# given operator.
if
isinstance
(
operand
,
IntNode
)
and
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
:
elif
isinstance
(
operand
,
UnopNode
)
and
operand
.
operator
==
operator
:
warning
(
pos
,
"Python has no increment/decrement operator: %s%sx = %s(%sx) = x"
%
((
operator
,)
*
4
),
5
)
warning
(
pos
,
"Python has no increment/decrement operator: %s%sx = %s(%sx) = x"
%
((
operator
,)
*
4
),
5
)
return
unop_node_classes
[
operator
](
pos
,
return
unop_node_classes
[
operator
](
pos
,
...
...
tests/run/ct_DEF.pyx
View file @
d4d5dc49
__doc__
=
"""
__doc__
=
"""
>>> c()
>>> c()
120
120
>>> i0() == -1
True
>>> i1() == 42
>>> i1() == 42
True
True
>>> i2() == 0x42
>>> i2() == 0x42
True
True
>>> i3() == 042
>>> i3() == 042
True
True
>>> i4() == -0x42
True
>>> l()
>>> l()
666
666
>>> f()
>>> f()
...
@@ -27,9 +31,11 @@ DEF TUPLE = (1, 2, "buckle my shoe")
...
@@ -27,9 +31,11 @@ DEF TUPLE = (1, 2, "buckle my shoe")
DEF
TRUE_FALSE
=
(
True
,
False
)
DEF
TRUE_FALSE
=
(
True
,
False
)
DEF
CHAR
=
c
'x'
DEF
CHAR
=
c
'x'
DEF
INT0
=
-
1
DEF
INT1
=
42
DEF
INT1
=
42
DEF
INT2
=
0x42
DEF
INT2
=
0x42
DEF
INT3
=
042
DEF
INT3
=
042
DEF
INT4
=
-
0x42
DEF
LONG
=
666L
DEF
LONG
=
666L
DEF
FLOAT
=
12.5
DEF
FLOAT
=
12.5
DEF
STR
=
"spam"
DEF
STR
=
"spam"
...
@@ -43,6 +49,11 @@ def c():
...
@@ -43,6 +49,11 @@ def c():
c
=
CHAR
c
=
CHAR
return
c
return
c
def
i0
():
cdef
int
i
i
=
INT0
return
i
def
i1
():
def
i1
():
cdef
int
i
cdef
int
i
i
=
INT1
i
=
INT1
...
@@ -58,6 +69,11 @@ def i3():
...
@@ -58,6 +69,11 @@ def i3():
i
=
INT3
i
=
INT3
return
i
return
i
def
i4
():
cdef
int
i
i
=
INT4
return
i
def
l
():
def
l
():
cdef
long
l
cdef
long
l
l
=
LONG
l
=
LONG
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment