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
b3f927cb
Commit
b3f927cb
authored
Aug 11, 2018
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix "casting_python" test on old MSVC versions.
Closes #2489.
parent
3423bdf6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
3 deletions
+5
-3
docs/examples/userguide/language_basics/casting_python.pyx
docs/examples/userguide/language_basics/casting_python.pyx
+5
-3
No files found.
docs/examples/userguide/language_basics/casting_python.pyx
View file @
b3f927cb
from
cpython.ref
cimport
PyObject
from
libc.stdint
cimport
uintptr_t
cdef
extern
from
*
:
ctypedef
Py_ssize_t
Py_intptr_t
python_string
=
"foo"
cdef
void
*
ptr
=
<
void
*>
python_string
cdef
uintptr_t
adress_in_c
=
<
u
intptr_t
>
ptr
cdef
Py_intptr_t
adress_in_c
=
<
Py_
intptr_t
>
ptr
address_from_void
=
adress_in_c
# address_from_void is a python int
cdef
PyObject
*
ptr2
=
<
PyObject
*>
python_string
cdef
uintptr_t
address_in_c2
=
<
u
intptr_t
>
ptr2
cdef
Py_intptr_t
address_in_c2
=
<
Py_
intptr_t
>
ptr2
address_from_PyObject
=
address_in_c2
# address_from_PyObject is a python int
assert
address_from_void
==
address_from_PyObject
==
id
(
python_string
)
...
...
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