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
e5778e20
Commit
e5778e20
authored
Feb 09, 2011
by
Lisandro Dalcin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Python 3.2 now uses new C integral type Py_hash_t
parent
47f180f3
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
26 additions
and
2 deletions
+26
-2
Cython/Compiler/Builtin.py
Cython/Compiler/Builtin.py
+1
-1
Cython/Compiler/ModuleNode.py
Cython/Compiler/ModuleNode.py
+9
-0
Cython/Compiler/PyrexTypes.py
Cython/Compiler/PyrexTypes.py
+12
-0
Cython/Compiler/TypeSlots.py
Cython/Compiler/TypeSlots.py
+4
-1
No files found.
Cython/Compiler/Builtin.py
View file @
e5778e20
...
@@ -366,7 +366,7 @@ builtin_function_table = [
...
@@ -366,7 +366,7 @@ builtin_function_table = [
BuiltinFunction
(
'getattr3'
,
"OOO"
,
"O"
,
"__Pyx_GetAttr3"
,
"getattr"
,
BuiltinFunction
(
'getattr3'
,
"OOO"
,
"O"
,
"__Pyx_GetAttr3"
,
"getattr"
,
utility_code
=
getattr3_utility_code
),
# Pyrex compatibility
utility_code
=
getattr3_utility_code
),
# Pyrex compatibility
BuiltinFunction
(
'hasattr'
,
"OO"
,
"b"
,
"PyObject_HasAttr"
),
BuiltinFunction
(
'hasattr'
,
"OO"
,
"b"
,
"PyObject_HasAttr"
),
BuiltinFunction
(
'hash'
,
"O"
,
"
l
"
,
"PyObject_Hash"
),
BuiltinFunction
(
'hash'
,
"O"
,
"
h
"
,
"PyObject_Hash"
),
#('hex', "", "", ""),
#('hex', "", "", ""),
#('id', "", "", ""),
#('id', "", "", ""),
#('input', "", "", ""),
#('input', "", "", ""),
...
...
Cython/Compiler/ModuleNode.py
View file @
e5778e20
...
@@ -610,6 +610,15 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
...
@@ -610,6 +610,15 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
#define PyBoolObject PyLongObject
#define PyBoolObject PyLongObject
#endif
#endif
#if PY_VERSION_HEX < 0x03020000
typedef long Py_hash_t;
#define __Pyx_PyInt_FromHash_t PyInt_FromLong
#define __Pyx_PyInt_AsHash_t PyInt_AsLong
#else
#define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
#define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t
#endif
"""
)
"""
)
code
.
put
(
"""
code
.
put
(
"""
...
...
Cython/Compiler/PyrexTypes.py
View file @
e5778e20
...
@@ -1056,6 +1056,14 @@ static CYTHON_INLINE Py_UNICODE __Pyx_PyObject_AsPy_UNICODE(PyObject* x) {
...
@@ -1056,6 +1056,14 @@ static CYTHON_INLINE Py_UNICODE __Pyx_PyObject_AsPy_UNICODE(PyObject* x) {
'''
)
'''
)
class
CPyHashTType
(
CIntType
):
to_py_function
=
"__Pyx_PyInt_FromHash_t"
from_py_function
=
"__Pyx_PyInt_AsHash_t"
def
sign_and_name
(
self
):
return
"Py_hash_t"
class
CPySSizeTType
(
CIntType
):
class
CPySSizeTType
(
CIntType
):
to_py_function
=
"PyInt_FromSsize_t"
to_py_function
=
"PyInt_FromSsize_t"
...
@@ -2381,6 +2389,7 @@ c_returncode_type = CReturnCodeType(RANK_INT)
...
@@ -2381,6 +2389,7 @@ c_returncode_type = CReturnCodeType(RANK_INT)
c_bint_type
=
CBIntType
(
RANK_INT
)
c_bint_type
=
CBIntType
(
RANK_INT
)
c_py_unicode_type
=
CPyUnicodeIntType
(
RANK_INT
-
0.5
,
UNSIGNED
)
c_py_unicode_type
=
CPyUnicodeIntType
(
RANK_INT
-
0.5
,
UNSIGNED
)
c_py_ucs4_type
=
CPyUCS4IntType
(
RANK_LONG
-
0.5
,
UNSIGNED
)
c_py_ucs4_type
=
CPyUCS4IntType
(
RANK_LONG
-
0.5
,
UNSIGNED
)
c_py_hash_t_type
=
CPyHashTType
(
RANK_LONG
+
0.5
,
SIGNED
)
c_py_ssize_t_type
=
CPySSizeTType
(
RANK_LONG
+
0.5
,
SIGNED
)
c_py_ssize_t_type
=
CPySSizeTType
(
RANK_LONG
+
0.5
,
SIGNED
)
c_ssize_t_type
=
CSSizeTType
(
RANK_LONG
+
0.5
,
SIGNED
)
c_ssize_t_type
=
CSSizeTType
(
RANK_LONG
+
0.5
,
SIGNED
)
c_size_t_type
=
CSizeTType
(
RANK_LONG
+
0.5
,
UNSIGNED
)
c_size_t_type
=
CSizeTType
(
RANK_LONG
+
0.5
,
UNSIGNED
)
...
@@ -2443,6 +2452,7 @@ modifiers_and_name_to_type = {
...
@@ -2443,6 +2452,7 @@ modifiers_and_name_to_type = {
(
1
,
0
,
"bint"
):
c_bint_type
,
(
1
,
0
,
"bint"
):
c_bint_type
,
(
0
,
0
,
"Py_UNICODE"
):
c_py_unicode_type
,
(
0
,
0
,
"Py_UNICODE"
):
c_py_unicode_type
,
(
0
,
0
,
"Py_UCS4"
):
c_py_ucs4_type
,
(
0
,
0
,
"Py_UCS4"
):
c_py_ucs4_type
,
(
2
,
0
,
"Py_hash_t"
):
c_py_hash_t_type
,
(
2
,
0
,
"Py_ssize_t"
):
c_py_ssize_t_type
,
(
2
,
0
,
"Py_ssize_t"
):
c_py_ssize_t_type
,
(
2
,
0
,
"ssize_t"
)
:
c_ssize_t_type
,
(
2
,
0
,
"ssize_t"
)
:
c_ssize_t_type
,
(
0
,
0
,
"size_t"
)
:
c_size_t_type
,
(
0
,
0
,
"size_t"
)
:
c_size_t_type
,
...
@@ -2692,6 +2702,8 @@ def parse_basic_type(name):
...
@@ -2692,6 +2702,8 @@ def parse_basic_type(name):
signed
=
0
signed
=
0
elif
name
==
'Py_UCS4'
:
elif
name
==
'Py_UCS4'
:
signed
=
0
signed
=
0
elif
name
==
'Py_hash_t'
:
signed
=
2
elif
name
==
'Py_ssize_t'
:
elif
name
==
'Py_ssize_t'
:
signed
=
2
signed
=
2
elif
name
==
'ssize_t'
:
elif
name
==
'ssize_t'
:
...
...
Cython/Compiler/TypeSlots.py
View file @
e5778e20
...
@@ -32,6 +32,7 @@ class Signature(object):
...
@@ -32,6 +32,7 @@ class Signature(object):
# 'b' bint
# 'b' bint
# 'I' int *
# 'I' int *
# 'l' long
# 'l' long
# 'h' Py_hash_t
# 'z' Py_ssize_t
# 'z' Py_ssize_t
# 'Z' Py_ssize_t *
# 'Z' Py_ssize_t *
# 's' char *
# 's' char *
...
@@ -52,6 +53,7 @@ class Signature(object):
...
@@ -52,6 +53,7 @@ class Signature(object):
'b'
:
PyrexTypes
.
c_bint_type
,
'b'
:
PyrexTypes
.
c_bint_type
,
'I'
:
PyrexTypes
.
c_int_ptr_type
,
'I'
:
PyrexTypes
.
c_int_ptr_type
,
'l'
:
PyrexTypes
.
c_long_type
,
'l'
:
PyrexTypes
.
c_long_type
,
'h'
:
PyrexTypes
.
c_py_hash_t_type
,
'z'
:
PyrexTypes
.
c_py_ssize_t_type
,
'z'
:
PyrexTypes
.
c_py_ssize_t_type
,
'Z'
:
PyrexTypes
.
c_py_ssize_t_ptr_type
,
'Z'
:
PyrexTypes
.
c_py_ssize_t_ptr_type
,
's'
:
PyrexTypes
.
c_char_ptr_type
,
's'
:
PyrexTypes
.
c_char_ptr_type
,
...
@@ -69,6 +71,7 @@ class Signature(object):
...
@@ -69,6 +71,7 @@ class Signature(object):
'b'
:
"-1"
,
'b'
:
"-1"
,
'l'
:
"-1"
,
'l'
:
"-1"
,
'r'
:
"-1"
,
'r'
:
"-1"
,
'h'
:
"-1"
,
'z'
:
"-1"
,
'z'
:
"-1"
,
}
}
...
@@ -534,7 +537,7 @@ setattrofunc = Signature("TOO", 'r') # typedef int (*setattrofunc)(PyObjec
...
@@ -534,7 +537,7 @@ setattrofunc = Signature("TOO", 'r') # typedef int (*setattrofunc)(PyObjec
delattrofunc
=
Signature
(
"TO"
,
'r'
)
delattrofunc
=
Signature
(
"TO"
,
'r'
)
cmpfunc
=
Signature
(
"TO"
,
"i"
)
# typedef int (*cmpfunc)(PyObject *, PyObject *);
cmpfunc
=
Signature
(
"TO"
,
"i"
)
# typedef int (*cmpfunc)(PyObject *, PyObject *);
reprfunc
=
Signature
(
"T"
,
"O"
)
# typedef PyObject *(*reprfunc)(PyObject *);
reprfunc
=
Signature
(
"T"
,
"O"
)
# typedef PyObject *(*reprfunc)(PyObject *);
hashfunc
=
Signature
(
"T"
,
"
l"
)
# typedef long
(*hashfunc)(PyObject *);
hashfunc
=
Signature
(
"T"
,
"
h"
)
# typedef Py_hash_t
(*hashfunc)(PyObject *);
# typedef PyObject *(*richcmpfunc) (PyObject *, PyObject *, int);
# typedef PyObject *(*richcmpfunc) (PyObject *, PyObject *, int);
richcmpfunc
=
Signature
(
"OOi"
,
"O"
)
# typedef PyObject *(*richcmpfunc) (PyObject *, PyObject *, int);
richcmpfunc
=
Signature
(
"OOi"
,
"O"
)
# typedef PyObject *(*richcmpfunc) (PyObject *, PyObject *, int);
getiterfunc
=
Signature
(
"T"
,
"O"
)
# typedef PyObject *(*getiterfunc) (PyObject *);
getiterfunc
=
Signature
(
"T"
,
"O"
)
# typedef PyObject *(*getiterfunc) (PyObject *);
...
...
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