Commit b3f927cb authored by Stefan Behnel's avatar Stefan Behnel

Fix "casting_python" test on old MSVC versions.

Closes #2489.
parent 3423bdf6
from cpython.ref cimport PyObject from cpython.ref cimport PyObject
from libc.stdint cimport uintptr_t
cdef extern from *:
ctypedef Py_ssize_t Py_intptr_t
python_string = "foo" python_string = "foo"
cdef void* ptr = <void*>python_string cdef void* ptr = <void*>python_string
cdef uintptr_t adress_in_c = <uintptr_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 address_from_void = adress_in_c # address_from_void is a python int
cdef PyObject* ptr2 = <PyObject*>python_string cdef PyObject* ptr2 = <PyObject*>python_string
cdef uintptr_t address_in_c2 = <uintptr_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 address_from_PyObject = address_in_c2 # address_from_PyObject is a python int
assert address_from_void == address_from_PyObject == id(python_string) assert address_from_void == address_from_PyObject == id(python_string)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment