diff options
author | Stefan Behnel <stefan_ml@behnel.de> | 2019-02-15 20:35:23 +0100 |
---|---|---|
committer | Stefan Behnel <stefan_ml@behnel.de> | 2019-02-15 20:47:04 +0100 |
commit | b67e556756c82f99d633b82cc4652d0dfcdce3f7 (patch) | |
tree | 2c14538d202c1f8eeaa84a774da0cb7fc2e778a4 /docs/examples/userguide/language_basics/casting_python.pyx | |
parent | e6a49ace494660793c3e8cd8115277784108dc40 (diff) | |
download | cython-b67e556756c82f99d633b82cc4652d0dfcdce3f7.tar.gz |
Fix line endings.
Diffstat (limited to 'docs/examples/userguide/language_basics/casting_python.pyx')
-rw-r--r-- | docs/examples/userguide/language_basics/casting_python.pyx | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/docs/examples/userguide/language_basics/casting_python.pyx b/docs/examples/userguide/language_basics/casting_python.pyx index fe84acde2..4cc819ae3 100644 --- a/docs/examples/userguide/language_basics/casting_python.pyx +++ b/docs/examples/userguide/language_basics/casting_python.pyx @@ -1,19 +1,19 @@ -from cpython.ref cimport PyObject
-
-cdef extern from *:
- ctypedef Py_ssize_t Py_intptr_t
-
-python_string = "foo"
-
-cdef void* ptr = <void*>python_string
-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 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)
-
-print(<object>ptr) # Prints "foo"
-print(<object>ptr2) # prints "foo"
+from cpython.ref cimport PyObject + +cdef extern from *: + ctypedef Py_ssize_t Py_intptr_t + +python_string = "foo" + +cdef void* ptr = <void*>python_string +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 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) + +print(<object>ptr) # Prints "foo" +print(<object>ptr2) # prints "foo" |