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
Gwenaël Samain
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
Hide 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):
# 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
,
...
...
@@ -4135,4 +4135,4 @@ static inline PyObject* __Pyx_PyObject_Append(PyObject* L, PyObject* x) {
}
}
"""
,
""
]
\ No newline at end of file
]
tests/run/ct_DEF.pyx
View file @
d4d5dc49
__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
...
...
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