@@ -147,6 +147,19 @@ types:
147
147
C-types PyAsyncGenASend and PyAsyncGenAThrow (see :pep: `525 `) as well as
148
148
all kinds of :ref: `Dictionary view objects <dict-views >`.
149
149
150
+ Code
151
+ ====
152
+
153
+ |SLP | can pickle :data: `~types.CodeType ` objects.
154
+
155
+ .. versionchanged :: 3.8
156
+ The pickled representation of a code object contains the bytecode version number (:data: `~importlib.util.MAGIC_NUMBER `).
157
+ If a program tries to unpickle a code object with a wrong bytecode version number, then |SLP |
158
+
159
+ * emits a ``RuntimeWarning('Unpickling code object with invalid magic number %ld') `` and
160
+ * prepends the *co_code * attribute of the unpickled code object with an invalid |PY | bytecode instruction. This way any attempt
161
+ to execute the code object raises :exc: `SystemError `.
162
+
150
163
Frames
151
164
======
152
165
@@ -156,6 +169,25 @@ generator. |SLP| does not register a "reduction" function for
156
169
:data: `~types.FrameType `. This way |SLP | stays compatible with application
157
170
code that registers its own "reduction" function for :data: `~types.FrameType `.
158
171
172
+ It is not possible to execute an unpickled frame, if the tasklet the original frame belonged to was
173
+ not :attr: `~tasklet.restorable `. In this case the frame is marked as invalid and any attempt
174
+ to execute it raises
175
+
176
+ .. versionchanged :: 3.8
177
+ If a program tries to unpickle a frame using a code object whose first bytecode instruction is invalid, then |SLP |
178
+ marks the frame as invalid. Any attempt to execute the frame raises :exc: `RuntimeError `.
179
+
180
+
181
+ Functions
182
+ =========
183
+
184
+ |SLP | can pickle functions including lambda-objects objects by value.
185
+
186
+ .. versionchanged :: 3.8
187
+ If a program tries to unpickle a function using a code object whose first bytecode instruction is invalid, then |SLP |
188
+ emits a ``RuntimeWarning('Unpickling function with invalid code object: %V') ``. Any attempt
189
+ to execute the function raises :exc: `SystemError `.
190
+
159
191
.. _slp_pickling_asyncgen :
160
192
161
193
Asynchronous Generators
0 commit comments