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
f9c7772b
Commit
f9c7772b
authored
Feb 13, 2009
by
Dag Sverre Seljebotn
Browse files
Options
Browse Files
Download
Plain Diff
merge
parents
316ac8b4
3dc5ccb1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
82 additions
and
25 deletions
+82
-25
Cython/Compiler/PyrexTypes.py
Cython/Compiler/PyrexTypes.py
+58
-25
tests/errors/e_nosignword.pyx
tests/errors/e_nosignword.pyx
+24
-0
No files found.
Cython/Compiler/PyrexTypes.py
View file @
f9c7772b
...
...
@@ -462,9 +462,9 @@ class CNumericType(CType):
default_value
=
"0"
parsetuple_formats
=
(
# rank -> format
"BHIk
K??
???"
,
# unsigned
"bhil
L??
fd?"
,
# assumed signed
"bhil
L??
fd?"
,
# explicitly signed
"BHIk
??K
???"
,
# unsigned
"bhil
??L
fd?"
,
# assumed signed
"bhil
??L
fd?"
,
# explicitly signed
)
sign_words
=
(
"unsigned "
,
""
,
"signed "
)
...
...
@@ -593,12 +593,18 @@ class CPySSizeTType(CIntType):
to_py_function
=
"PyInt_FromSsize_t"
from_py_function
=
"__pyx_PyIndex_AsSsize_t"
def
sign_and_name
(
self
):
return
rank_to_type_name
[
self
.
rank
]
class
CSizeTType
(
CUIntType
):
to_py_function
=
"__pyx_PyInt_FromSize_t"
from_py_function
=
"__pyx_PyInt_AsSize_t"
def
sign_and_name
(
self
):
return
rank_to_type_name
[
self
.
rank
]
class
CFloatType
(
CNumericType
):
...
...
@@ -1157,9 +1163,9 @@ rank_to_type_name = (
"short"
,
# 1
"int"
,
# 2
"long"
,
# 3
"P
Y_LONG_LONG"
,
# 4
"
Py_ssize_t"
,
# 5
"
size_t"
,
# 6
"P
y_ssize_t"
,
# 4
"
size_t"
,
# 5
"
PY_LONG_LONG"
,
# 6
"float"
,
# 7
"double"
,
# 8
"long double"
,
# 9
...
...
@@ -1175,23 +1181,23 @@ c_uchar_type = CIntType(0, 0, "T_UBYTE")
c_ushort_type
=
CIntType
(
1
,
0
,
"T_USHORT"
)
c_uint_type
=
CUIntType
(
2
,
0
,
"T_UINT"
)
c_ulong_type
=
CULongType
(
3
,
0
,
"T_ULONG"
)
c_ulonglong_type
=
CULongLongType
(
4
,
0
,
"T_ULONGLONG"
)
c_ulonglong_type
=
CULongLongType
(
6
,
0
,
"T_ULONGLONG"
)
c_char_type
=
CIntType
(
0
,
1
,
"T_CHAR"
)
c_short_type
=
CIntType
(
1
,
1
,
"T_SHORT"
)
c_int_type
=
CIntType
(
2
,
1
,
"T_INT"
)
c_long_type
=
CIntType
(
3
,
1
,
"T_LONG"
)
c_longlong_type
=
CLongLongType
(
4
,
1
,
"T_LONGLONG"
)
c_longlong_type
=
CLongLongType
(
6
,
1
,
"T_LONGLONG"
)
c_bint_type
=
CBIntType
(
2
,
1
,
"T_INT"
)
c_schar_type
=
CIntType
(
0
,
2
,
"T_CHAR"
)
c_sshort_type
=
CIntType
(
1
,
2
,
"T_SHORT"
)
c_sint_type
=
CIntType
(
2
,
2
,
"T_INT"
)
c_slong_type
=
CIntType
(
3
,
2
,
"T_LONG"
)
c_slonglong_type
=
CLongLongType
(
4
,
2
,
"T_LONGLONG"
)
c_slonglong_type
=
CLongLongType
(
6
,
2
,
"T_LONGLONG"
)
c_py_ssize_t_type
=
CPySSizeTType
(
5
,
1
)
c_size_t_type
=
CSizeTType
(
6
,
1
,
"(sizeof(size_t) == sizeof(unsigned long) ? T_ULONG : T_ULONGLONG)
"
)
c_py_ssize_t_type
=
CPySSizeTType
(
4
,
2
,
"T_PYSSIZET"
)
c_size_t_type
=
CSizeTType
(
5
,
0
,
"T_SIZET
"
)
c_float_type
=
CFloatType
(
7
,
"T_FLOAT"
)
c_double_type
=
CFloatType
(
8
,
"T_DOUBLE"
)
...
...
@@ -1223,25 +1229,26 @@ sign_and_rank_to_type = {
(
0
,
1
):
c_ushort_type
,
(
0
,
2
):
c_uint_type
,
(
0
,
3
):
c_ulong_type
,
(
0
,
4
):
c_ulonglong_type
,
(
0
,
5
):
c_ulonglong_type
,
# XXX I'm not sure about this.
(
0
,
6
):
c_ulonglong_type
,
(
1
,
0
):
c_char_type
,
(
1
,
1
):
c_short_type
,
(
1
,
2
):
c_int_type
,
(
1
,
3
):
c_long_type
,
(
1
,
4
):
c_longlong_type
,
(
1
,
6
):
c_longlong_type
,
(
2
,
0
):
c_schar_type
,
(
2
,
1
):
c_sshort_type
,
(
2
,
2
):
c_sint_type
,
(
2
,
3
):
c_slong_type
,
(
2
,
4
):
c_slonglong_type
,
(
2
,
6
):
c_slonglong_type
,
(
1
,
5
):
c_py_ssize_t_type
,
(
2
,
5
):
c_py_ssize_t_type
,
(
0
,
6
):
c_size_t_type
,
(
1
,
6
):
c_size_t_type
,
(
0
,
4
):
c_py_ssize_t_type
,
(
1
,
4
):
c_py_ssize_t_type
,
(
2
,
4
):
c_py_ssize_t_type
,
(
0
,
5
):
c_size_t_type
,
(
1
,
5
):
c_size_t_type
,
(
2
,
5
):
c_size_t_type
,
(
1
,
7
):
c_float_type
,
(
1
,
8
):
c_double_type
,
...
...
@@ -1277,10 +1284,8 @@ modifiers_and_name_to_type = {
(
2
,
2
,
"int"
):
c_slonglong_type
,
(
1
,
0
,
"Py_ssize_t"
):
c_py_ssize_t_type
,
(
2
,
0
,
"Py_ssize_t"
):
c_py_ssize_t_type
,
(
0
,
0
,
"size_t"
)
:
c_size_t_type
,
(
1
,
0
,
"size_t"
)
:
c_size_t_type
,
(
1
,
0
,
"long"
):
c_long_type
,
(
1
,
0
,
"short"
):
c_short_type
,
(
1
,
0
,
"longlong"
):
c_longlong_type
,
...
...
@@ -1395,8 +1400,36 @@ type_conversion_predeclarations = """
static INLINE int __Pyx_PyObject_IsTrue(PyObject* x);
static INLINE PY_LONG_LONG __pyx_PyInt_AsLongLong(PyObject* x);
static INLINE unsigned PY_LONG_LONG __pyx_PyInt_AsUnsignedLongLong(PyObject* x);
static INLINE Py_ssize_t __pyx_PyIndex_AsSsize_t(PyObject* b);
#if !defined(T_PYSSIZET)
#if PY_VERSION_HEX < 0x02050000
#define T_PYSSIZET T_INT
#elif !defined(T_LONGLONG)
#define T_PYSSIZET
\
\
((sizeof(Py_ssize_t) == sizeof(int)) ? T_INT :
\
\
((sizeof(Py_ssize_t) == sizeof(long)) ? T_LONG : -1))
#else
#define T_PYSSIZET
\
\
((sizeof(Py_ssize_t) == sizeof(int)) ? T_INT :
\
\
((sizeof(Py_ssize_t) == sizeof(long)) ? T_LONG :
\
\
((sizeof(Py_ssize_t) == sizeof(PY_LONG_LONG)) ? T_LONGLONG : -1)))
#endif
#endif
#if !defined(T_SIZET)
#if !defined(T_ULONGLONG)
#define T_SIZET
\
\
((sizeof(size_t) == sizeof(unsigned int)) ? T_UINT :
\
\
((sizeof(size_t) == sizeof(unsigned long)) ? T_ULONG : -1))
#else
#define T_SIZET
\
\
((sizeof(size_t) == sizeof(unsigned int)) ? T_UINT :
\
\
((sizeof(size_t) == sizeof(unsigned long)) ? T_ULONG :
\
\
((sizeof(size_t) == sizeof(unsigned PY_LONG_LONG)) ? T_ULONGLONG : -1)))
#endif
#endif
static INLINE Py_ssize_t __pyx_PyIndex_AsSsize_t(PyObject* b);
static INLINE PyObject * __pyx_PyInt_FromSize_t(size_t);
static INLINE size_t __pyx_PyInt_AsSize_t(PyObject*);
...
...
@@ -1418,7 +1451,7 @@ static INLINE Py_ssize_t __pyx_PyIndex_AsSsize_t(PyObject* b) {
static INLINE PyObject * __pyx_PyInt_FromSize_t(size_t ival) {
#if PY_VERSION_HEX < 0x02050000
if (ival <=
(size_t)
LONG_MAX)
if (ival <= LONG_MAX)
return PyInt_FromLong((long)ival);
else {
unsigned char *bytes = (unsigned char *) &ival;
...
...
tests/errors/e_nosignword.pyx
0 → 100644
View file @
f9c7772b
cdef
signed
Py_ssize_t
a
cdef
unsigned
Py_ssize_t
b
cdef
signed
size_t
c
cdef
unsigned
size_t
d
cdef
signed
float
e
cdef
unsigned
float
f
cdef
signed
double
g
cdef
unsigned
double
h
cdef
signed
long
double
i
cdef
unsigned
long
double
j
_ERRORS
=
u"""
1:5: Unrecognised type modifier combination
2:5: Unrecognised type modifier combination
3:5: Unrecognised type modifier combination
4:5: Unrecognised type modifier combination
5:5: Unrecognised type modifier combination
6:5: Unrecognised type modifier combination
7:5: Unrecognised type modifier combination
8:5: Unrecognised type modifier combination
9:5: Unrecognised type modifier combination
10:5: Unrecognised type modifier combination
"""
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