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
3154bef3
Commit
3154bef3
authored
Sep 24, 2014
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
make Py_hash_t a known type
parent
a15d2df8
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
0 deletions
+34
-0
CHANGES.rst
CHANGES.rst
+2
-0
Cython/Compiler/Parsing.py
Cython/Compiler/Parsing.py
+1
-0
tests/run/py_hash_t.pyx
tests/run/py_hash_t.pyx
+31
-0
No files found.
CHANGES.rst
View file @
3154bef3
...
@@ -8,6 +8,8 @@ Latest
...
@@ -8,6 +8,8 @@ Latest
Features added
Features added
--------------
--------------
* ``Py_hash_t`` is a known type (used in CPython for hash values).
* ``PySlice_*()`` C-API functions are available from the ``cpython.slice``
* ``PySlice_*()`` C-API functions are available from the ``cpython.slice``
module.
module.
...
...
Cython/Compiler/Parsing.py
View file @
3154bef3
...
@@ -2285,6 +2285,7 @@ special_basic_c_types = cython.declare(dict, {
...
@@ -2285,6 +2285,7 @@ special_basic_c_types = cython.declare(dict, {
# name : (signed, longness)
# name : (signed, longness)
"Py_UNICODE"
:
(
0
,
0
),
"Py_UNICODE"
:
(
0
,
0
),
"Py_UCS4"
:
(
0
,
0
),
"Py_UCS4"
:
(
0
,
0
),
"Py_hash_t"
:
(
2
,
0
),
"Py_ssize_t"
:
(
2
,
0
),
"Py_ssize_t"
:
(
2
,
0
),
"ssize_t"
:
(
2
,
0
),
"ssize_t"
:
(
2
,
0
),
"size_t"
:
(
0
,
0
),
"size_t"
:
(
0
,
0
),
...
...
tests/run/py_hash_t.pyx
0 → 100644
View file @
3154bef3
cimport
cython
def
assign_py_hash_t
(
x
):
"""
>>> assign_py_hash_t(12)
12
>>> assign_py_hash_t(-12)
-12
"""
cdef
Py_hash_t
h
=
x
return
h
def
infer_hash_type
(
x
):
"""
>>> infer_hash_type(123)
'Py_hash_t'
"""
h
=
hash
(
x
)
return
cython
.
typeof
(
h
)
def
assign_to_name
(
x
):
"""
>>> assign_to_name(321)
321
"""
Py_hash_t
=
x
return
Py_hash_t
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