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
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
cython
Commits
a97c7c10
Commit
a97c7c10
authored
May 27, 2010
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Plain Diff
merged in latest cython-devel
parents
25432a57
172daf17
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
38 additions
and
3 deletions
+38
-3
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+10
-2
Cython/Compiler/Nodes.py
Cython/Compiler/Nodes.py
+1
-1
tests/run/int_literals.pyx
tests/run/int_literals.pyx
+18
-0
tests/run/literals.pyx
tests/run/literals.pyx
+9
-0
No files found.
Cython/Compiler/ExprNodes.py
View file @
a97c7c10
...
...
@@ -792,11 +792,19 @@ class IntNode(ConstNode):
unsigned
=
""
longness
=
""
type
=
PyrexTypes
.
c_long_type
def
__init__
(
self
,
pos
,
**
kwds
):
ExprNode
.
__init__
(
self
,
pos
,
**
kwds
)
if
'type'
not
in
kwds
:
rank
=
max
(
1
,
len
(
self
.
longness
))
sign
=
not
self
.
unsigned
self
.
type
=
PyrexTypes
.
modifiers_and_name_to_type
[
sign
,
rank
,
"int"
]
def
coerce_to
(
self
,
dst_type
,
env
):
if
self
.
type
is
dst_type
:
return
self
elif
dst_type
.
is_float
:
return
FloatNode
(
self
.
pos
,
value
=
repr
(
float
(
self
.
value
)))
node
=
IntNode
(
self
.
pos
,
value
=
self
.
value
,
unsigned
=
self
.
unsigned
,
longness
=
self
.
longness
)
if
dst_type
.
is_numeric
and
not
dst_type
.
is_complex
:
...
...
@@ -5233,7 +5241,7 @@ class NumBinopNode(BinopNode):
return
if
self
.
type
.
is_complex
:
self
.
infix
=
False
if
not
self
.
infix
:
if
not
self
.
infix
or
(
type1
.
is_numeric
and
type2
.
is_numeric
)
:
self
.
operand1
=
self
.
operand1
.
coerce_to
(
self
.
type
,
env
)
self
.
operand2
=
self
.
operand2
.
coerce_to
(
self
.
type
,
env
)
...
...
Cython/Compiler/Nodes.py
View file @
a97c7c10
...
...
@@ -3490,7 +3490,7 @@ class InPlaceAssignmentNode(AssignmentNode):
import
ExprNodes
if
self
.
lhs
.
type
.
is_pyobject
:
self
.
rhs
=
self
.
rhs
.
coerce_to_pyobject
(
env
)
elif
self
.
rhs
.
type
.
is_pyobject
:
elif
self
.
rhs
.
type
.
is_pyobject
or
(
self
.
lhs
.
type
.
is_numeric
and
self
.
rhs
.
type
.
is_numeric
)
:
self
.
rhs
=
self
.
rhs
.
coerce_to
(
self
.
lhs
.
type
,
env
)
if
self
.
lhs
.
type
.
is_pyobject
:
self
.
result_value_temp
=
ExprNodes
.
PyTempNode
(
self
.
pos
,
env
)
...
...
tests/run/int_literals.pyx
View file @
a97c7c10
...
...
@@ -6,6 +6,7 @@ __doc__ = u"""
"""
import
sys
from
cython
cimport
typeof
if
sys
.
version_info
[
0
]
>=
3
:
__doc__
=
__doc__
.
replace
(
u'L'
,
u''
)
...
...
@@ -35,3 +36,20 @@ def large_literal():
return
0xFFFFFFFFFFFF
else
:
return
0xFFFFFFF
def
c_long_types
():
"""
>>> c_long_types()
long
long
long long
unsigned long
unsigned long
unsigned long long
"""
print
typeof
(
1
)
print
typeof
(
1L
)
print
typeof
(
1L
L
)
print
typeof
(
1
U
)
print
typeof
(
1
UL
)
print
typeof
(
1
ULL
)
tests/run/literals.pyx
View file @
a97c7c10
...
...
@@ -62,3 +62,12 @@ def test_complex(x):
True
"""
return x == 0.3333333333333333j
def test_large_int(double x):
"""
>>>
test_large_int
(
0
)
2e+100
"""
a = x + 10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
a += 10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
return a
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