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
371b92f2
Commit
371b92f2
authored
May 26, 2010
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Plain Diff
merged in latest cython-devel
parents
0ca78ef8
d8952731
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
5 deletions
+20
-5
Cython/Compiler/Code.py
Cython/Compiler/Code.py
+3
-1
Cython/Compiler/Parsing.py
Cython/Compiler/Parsing.py
+7
-4
tests/run/int_literals.pyx
tests/run/int_literals.pyx
+10
-0
No files found.
Cython/Compiler/Code.py
View file @
371b92f2
...
...
@@ -537,7 +537,7 @@ class GlobalState(object):
# constant handling at code generation time
def get_int_const(self, str_value, longness=False):
longness = bool(longness
or Utils.long_literal(str_value)
)
longness = bool(longness)
try:
c = self.int_const_index[(str_value, longness)]
except KeyError:
...
...
@@ -717,6 +717,8 @@ class GlobalState(object):
decls_writer.putln("
static
PyObject
*%
s
;
" % cname)
if longness:
function = '%s = PyLong_FromString((char *)"
%
s
", 0, 0); %s;'
elif Utils.long_literal(value):
function = '%s = PyInt_FromString((char *)"
%
s
", 0, 0); %s;'
else:
function = "
%
s
=
PyInt_FromLong
(
%
s
);
%
s
;
"
init_globals = self.parts['init_globals']
...
...
Cython/Compiler/Parsing.py
View file @
371b92f2
...
...
@@ -1308,7 +1308,7 @@ def p_for_bounds(s, allow_testlist=True):
s
.
next
()
iterator
=
p_for_iterator
(
s
,
allow_testlist
)
return
{
'target'
:
target
,
'iterator'
:
iterator
}
el
s
e
:
el
if
not
s
.
in_python_fil
e
:
if
s
.
sy
==
'from'
:
s
.
next
()
bound1
=
p_bit_expr
(
s
)
...
...
@@ -1340,6 +1340,9 @@ def p_for_bounds(s, allow_testlist=True):
'relation2'
:
rel2
,
'bound2'
:
bound2
,
'step'
:
step
}
else
:
s
.
expect
(
'in'
)
return
{}
def
p_for_from_relation
(
s
):
if
s
.
sy
in
inequality_relations
:
...
...
@@ -1641,7 +1644,7 @@ def p_statement(s, ctx, first_statement = 0):
return
node
else
:
if
ctx
.
api
:
error
(
s
.
pos
,
"'api' not allowed with this statement"
)
s
.
error
(
"'api' not allowed with this statement"
)
elif
s
.
sy
==
'def'
:
# def statements aren't allowed in pxd files, except
# as part of a cdef class
...
...
@@ -1704,7 +1707,7 @@ def p_suite(s, ctx = Ctx(), with_doc = 0, with_pseudo_doc = 0):
s
.
expect_dedent
()
else
:
if
ctx
.
api
:
error
(
s
.
pos
,
"'api' not allowed with this statement"
)
s
.
error
(
"'api' not allowed with this statement"
)
if
ctx
.
level
in
(
'module'
,
'class'
,
'function'
,
'other'
):
body
=
p_simple_statement_list
(
s
,
ctx
)
else
:
...
...
@@ -2428,7 +2431,7 @@ def p_c_func_or_var_declaration(s, pos, ctx):
overridable
=
ctx
.
overridable
)
else
:
#if api:
#
error(s.pos,
"'api' not allowed with variable declaration")
#
s.error(
"'api' not allowed with variable declaration")
declarators
=
[
declarator
]
while
s
.
sy
==
','
:
s
.
next
()
...
...
tests/run/int_literals.pyx
View file @
371b92f2
...
...
@@ -25,3 +25,13 @@ def c_longs():
def
py_longs
():
return
1
,
1L
,
100000000000000000000000000000000
,
-
100000000000000000000000000000000
def
large_literal
():
"""
>>> type(large_literal()) is int
True
"""
if
sys
.
version_info
[
0
]
>=
3
or
sys
.
maxint
>
0xFFFFFFFFFFFF
:
return
0xFFFFFFFFFFFF
else
:
return
0xFFFFFFF
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