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
3d420e67
Commit
3d420e67
authored
Sep 06, 2015
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '0.23.x'
Conflicts: CHANGES.rst
parents
3f6a6a59
7d72ea6f
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
17 additions
and
29 deletions
+17
-29
CHANGES.rst
CHANGES.rst
+2
-2
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+13
-13
Cython/Compiler/Parsing.py
Cython/Compiler/Parsing.py
+2
-4
Cython/Utils.py
Cython/Utils.py
+0
-10
No files found.
CHANGES.rst
View file @
3d420e67
...
...
@@ -49,8 +49,8 @@ Bugs fixed
* C++ destructor calls could fail when '&' operator is overwritten.
*
Large integers in compile-time evaluated DEF expressions wer
e
incorrectly handled under Python 2.x
.
*
Incorrect C literal generation for large integers in compile-tim
e
evaluated DEF expressions and constant folded expressions
.
* Byte string constants could end up as Unicode strings when originating
from compile-time evaluated DEF expressions.
...
...
Cython/Compiler/ExprNodes.py
View file @
3d420e67
...
...
@@ -1148,19 +1148,13 @@ class IntNode(ConstNode):
return
FloatNode
(
self
.
pos
,
value
=
self
.
value
,
type
=
dst_type
,
constant_result
=
not_a_constant
)
if
dst_type
.
is_numeric
and
not
dst_type
.
is_complex
:
unsigned
=
self
.
unsigned
if
not
unsigned
and
dst_type
.
is_int
and
not
dst_type
.
signed
:
# mark positive literals as 'U' when coercing them to unsigned integer types
# to extend their potential value range in the C code
if
self
.
has_constant_result
()
and
self
.
constant_result
>
0
:
unsigned
=
'U'
node
=
IntNode
(
self
.
pos
,
value
=
self
.
value
,
constant_result
=
self
.
constant_result
,
type
=
dst_type
,
is_c_literal
=
True
,
unsigned
=
unsigned
,
longness
=
self
.
longness
)
unsigned
=
self
.
unsigned
,
longness
=
self
.
longness
)
return
node
elif
dst_type
.
is_pyobject
:
node
=
IntNode
(
self
.
pos
,
value
=
self
.
value
,
constant_result
=
self
.
constant_result
,
type
=
PyrexTypes
.
py_object_type
,
is_c_literal
=
False
,
type
=
PyrexTypes
.
py_object_type
,
is_c_literal
=
False
,
unsigned
=
self
.
unsigned
,
longness
=
self
.
longness
)
else
:
# FIXME: not setting the type here to keep it working with
...
...
@@ -1193,11 +1187,17 @@ class IntNode(ConstNode):
def
value_as_c_integer_string
(
self
):
value
=
self
.
value
if
len
(
value
)
>
2
:
# convert C-incompatible Py3 oct/bin notations
if
value
[
1
]
in
'oO'
:
value
=
value
[
0
]
+
value
[
2
:]
# '0o123' => '0123'
elif
value
[
1
]
in
'bB'
:
if
value
[
0
]
==
'0'
:
literal_type
=
value
[
1
]
# 0'o' - 0'b' - 0'x'
# 0x123 hex literals and 0123 octal literals work nicely in C
# but convert C-incompatible Py3 oct/bin notations
if
literal_type
in
'oO'
:
value
=
'0'
+
value
[
2
:]
# '0o123' => '0123'
elif
literal_type
in
'bB'
:
value
=
int
(
value
[
2
:],
2
)
elif
value
.
isdigit
()
and
not
self
.
unsigned
and
not
self
.
longness
:
# C compilers do not consider unsigned types for decimal literals, but they do for hex
value
=
'0x%X'
%
int
(
value
)
return
str
(
value
)
def
calculate_result_code
(
self
):
...
...
Cython/Compiler/Parsing.py
View file @
3d420e67
...
...
@@ -762,8 +762,7 @@ def wrap_compile_time_constant(pos, value):
elif
isinstance
(
value
,
bool
):
return
ExprNodes
.
BoolNode
(
pos
,
value
=
value
)
elif
isinstance
(
value
,
int
):
return
ExprNodes
.
IntNode
(
pos
,
value
=
rep
,
constant_result
=
value
,
longness
=
Utils
.
longness_of
(
value
))
return
ExprNodes
.
IntNode
(
pos
,
value
=
rep
,
constant_result
=
value
)
elif
isinstance
(
value
,
float
):
return
ExprNodes
.
FloatNode
(
pos
,
value
=
rep
,
constant_result
=
value
)
elif
isinstance
(
value
,
_unicode
):
...
...
@@ -780,8 +779,7 @@ def wrap_compile_time_constant(pos, value):
# error already reported
return
None
elif
not
_IS_PY3
and
isinstance
(
value
,
long
):
return
ExprNodes
.
IntNode
(
pos
,
value
=
rep
.
rstrip
(
'L'
),
longness
=
Utils
.
longness_of
(
value
),
constant_result
=
value
)
return
ExprNodes
.
IntNode
(
pos
,
value
=
rep
.
rstrip
(
'L'
),
constant_result
=
value
)
error
(
pos
,
"Invalid type for compile-time constant: %r (type %s)"
%
(
value
,
value
.
__class__
.
__name__
))
return
None
...
...
Cython/Utils.py
View file @
3d420e67
...
...
@@ -319,16 +319,6 @@ def long_literal(value):
return
not
-
2
**
31
<=
value
<
2
**
31
def
longness_of
(
value
):
if
isinstance
(
value
,
basestring
):
value
=
str_to_number
(
value
)
if
-
2
**
15
<=
value
<
2
**
15
:
return
''
if
-
2
**
31
<=
value
<
2
**
31
:
return
'L'
return
'LL'
@
cached_function
def
get_cython_cache_dir
():
"""get the cython cache dir
...
...
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