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
Kirill Smelkov
cython
Commits
f5a4c935
Commit
f5a4c935
authored
Nov 25, 2017
by
scoder
Committed by
GitHub
Nov 25, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2016 from jdemeyer/libc_limits
Fix types of values in libc.limits
parents
2fc2cba0
e9126671
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
25 deletions
+34
-25
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+5
-1
Cython/Includes/libc/limits.pxd
Cython/Includes/libc/limits.pxd
+19
-20
tests/run/fstring.pyx
tests/run/fstring.pyx
+10
-4
No files found.
Cython/Compiler/ExprNodes.py
View file @
f5a4c935
...
...
@@ -2074,7 +2074,11 @@ class NameNode(AtomicExprNode):
def
check_const
(
self
):
entry
=
self
.
entry
if
entry
is
not
None
and
not
(
entry
.
is_const
or
entry
.
is_cfunction
or
entry
.
is_builtin
):
if
entry
is
not
None
and
not
(
entry
.
is_const
or
entry
.
is_cfunction
or
entry
.
is_builtin
or
entry
.
type
.
is_const
):
self
.
not_const
()
return
False
return
True
...
...
Cython/Includes/libc/limits.pxd
View file @
f5a4c935
# 5.2.4.2.1 Sizes of integer types <limits.h>
cdef
extern
from
"<limits.h>"
:
const
int
CHAR_BIT
const
int
MB_LEN_MAX
enum
:
CHAR_BIT
enum
:
MB_LEN
_MAX
const
char
CHAR_MIN
const
char
CHAR
_MAX
enum
:
CHAR_MIN
enum
:
CHAR_MAX
const
signed
char
SCHAR_MIN
const
signed
char
SCHAR_MAX
const
unsigned
char
UCHAR_MAX
enum
:
SCHAR
_MIN
enum
:
SCHAR
_MAX
enum
:
UCHAR
_MAX
const
short
SHRT
_MIN
const
short
SHRT
_MAX
const
unsigned
short
USHRT
_MAX
enum
:
SHR
T_MIN
enum
:
SHR
T_MAX
enum
:
USHR
T_MAX
const
int
IN
T_MIN
const
int
IN
T_MAX
const
unsigned
int
UIN
T_MAX
enum
:
INT
_MIN
enum
:
INT
_MAX
enum
:
UINT
_MAX
const
long
LONG
_MIN
const
long
LONG
_MAX
const
unsigned
long
ULONG
_MAX
enum
:
LONG_MIN
enum
:
LONG_MAX
enum
:
ULONG_MAX
enum
:
LLONG_MIN
enum
:
LLONG_MAX
enum
:
ULLONG_MAX
const
long
long
LLONG_MIN
const
long
long
LLONG_MAX
const
unsigned
long
long
ULLONG_MAX
tests/run/fstring.pyx
View file @
f5a4c935
...
...
@@ -10,10 +10,7 @@ cimport cython
import
sys
IS_PYPY
=
hasattr
(
sys
,
'pypy_version_info'
)
cdef
extern
from
*
:
int
INT_MAX
long
LONG_MAX
long
LONG_MIN
from
libc.limits
cimport
INT_MAX
,
LONG_MAX
,
LONG_MIN
max_int
=
INT_MAX
max_long
=
LONG_MAX
...
...
@@ -149,6 +146,15 @@ def format_c_numbers_max(int n, long l):
return
s1
,
s2
def
format_c_number_const
():
"""
>>> s = format_c_number_const()
>>> s == '{0}'.format(max_long) or s
True
"""
return
f"
{
LONG_MAX
}
"
def
format_c_number_range
(
int
n
):
"""
>>> for i in range(-1000, 1000):
...
...
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