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
Boxiang Sun
cython
Commits
da298315
Commit
da298315
authored
Jul 07, 2015
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slightly extend docs on automatic type conversions
parent
bd9833dc
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
5 deletions
+13
-5
docs/src/userguide/language_basics.rst
docs/src/userguide/language_basics.rst
+13
-5
No files found.
docs/src/userguide/language_basics.rst
View file @
da298315
...
@@ -311,23 +311,31 @@ possibilities.
...
@@ -311,23 +311,31 @@ possibilities.
+----------------------------+--------------------+------------------+
+----------------------------+--------------------+------------------+
| C types | From Python types | To Python types |
| C types | From Python types | To Python types |
+============================+====================+==================+
+============================+====================+==================+
| [unsigned] char
| int, long | int |
| [unsigned] char
,
| int, long | int |
| [unsigned] short
| | |
| [unsigned] short
,
| | |
| int, long | | |
| int, long | | |
+----------------------------+--------------------+------------------+
+----------------------------+--------------------+------------------+
| unsigned int
| int, long | long |
| unsigned int
,
| int, long | long |
| unsigned long
| | |
| unsigned long
,
| | |
| [unsigned] long long | | |
| [unsigned] long long | | |
+----------------------------+--------------------+------------------+
+----------------------------+--------------------+------------------+
| float, double, long double | int, long, float | float |
| float, double, long double | int, long, float | float |
+----------------------------+--------------------+------------------+
+----------------------------+--------------------+------------------+
| char* | str/bytes | str/bytes [#]_ |
| char* | str/bytes | str/bytes [#]_ |
+----------------------------+--------------------+------------------+
+----------------------------+--------------------+------------------+
| struct | | dict |
| struct, | | dict [#1]_ |
| union | | |
+----------------------------+--------------------+------------------+
+----------------------------+--------------------+------------------+
.. [#] The conversion is to/from str for Python 2.x, and bytes for Python 3.x.
.. [#] The conversion is to/from str for Python 2.x, and bytes for Python 3.x.
.. [#1] The conversion from a C union type to a Python dict will add
a value for each of the union fields. Cython 0.23 and later, however,
will refuse to automatically convert a union with unsafe type
combinations. An example is a union of an ``int`` and a ``char*``,
in which case the pointer value may or be not be a valid pointer.
Caveats when using a Python string in a C context
Caveats when using a Python string in a C context
-------------------------------------------------
-------------------------------------------------
...
...
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