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
73d0d7a0
Commit
73d0d7a0
authored
May 16, 2017
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Pickling docs.
parent
2c47e7d3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
0 deletions
+19
-0
CHANGES.rst
CHANGES.rst
+2
-0
docs/src/userguide/extension_types.rst
docs/src/userguide/extension_types.rst
+17
-0
No files found.
CHANGES.rst
View file @
73d0d7a0
...
...
@@ -22,6 +22,8 @@ Features added
* ``abs()`` is optimised for C complex numbers.
Patch by da-woods (Github issue #1648).
* cdef classes now support pickling by default when possible.
Bugs fixed
----------
...
...
docs/src/userguide/extension_types.rst
View file @
73d0d7a0
...
...
@@ -550,6 +550,23 @@ If you can be sure addresses will contain only references to strings,
the above would be safe, and it may yield a significant speedup, depending on
your usage pattern.
Controlling pickling
====================
By default, Python will generate a ``__reduce__`` to allow pickling an extension
type if and only if each of its members are convertible to Python and it has
no ``__cinit__`` method.
To require this behavior (i.e. throw an error at compile time if a class
cannot be pickled) decorate the class with ``@cython.auto_pickle(True)``.
One can also annotate with ``@cython.auto_pickle(False)`` to get the old
behavior of not generating a ``__reduce__`` method in any case.
Manually implementing a ``__reduce__`` or `__reduce_ex__`` method will also
disable this auto-generation and can be used to support pickling of more
complicated types.
Public and external extension types
====================================
...
...
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