chunk_id
stringlengths
36
36
source
stringclasses
35 values
source_url
stringlengths
0
290
upstream_license
stringclasses
1 value
document_id
stringlengths
36
36
chunk_index
int64
0
324k
retrieved_at
stringclasses
2 values
chunker_version
stringclasses
4 values
content_hash
stringlengths
15
64
content
stringlengths
50
44.7k
namespace
stringclasses
9 values
source_name
stringclasses
35 values
raw_text
stringlengths
50
44.7k
cleaned_text
stringlengths
50
44.7k
tags
stringclasses
49 values
collection_name
stringclasses
11 values
04037c65-1def-4660-9fa7-b462f344b73b
CPython Docs
file://datasets/cpython/Doc/library/pickle.rst
unknown
d611e6ff-74a7-41e7-8f39-27f844eb2f66
32,604
supabase-export-v2
a485ee1d4863d2fe
implement a :meth:`~object.__reduce_ex__` method specialized for protocol 5 and higher, which returns a :class:`PickleBuffer` instance (instead of e.g. a :class:`bytes` object) for any large data. A :class:`PickleBuffer` object *signals* that the underlying buffer is eligible for out-of-band data transfer. Those object...
trusted_official_docs
CPython Docs
implement a :meth:`~object.__reduce_ex__` method specialized for protocol 5 and higher, which returns a :class:`PickleBuffer` instance (instead of e.g. a :class:`bytes` object) for any large data. A :class:`PickleBuffer` object *signals* that the underlying buffer is eligible for out-of-band data transfer. Those object...
implement a :meth:`~object.__reduce_ex__` method specialized for protocol 5 and higher, which returns a :class:`PickleBuffer` instance (instead of e.g. a :class:`bytes` object) for any large data. A :class:`PickleBuffer` object *signals* that the underlying buffer is eligible for out-of-band data transfer. Those object...
python, official-docs, cpython, P0
Local_Trusted_Corpus
05e25d1a-147e-4d00-b953-556314c2ea3d
CPython Docs
file://datasets/cpython/Doc/library/pickle.rst
unknown
d611e6ff-74a7-41e7-8f39-27f844eb2f66
32,562
supabase-export-v2
2cdeff7c1601a029
Dispatch Tables ^^^^^^^^^^^^^^^ If one wants to customize pickling of some classes without disturbing any other code which depends on pickling, then one can create a pickler with a private dispatch table.
trusted_official_docs
CPython Docs
Dispatch Tables ^^^^^^^^^^^^^^^ If one wants to customize pickling of some classes without disturbing any other code which depends on pickling, then one can create a pickler with a private dispatch table.
Dispatch Tables ^^^^^^^^^^^^^^^ If one wants to customize pickling of some classes without disturbing any other code which depends on pickling, then one can create a pickler with a private dispatch table.
python, official-docs, cpython, P0
Local_Trusted_Corpus
06453408-39fa-4739-8d51-a7760bd9fd92
CPython Docs
file://datasets/cpython/Doc/library/pickle.rst
unknown
d611e6ff-74a7-41e7-8f39-27f844eb2f66
32,566
supabase-export-v2
f0c29d4d783fdd68
f = io.BytesIO() p = pickle.Pickler(f) p.dispatch_table = copyreg.dispatch_table.copy() p.dispatch_table[SomeClass] = reduce_SomeClass creates an instance of :class:`pickle.Pickler` with a private dispatch table which handles the ``SomeClass`` class specially. Alternatively, the code ::
trusted_official_docs
CPython Docs
f = io.BytesIO() p = pickle.Pickler(f) p.dispatch_table = copyreg.dispatch_table.copy() p.dispatch_table[SomeClass] = reduce_SomeClass creates an instance of :class:`pickle.Pickler` with a private dispatch table which handles the ``SomeClass`` class specially. Alternatively, the code ::
f = io.BytesIO() p = pickle.Pickler(f) p.dispatch_table = copyreg.dispatch_table.copy() p.dispatch_table[SomeClass] = reduce_SomeClass creates an instance of :class:`pickle.Pickler` with a private dispatch table which handles the ``SomeClass`` class specially. Alternatively, the code ::
python, official-docs, cpython, P0
Local_Trusted_Corpus
08c280ae-dbf7-4ff5-8511-8d548581fcdc
CPython Docs
file://datasets/cpython/Doc/library/pickle.rst
unknown
d611e6ff-74a7-41e7-8f39-27f844eb2f66
32,649
supabase-export-v2
f8ea25474cd39f34
with open('data.pickle', 'rb') as f: # The protocol version used is detected automatically, so we do not # have to specify it. data = pickle.load(f) .. XXX: Add examples showing how to optimize pickles for size (like using .. pickletools.optimize() or the gzip module).
trusted_official_docs
CPython Docs
with open('data.pickle', 'rb') as f: # The protocol version used is detected automatically, so we do not # have to specify it. data = pickle.load(f) .. XXX: Add examples showing how to optimize pickles for size (like using .. pickletools.optimize() or the gzip module).
with open('data.pickle', 'rb') as f: # The protocol version used is detected automatically, so we do not # have to specify it. data = pickle.load(f) .. XXX: Add examples showing how to optimize pickles for size (like using .. pickletools.optimize() or the gzip module).
python, official-docs, cpython, P0
Local_Trusted_Corpus
0d03615b-db3f-45c0-bdbe-bff5d81daaf7
CPython Docs
file://datasets/cpython/Doc/library/pickle.rst
unknown
d611e6ff-74a7-41e7-8f39-27f844eb2f66
32,627
supabase-export-v2
9d5749074a6f8382
>>> import pickle >>> pickle.loads(b"cos\nsystem\n(S'echo hello world'\ntR.") hello world 0 In this example, the unpickler imports the :func:`os.system` function and then apply the string argument "echo hello world". Although this example is inoffensive, it is not difficult to imagine one that could damage your system.
trusted_official_docs
CPython Docs
>>> import pickle >>> pickle.loads(b"cos\nsystem\n(S'echo hello world'\ntR.") hello world 0 In this example, the unpickler imports the :func:`os.system` function and then apply the string argument "echo hello world". Although this example is inoffensive, it is not difficult to imagine one that could damage your system.
>>> import pickle >>> pickle.loads(b"cos\nsystem\n(S'echo hello world'\ntR.") hello world 0 In this example, the unpickler imports the :func:`os.system` function and then apply the string argument "echo hello world". Although this example is inoffensive, it is not difficult to imagine one that could damage your system.
python, official-docs, cpython, P0
Local_Trusted_Corpus
0ea2ccda-24c0-4ddc-bf85-690dcd95f3a1
CPython Docs
file://datasets/cpython/Doc/library/pickle.rst
unknown
d611e6ff-74a7-41e7-8f39-27f844eb2f66
32,372
supabase-export-v2
97f99fa0f3c13dfc
of Python types (many of them automatically, by clever usage of Python's introspection facilities; complex cases can be tackled by implementing :ref:`specific object APIs <pickle-inst>`); * Unlike pickle, deserializing untrusted JSON does not in itself create an arbitrary code execution vulnerability.
trusted_official_docs
CPython Docs
of Python types (many of them automatically, by clever usage of Python's introspection facilities; complex cases can be tackled by implementing :ref:`specific object APIs <pickle-inst>`); * Unlike pickle, deserializing untrusted JSON does not in itself create an arbitrary code execution vulnerability.
of Python types (many of them automatically, by clever usage of Python's introspection facilities; complex cases can be tackled by implementing :ref:`specific object APIs <pickle-inst>`); * Unlike pickle, deserializing untrusted JSON does not in itself create an arbitrary code execution vulnerability.
python, official-docs, cpython, P0
Local_Trusted_Corpus
0eab91db-3024-4a94-b6c3-49a41bc6ba8c
CPython Docs
file://datasets/cpython/Doc/library/pickle.rst
unknown
d611e6ff-74a7-41e7-8f39-27f844eb2f66
32,588
supabase-export-v2
b30908f773e41491
If both the :attr:`~Pickler.dispatch_table` and :meth:`~Pickler.reducer_override` are defined, then :meth:`~Pickler.reducer_override` method takes priority. .. Note:: For performance reasons, :meth:`~Pickler.reducer_override` may not be called for the following objects: ``None``, ``True``, ``False``, and exact insta...
trusted_official_docs
CPython Docs
If both the :attr:`~Pickler.dispatch_table` and :meth:`~Pickler.reducer_override` are defined, then :meth:`~Pickler.reducer_override` method takes priority. .. Note:: For performance reasons, :meth:`~Pickler.reducer_override` may not be called for the following objects: ``None``, ``True``, ``False``, and exact insta...
If both the :attr:`~Pickler.dispatch_table` and :meth:`~Pickler.reducer_override` are defined, then :meth:`~Pickler.reducer_override` method takes priority. .. Note:: For performance reasons, :meth:`~Pickler.reducer_override` may not be called for the following objects: ``None``, ``True``, ``False``, and exact insta...
python, official-docs, cpython, P0
Local_Trusted_Corpus
12e9e5c9-911c-4a36-b567-a4f8e44a71da
CPython Docs
file://datasets/cpython/Doc/library/pickle.rst
unknown
d611e6ff-74a7-41e7-8f39-27f844eb2f66
32,464
supabase-export-v2
3c9730d5967868ab
:class:`io.BufferedIOBase` interface. Thus *file* can be an on-disk file opened for binary reading, an :class:`io.BytesIO` object, or any other custom object that meets this interface. The optional arguments *fix_imports*, *encoding* and *errors* are used to control compatibility support for pickle stream generated by...
trusted_official_docs
CPython Docs
:class:`io.BufferedIOBase` interface. Thus *file* can be an on-disk file opened for binary reading, an :class:`io.BytesIO` object, or any other custom object that meets this interface. The optional arguments *fix_imports*, *encoding* and *errors* are used to control compatibility support for pickle stream generated by...
:class:`io.BufferedIOBase` interface. Thus *file* can be an on-disk file opened for binary reading, an :class:`io.BytesIO` object, or any other custom object that meets this interface. The optional arguments *fix_imports*, *encoding* and *errors* are used to control compatibility support for pickle stream generated by...
python, official-docs, cpython, P0
Local_Trusted_Corpus
131bd334-1d24-4345-a743-7baf47c5a9f5
CPython Docs
file://datasets/cpython/Doc/library/pickle.rst
unknown
d611e6ff-74a7-41e7-8f39-27f844eb2f66
32,413
supabase-export-v2
5b1821e4f0950811
The protocol version of the pickle is detected automatically, so no protocol argument is needed. Bytes past the pickled representation of the object are ignored. Arguments *file*, *fix_imports*, *encoding*, *errors*, *strict* and *buffers* have the same meaning as in the :class:`Unpickler` constructor.
trusted_official_docs
CPython Docs
The protocol version of the pickle is detected automatically, so no protocol argument is needed. Bytes past the pickled representation of the object are ignored. Arguments *file*, *fix_imports*, *encoding*, *errors*, *strict* and *buffers* have the same meaning as in the :class:`Unpickler` constructor.
The protocol version of the pickle is detected automatically, so no protocol argument is needed. Bytes past the pickled representation of the object are ignored. Arguments *file*, *fix_imports*, *encoding*, *errors*, *strict* and *buffers* have the same meaning as in the :class:`Unpickler` constructor.
python, official-docs, cpython, P0
Local_Trusted_Corpus
13e4e56e-3768-4c24-8895-c614ca67bc74
CPython Docs
file://datasets/cpython/Doc/library/pickle.rst
unknown
d611e6ff-74a7-41e7-8f39-27f844eb2f66
32,380
supabase-export-v2
b0bbc3854637a255
The module :mod:`pickletools` contains tools for analyzing data streams generated by :mod:`!pickle`. :mod:`pickletools` source code has extensive comments about opcodes used by pickle protocols. There are currently 6 different protocols which can be used for pickling. The higher the protocol used, the more recent the v...
trusted_official_docs
CPython Docs
The module :mod:`pickletools` contains tools for analyzing data streams generated by :mod:`!pickle`. :mod:`pickletools` source code has extensive comments about opcodes used by pickle protocols. There are currently 6 different protocols which can be used for pickling. The higher the protocol used, the more recent the v...
The module :mod:`pickletools` contains tools for analyzing data streams generated by :mod:`!pickle`. :mod:`pickletools` source code has extensive comments about opcodes used by pickle protocols. There are currently 6 different protocols which can be used for pickling. The higher the protocol used, the more recent the v...
python, official-docs, cpython, P0
Local_Trusted_Corpus
15598ea2-edb2-45c2-bd83-299e7b3e318d
CPython Docs
file://datasets/cpython/Doc/library/pickle.rst
unknown
d611e6ff-74a7-41e7-8f39-27f844eb2f66
32,555
supabase-export-v2
b80e1f15f60fd534
a persistent ID, which should be either a string of alphanumeric characters (for protocol 0) [#]_ or just an arbitrary object (for any newer protocol). The resolution of such persistent IDs is not defined by the :mod:`!pickle` module; it will delegate this resolution to the user-defined methods on the pickler and unpic...
trusted_official_docs
CPython Docs
a persistent ID, which should be either a string of alphanumeric characters (for protocol 0) [#]_ or just an arbitrary object (for any newer protocol). The resolution of such persistent IDs is not defined by the :mod:`!pickle` module; it will delegate this resolution to the user-defined methods on the pickler and unpic...
a persistent ID, which should be either a string of alphanumeric characters (for protocol 0) [#]_ or just an arbitrary object (for any newer protocol). The resolution of such persistent IDs is not defined by the :mod:`!pickle` module; it will delegate this resolution to the user-defined methods on the pickler and unpic...
python, official-docs, cpython, P0
Local_Trusted_Corpus
1783fe99-9f7f-4211-a84f-f2f1587cf818
CPython Docs
file://datasets/cpython/Doc/library/pickle.rst
unknown
d611e6ff-74a7-41e7-8f39-27f844eb2f66
32,589
supabase-export-v2
4fa3b13756e11dd5
may not be called for the following objects: ``None``, ``True``, ``False``, and exact instances of :class:`int`, :class:`float`, :class:`bytes`, :class:`str`, :class:`dict`, :class:`set`, :class:`frozenset`, :class:`list` and :class:`tuple`. Here is a simple example where we allow pickling and reconstructing a given cl...
trusted_official_docs
CPython Docs
may not be called for the following objects: ``None``, ``True``, ``False``, and exact instances of :class:`int`, :class:`float`, :class:`bytes`, :class:`str`, :class:`dict`, :class:`set`, :class:`frozenset`, :class:`list` and :class:`tuple`. Here is a simple example where we allow pickling and reconstructing a given cl...
may not be called for the following objects: ``None``, ``True``, ``False``, and exact instances of :class:`int`, :class:`float`, :class:`bytes`, :class:`str`, :class:`dict`, :class:`set`, :class:`frozenset`, :class:`list` and :class:`tuple`. Here is a simple example where we allow pickling and reconstructing a given cl...
python, official-docs, cpython, P0
Local_Trusted_Corpus
18e074a5-60a3-4230-aeca-6192946f153b
CPython Docs
file://datasets/cpython/Doc/library/pickle.rst
unknown
d611e6ff-74a7-41e7-8f39-27f844eb2f66
32,389
supabase-export-v2
520f51e70108d827
Module Interface ---------------- To serialize an object hierarchy, you simply call the :func:`dumps` function. Similarly, to de-serialize a data stream, you call the :func:`loads` function. However, if you want more control over serialization and de-serialization, you can create a :class:`Pickler` or an :class:`Unpick...
trusted_official_docs
CPython Docs
Module Interface ---------------- To serialize an object hierarchy, you simply call the :func:`dumps` function. Similarly, to de-serialize a data stream, you call the :func:`loads` function. However, if you want more control over serialization and de-serialization, you can create a :class:`Pickler` or an :class:`Unpick...
Module Interface ---------------- To serialize an object hierarchy, you simply call the :func:`dumps` function. Similarly, to de-serialize a data stream, you call the :func:`loads` function. However, if you want more control over serialization and de-serialization, you can create a :class:`Pickler` or an :class:`Unpick...
python, official-docs, cpython, P0
Local_Trusted_Corpus
18f9fcb3-2683-4897-b588-86a49f7380ee
CPython Docs
file://datasets/cpython/Doc/library/pickle.rst
unknown
d611e6ff-74a7-41e7-8f39-27f844eb2f66
32,540
supabase-export-v2
ae026202176078f3
local name relative to its module; the pickle module searches the module namespace to determine the object's module. This behaviour is typically useful for singletons. When a tuple is returned, it must be between two and six items long. Optional items can either be omitted, or ``None`` can be provided as their value. ...
trusted_official_docs
CPython Docs
local name relative to its module; the pickle module searches the module namespace to determine the object's module. This behaviour is typically useful for singletons. When a tuple is returned, it must be between two and six items long. Optional items can either be omitted, or ``None`` can be provided as their value. ...
local name relative to its module; the pickle module searches the module namespace to determine the object's module. This behaviour is typically useful for singletons. When a tuple is returned, it must be between two and six items long. Optional items can either be omitted, or ``None`` can be provided as their value. ...
python, official-docs, cpython, P0
Local_Trusted_Corpus
190d5cfe-e468-44fd-8ff9-32b5b0ee2df7
CPython Docs
file://datasets/cpython/Doc/library/pickle.rst
unknown
d611e6ff-74a7-41e7-8f39-27f844eb2f66
32,456
supabase-export-v2
2df5f33d5c198772
the pickling process by not generating superfluous PUT opcodes. It should not be used with self-referential objects, doing otherwise will cause :class:`Pickler` to recurse infinitely. Use :func:`pickletools.optimize` if you need more compact pickles.
trusted_official_docs
CPython Docs
the pickling process by not generating superfluous PUT opcodes. It should not be used with self-referential objects, doing otherwise will cause :class:`Pickler` to recurse infinitely. Use :func:`pickletools.optimize` if you need more compact pickles.
the pickling process by not generating superfluous PUT opcodes. It should not be used with self-referential objects, doing otherwise will cause :class:`Pickler` to recurse infinitely. Use :func:`pickletools.optimize` if you need more compact pickles.
python, official-docs, cpython, P0
Local_Trusted_Corpus
1c048052-c0db-4144-848f-2956ed10ec15
CPython Docs
file://datasets/cpython/Doc/library/pickle.rst
unknown
d611e6ff-74a7-41e7-8f39-27f844eb2f66
32,616
supabase-export-v2
344ba94f1bec27a2
method) returns the buffer's providing object if it has the right type. This is an easy way to simulate zero-copy behaviour on this toy example. On the consumer side, we can pickle those objects the usual way, which when unserialized will give us a copy of the original object::
trusted_official_docs
CPython Docs
method) returns the buffer's providing object if it has the right type. This is an easy way to simulate zero-copy behaviour on this toy example. On the consumer side, we can pickle those objects the usual way, which when unserialized will give us a copy of the original object::
method) returns the buffer's providing object if it has the right type. This is an easy way to simulate zero-copy behaviour on this toy example. On the consumer side, we can pickle those objects the usual way, which when unserialized will give us a copy of the original object::
python, official-docs, cpython, P0
Local_Trusted_Corpus
1e76f2d6-d95d-41d6-9555-53002718c72e
CPython Docs
file://datasets/cpython/Doc/library/pickle.rst
unknown
d611e6ff-74a7-41e7-8f39-27f844eb2f66
32,637
supabase-export-v2
05b2d93ee4a53ee8
pickle.UnpicklingError: global 'os.system' is forbidden >>> restricted_loads(b'cbuiltins\neval\n' ... b'(S\'getattr(__import__("os"), "system")' ... b'("echo hello world")\'\ntR.') Traceback (most recent call last): ... pickle.UnpicklingError: global 'builtins.eval' is forbidden .. XXX Add note about how extension code...
trusted_official_docs
CPython Docs
pickle.UnpicklingError: global 'os.system' is forbidden >>> restricted_loads(b'cbuiltins\neval\n' ... b'(S\'getattr(__import__("os"), "system")' ... b'("echo hello world")\'\ntR.') Traceback (most recent call last): ... pickle.UnpicklingError: global 'builtins.eval' is forbidden .. XXX Add note about how extension code...
pickle.UnpicklingError: global 'os.system' is forbidden >>> restricted_loads(b'cbuiltins\neval\n' ... b'(S\'getattr(__import__("os"), "system")' ... b'("echo hello world")\'\ntR.') Traceback (most recent call last): ... pickle.UnpicklingError: global 'builtins.eval' is forbidden .. XXX Add note about how extension code...
python, official-docs, cpython, P0
Local_Trusted_Corpus
20542cae-de8a-459a-9547-68e5eeb2fc74
CPython Docs
file://datasets/cpython/Doc/library/pickle.rst
unknown
d611e6ff-74a7-41e7-8f39-27f844eb2f66
32,449
supabase-export-v2
515955fb330ba1b7
Alternatively, if a subclass of :class:`Pickler` has a :attr:`dispatch_table` attribute then this will be used as the default dispatch table for instances of that class. See :ref:`pickle-dispatch` for usage examples.
trusted_official_docs
CPython Docs
Alternatively, if a subclass of :class:`Pickler` has a :attr:`dispatch_table` attribute then this will be used as the default dispatch table for instances of that class. See :ref:`pickle-dispatch` for usage examples.
Alternatively, if a subclass of :class:`Pickler` has a :attr:`dispatch_table` attribute then this will be used as the default dispatch table for instances of that class. See :ref:`pickle-dispatch` for usage examples.
python, official-docs, cpython, P0
Local_Trusted_Corpus
20fb8b2c-d1de-4e88-9dcc-543d9c5b9036
CPython Docs
file://datasets/cpython/Doc/library/pickle.rst
unknown
d611e6ff-74a7-41e7-8f39-27f844eb2f66
32,404
supabase-export-v2
eed7a22ed5eea4ee
Write the pickled representation of the object *obj* to the open :term:`file object` *file*. This is equivalent to ``Pickler(file, protocol).dump(obj)``. Arguments *file*, *protocol*, *fix_imports* and *buffer_callback* have the same meaning as in the :class:`Pickler` constructor.
trusted_official_docs
CPython Docs
Write the pickled representation of the object *obj* to the open :term:`file object` *file*. This is equivalent to ``Pickler(file, protocol).dump(obj)``. Arguments *file*, *protocol*, *fix_imports* and *buffer_callback* have the same meaning as in the :class:`Pickler` constructor.
Write the pickled representation of the object *obj* to the open :term:`file object` *file*. This is equivalent to ``Pickler(file, protocol).dump(obj)``. Arguments *file*, *protocol*, *fix_imports* and *buffer_callback* have the same meaning as in the :class:`Pickler` constructor.
python, official-docs, cpython, P0
Local_Trusted_Corpus
22e1416c-e9c0-4048-a8c7-f07a3d92802e
CPython Docs
file://datasets/cpython/Doc/library/pickle.rst
unknown
d611e6ff-74a7-41e7-8f39-27f844eb2f66
32,556
supabase-export-v2
6b7ef11ed8694666
is not defined by the :mod:`!pickle` module; it will delegate this resolution to the user-defined methods on the pickler and unpickler, :meth:`~Pickler.persistent_id` and :meth:`~Unpickler.persistent_load` respectively. To pickle objects that have an external persistent ID, the pickler must have a custom :meth:`~Pickle...
trusted_official_docs
CPython Docs
is not defined by the :mod:`!pickle` module; it will delegate this resolution to the user-defined methods on the pickler and unpickler, :meth:`~Pickler.persistent_id` and :meth:`~Unpickler.persistent_load` respectively. To pickle objects that have an external persistent ID, the pickler must have a custom :meth:`~Pickle...
is not defined by the :mod:`!pickle` module; it will delegate this resolution to the user-defined methods on the pickler and unpickler, :meth:`~Pickler.persistent_id` and :meth:`~Unpickler.persistent_load` respectively. To pickle objects that have an external persistent ID, the pickler must have a custom :meth:`~Pickle...
python, official-docs, cpython, P0
Local_Trusted_Corpus
239be28a-4c46-4520-9db1-d0b697c90651
CPython Docs
file://datasets/cpython/Doc/library/pickle.rst
unknown
d611e6ff-74a7-41e7-8f39-27f844eb2f66
32,617
supabase-export-v2
8357f968e21e1d04
On the consumer side, we can pickle those objects the usual way, which when unserialized will give us a copy of the original object:: b = ZeroCopyByteArray(b"abc") data = pickle.dumps(b, protocol=5) new_b = pickle.loads(data) print(b == new_b) # True print(b is new_b) # False: a copy was made
trusted_official_docs
CPython Docs
On the consumer side, we can pickle those objects the usual way, which when unserialized will give us a copy of the original object:: b = ZeroCopyByteArray(b"abc") data = pickle.dumps(b, protocol=5) new_b = pickle.loads(data) print(b == new_b) # True print(b is new_b) # False: a copy was made
On the consumer side, we can pickle those objects the usual way, which when unserialized will give us a copy of the original object:: b = ZeroCopyByteArray(b"abc") data = pickle.dumps(b, protocol=5) new_b = pickle.loads(data) print(b == new_b) # True print(b is new_b) # False: a copy was made
python, official-docs, cpython, P0
Local_Trusted_Corpus
269f133a-d15f-407e-b3fd-e02d08e91c51
CPython Docs
file://datasets/cpython/Doc/library/pickle.rst
unknown
d611e6ff-74a7-41e7-8f39-27f844eb2f66
32,535
supabase-export-v2
b1aa6a717f5cb316
.. index:: pair: copy; protocol As we shall see, pickle does not use directly the methods described above. In fact, these methods are part of the copy protocol which implements the :meth:`~object.__reduce__` special method. The copy protocol provides a unified interface for retrieving the data necessary for pickling an...
trusted_official_docs
CPython Docs
.. index:: pair: copy; protocol As we shall see, pickle does not use directly the methods described above. In fact, these methods are part of the copy protocol which implements the :meth:`~object.__reduce__` special method. The copy protocol provides a unified interface for retrieving the data necessary for pickling an...
.. index:: pair: copy; protocol As we shall see, pickle does not use directly the methods described above. In fact, these methods are part of the copy protocol which implements the :meth:`~object.__reduce__` special method. The copy protocol provides a unified interface for retrieving the data necessary for pickling an...
python, official-docs, cpython, P0
Local_Trusted_Corpus
288da19b-47e0-4e98-b063-0d26ae5894e7
CPython Docs
file://datasets/cpython/Doc/library/pickle.rst
unknown
d611e6ff-74a7-41e7-8f39-27f844eb2f66
32,600
supabase-export-v2
eab336f52f2b9b39
.. versionadded:: 3.8 In some contexts, the :mod:`!pickle` module is used to transfer massive amounts of data. Therefore, it can be important to minimize the number of memory copies, to preserve performance and resource consumption. However, normal operation of the :mod:`!pickle` module, as it transforms a graph-like s...
trusted_official_docs
CPython Docs
.. versionadded:: 3.8 In some contexts, the :mod:`!pickle` module is used to transfer massive amounts of data. Therefore, it can be important to minimize the number of memory copies, to preserve performance and resource consumption. However, normal operation of the :mod:`!pickle` module, as it transforms a graph-like s...
.. versionadded:: 3.8 In some contexts, the :mod:`!pickle` module is used to transfer massive amounts of data. Therefore, it can be important to minimize the number of memory copies, to preserve performance and resource consumption. However, normal operation of the :mod:`!pickle` module, as it transforms a graph-like s...
python, official-docs, cpython, P0
Local_Trusted_Corpus
28f459be-916d-4d4d-a668-a04e5d881af2
CPython Docs
file://datasets/cpython/Doc/library/pickle.rst
unknown
d611e6ff-74a7-41e7-8f39-27f844eb2f66
32,533
supabase-export-v2
f3e2ffc9f2a3473f
.. note:: At unpickling time, some methods like :meth:`~object.__getattr__`, :meth:`~object.__getattribute__`, or :meth:`~object.__setattr__` may be called upon the instance. In case those methods rely on some internal invariant being true, the type should implement :meth:`~object.__new__` to establish such an inva...
trusted_official_docs
CPython Docs
.. note:: At unpickling time, some methods like :meth:`~object.__getattr__`, :meth:`~object.__getattribute__`, or :meth:`~object.__setattr__` may be called upon the instance. In case those methods rely on some internal invariant being true, the type should implement :meth:`~object.__new__` to establish such an inva...
.. note:: At unpickling time, some methods like :meth:`~object.__getattr__`, :meth:`~object.__getattribute__`, or :meth:`~object.__setattr__` may be called upon the instance. In case those methods rely on some internal invariant being true, the type should implement :meth:`~object.__new__` to establish such an inva...
python, official-docs, cpython, P0
Local_Trusted_Corpus
29929da6-5af3-4a89-bcd1-8a7d68781de2
CPython Docs
file://datasets/cpython/Doc/library/pickle.rst
unknown
d611e6ff-74a7-41e7-8f39-27f844eb2f66
32,476
supabase-export-v2
2e391b43f21463a0
.. method:: find_class(module, name) Import *module* if necessary and return the object called *name* from it, where the *module* and *name* arguments are :class:`str` objects. Note, unlike its name suggests, :meth:`find_class` is also used for finding functions.
trusted_official_docs
CPython Docs
.. method:: find_class(module, name) Import *module* if necessary and return the object called *name* from it, where the *module* and *name* arguments are :class:`str` objects. Note, unlike its name suggests, :meth:`find_class` is also used for finding functions.
.. method:: find_class(module, name) Import *module* if necessary and return the object called *name* from it, where the *module* and *name* arguments are :class:`str` objects. Note, unlike its name suggests, :meth:`find_class` is also used for finding functions.
python, official-docs, cpython, P0
Local_Trusted_Corpus
2a51d9e9-24ef-4d46-880f-f33d8986dff0
CPython Docs
file://datasets/cpython/Doc/library/pickle.rst
unknown
d611e6ff-74a7-41e7-8f39-27f844eb2f66
32,392
supabase-export-v2
c130a35d3d8b8868
.. data:: HIGHEST_PROTOCOL An integer, the highest :ref:`protocol version <pickle-protocols>` available. This value can be passed as a *protocol* value to functions :func:`dump` and :func:`dumps` as well as the :class:`Pickler` constructor.
trusted_official_docs
CPython Docs
.. data:: HIGHEST_PROTOCOL An integer, the highest :ref:`protocol version <pickle-protocols>` available. This value can be passed as a *protocol* value to functions :func:`dump` and :func:`dumps` as well as the :class:`Pickler` constructor.
.. data:: HIGHEST_PROTOCOL An integer, the highest :ref:`protocol version <pickle-protocols>` available. This value can be passed as a *protocol* value to functions :func:`dump` and :func:`dumps` as well as the :class:`Pickler` constructor.
python, official-docs, cpython, P0
Local_Trusted_Corpus
2e3476ec-a04a-422e-96c9-045ca7730b40
CPython Docs
file://datasets/cpython/Doc/library/pickle.rst
unknown
d611e6ff-74a7-41e7-8f39-27f844eb2f66
32,408
supabase-export-v2
6fde1efafd0afd13
Return the pickled representation of the object *obj* as a :class:`bytes` object, instead of writing it to a file. Arguments *protocol*, *fix_imports* and *buffer_callback* have the same meaning as in the :class:`Pickler` constructor.
trusted_official_docs
CPython Docs
Return the pickled representation of the object *obj* as a :class:`bytes` object, instead of writing it to a file. Arguments *protocol*, *fix_imports* and *buffer_callback* have the same meaning as in the :class:`Pickler` constructor.
Return the pickled representation of the object *obj* as a :class:`bytes` object, instead of writing it to a file. Arguments *protocol*, *fix_imports* and *buffer_callback* have the same meaning as in the :class:`Pickler` constructor.
python, official-docs, cpython, P0
Local_Trusted_Corpus
2f6e7b3e-4a28-4f6d-8095-80bafec3776e
CPython Docs
file://datasets/cpython/Doc/library/pickle.rst
unknown
d611e6ff-74a7-41e7-8f39-27f844eb2f66
32,514
supabase-export-v2
f7444e25fb0bf0c7
tuple of positional arguments and *kwargs* a dictionary of named arguments for constructing the object. Those will be passed to the :meth:`__new__` method upon unpickling. You should implement this method if the :meth:`__new__` method of your class requires keyword-only arguments. Otherwise, it is recommended for com...
trusted_official_docs
CPython Docs
tuple of positional arguments and *kwargs* a dictionary of named arguments for constructing the object. Those will be passed to the :meth:`__new__` method upon unpickling. You should implement this method if the :meth:`__new__` method of your class requires keyword-only arguments. Otherwise, it is recommended for com...
tuple of positional arguments and *kwargs* a dictionary of named arguments for constructing the object. Those will be passed to the :meth:`__new__` method upon unpickling. You should implement this method if the :meth:`__new__` method of your class requires keyword-only arguments. Otherwise, it is recommended for com...
python, official-docs, cpython, P0
Local_Trusted_Corpus
3009dc9d-9bf8-4fae-aa96-e95c293fa413
CPython Docs
file://datasets/cpython/Doc/library/pickle.rst
unknown
d611e6ff-74a7-41e7-8f39-27f844eb2f66
32,369
supabase-export-v2
9fb54ac83a28277b
text serialization format (it outputs unicode text, although most of the time it is then encoded to ``utf-8``), while pickle is a binary serialization format; * JSON is human-readable, while pickle is not;
trusted_official_docs
CPython Docs
text serialization format (it outputs unicode text, although most of the time it is then encoded to ``utf-8``), while pickle is a binary serialization format; * JSON is human-readable, while pickle is not;
text serialization format (it outputs unicode text, although most of the time it is then encoded to ``utf-8``), while pickle is a binary serialization format; * JSON is human-readable, while pickle is not;
python, official-docs, cpython, P0
Local_Trusted_Corpus
3283891f-028e-4d05-a21e-22d5de9ea008
CPython Docs
file://datasets/cpython/Doc/library/pickle.rst
unknown
d611e6ff-74a7-41e7-8f39-27f844eb2f66
32,500
supabase-export-v2
5ea132374dec6db6
none of the class's code or data is pickled, so in the following example the class attribute ``attr`` is not restored in the unpickling environment:: class Foo: attr = 'A class attribute'
trusted_official_docs
CPython Docs
none of the class's code or data is pickled, so in the following example the class attribute ``attr`` is not restored in the unpickling environment:: class Foo: attr = 'A class attribute'
none of the class's code or data is pickled, so in the following example the class attribute ``attr`` is not restored in the unpickling environment:: class Foo: attr = 'A class attribute'
python, official-docs, cpython, P0
Local_Trusted_Corpus
32fc5a9d-ec47-4d88-aaa0-1c9d2fb7391a
CPython Docs
file://datasets/cpython/Doc/library/pickle.rst
unknown
d611e6ff-74a7-41e7-8f39-27f844eb2f66
32,356
supabase-export-v2
b726bc7ef21d5db2
The ``pickle`` module **is not secure**. Only unpickle data you trust. It is possible to construct malicious pickle data which will **execute arbitrary code during unpickling**. Never unpickle data that could have come from an untrusted source, or that could have been tampered with.
trusted_official_docs
CPython Docs
The ``pickle`` module **is not secure**. Only unpickle data you trust. It is possible to construct malicious pickle data which will **execute arbitrary code during unpickling**. Never unpickle data that could have come from an untrusted source, or that could have been tampered with.
The ``pickle`` module **is not secure**. Only unpickle data you trust. It is possible to construct malicious pickle data which will **execute arbitrary code during unpickling**. Never unpickle data that could have come from an untrusted source, or that could have been tampered with.
python, official-docs, cpython, P0
Local_Trusted_Corpus
34004800-057e-44d2-800e-688f4d669e47
CPython Docs
file://datasets/cpython/Doc/library/pickle.rst
unknown
d611e6ff-74a7-41e7-8f39-27f844eb2f66
32,587
supabase-export-v2
4e3e1162bfbac5b9
implement a :meth:`~Pickler.reducer_override` method. This method can return an arbitrary reduction tuple (see :meth:`~object.__reduce__`). It can alternatively return :data:`NotImplemented` to fallback to the traditional behavior. If both the :attr:`~Pickler.dispatch_table` and :meth:`~Pickler.reducer_override` are de...
trusted_official_docs
CPython Docs
implement a :meth:`~Pickler.reducer_override` method. This method can return an arbitrary reduction tuple (see :meth:`~object.__reduce__`). It can alternatively return :data:`NotImplemented` to fallback to the traditional behavior. If both the :attr:`~Pickler.dispatch_table` and :meth:`~Pickler.reducer_override` are de...
implement a :meth:`~Pickler.reducer_override` method. This method can return an arbitrary reduction tuple (see :meth:`~object.__reduce__`). It can alternatively return :data:`NotImplemented` to fallback to the traditional behavior. If both the :attr:`~Pickler.dispatch_table` and :meth:`~Pickler.reducer_override` are de...
python, official-docs, cpython, P0
Local_Trusted_Corpus
348499ac-f87c-42e0-8465-26043f34cc52
CPython Docs
file://datasets/cpython/Doc/library/pickle.rst
unknown
d611e6ff-74a7-41e7-8f39-27f844eb2f66
32,554
supabase-export-v2
05566697285ba620
.. index:: single: persistent_id (pickle protocol) single: persistent_load (pickle protocol) For the benefit of object persistence, the :mod:`!pickle` module supports the notion of a reference to an object outside the pickled data stream. Such objects are referenced by a persistent ID, which should be either a string o...
trusted_official_docs
CPython Docs
.. index:: single: persistent_id (pickle protocol) single: persistent_load (pickle protocol) For the benefit of object persistence, the :mod:`!pickle` module supports the notion of a reference to an object outside the pickled data stream. Such objects are referenced by a persistent ID, which should be either a string o...
.. index:: single: persistent_id (pickle protocol) single: persistent_load (pickle protocol) For the benefit of object persistence, the :mod:`!pickle` module supports the notion of a reference to an object outside the pickled data stream. Such objects are referenced by a persistent ID, which should be either a string o...
python, official-docs, cpython, P0
Local_Trusted_Corpus
399bb101-d11c-4c98-8671-c1138d6cf7a0
CPython Docs
file://datasets/cpython/Doc/library/pickle.rst
unknown
d611e6ff-74a7-41e7-8f39-27f844eb2f66
32,568
supabase-export-v2
bce7ce73b112a572
class MyPickler(pickle.Pickler): dispatch_table = copyreg.dispatch_table.copy() dispatch_table[SomeClass] = reduce_SomeClass f = io.BytesIO() p = MyPickler(f) does the same but all instances of ``MyPickler`` will by default share the private dispatch table. On the other hand, the code ::
trusted_official_docs
CPython Docs
class MyPickler(pickle.Pickler): dispatch_table = copyreg.dispatch_table.copy() dispatch_table[SomeClass] = reduce_SomeClass f = io.BytesIO() p = MyPickler(f) does the same but all instances of ``MyPickler`` will by default share the private dispatch table. On the other hand, the code ::
class MyPickler(pickle.Pickler): dispatch_table = copyreg.dispatch_table.copy() dispatch_table[SomeClass] = reduce_SomeClass f = io.BytesIO() p = MyPickler(f) does the same but all instances of ``MyPickler`` will by default share the private dispatch table. On the other hand, the code ::
python, official-docs, cpython, P0
Local_Trusted_Corpus
3b1d14c1-6497-41d9-b506-58af878241f7
CPython Docs
file://datasets/cpython/Doc/library/pickle.rst
unknown
d611e6ff-74a7-41e7-8f39-27f844eb2f66
32,503
supabase-export-v2
a687e21bd9a44314
These restrictions are why picklable functions and classes must be defined at the top level of a module. Similarly, when class instances are pickled, their class's code and data are not pickled along with them. Only the instance data are pickled. This is done on purpose, so you can fix bugs in a class or add methods to...
trusted_official_docs
CPython Docs
These restrictions are why picklable functions and classes must be defined at the top level of a module. Similarly, when class instances are pickled, their class's code and data are not pickled along with them. Only the instance data are pickled. This is done on purpose, so you can fix bugs in a class or add methods to...
These restrictions are why picklable functions and classes must be defined at the top level of a module. Similarly, when class instances are pickled, their class's code and data are not pickled along with them. Only the instance data are pickled. This is done on purpose, so you can fix bugs in a class or add methods to...
python, official-docs, cpython, P0
Local_Trusted_Corpus
3c39cb6e-25ae-4d11-91c4-d8ab540d5bfb
CPython Docs
file://datasets/cpython/Doc/library/pickle.rst
unknown
d611e6ff-74a7-41e7-8f39-27f844eb2f66
32,638
supabase-export-v2
0769c23641874f24
.. XXX Add note about how extension codes could evade our protection mechanism (e.g. cached classes do not invokes find_class()). As our examples shows, you have to be careful with what you allow to be unpickled. Therefore if security is a concern, you may want to consider alternatives such as the marshalling API in :m...
trusted_official_docs
CPython Docs
.. XXX Add note about how extension codes could evade our protection mechanism (e.g. cached classes do not invokes find_class()). As our examples shows, you have to be careful with what you allow to be unpickled. Therefore if security is a concern, you may want to consider alternatives such as the marshalling API in :m...
.. XXX Add note about how extension codes could evade our protection mechanism (e.g. cached classes do not invokes find_class()). As our examples shows, you have to be careful with what you allow to be unpickled. Therefore if security is a concern, you may want to consider alternatives such as the marshalling API in :m...
python, official-docs, cpython, P0
Local_Trusted_Corpus
3d133c05-df93-4b94-b5b5-1dd1a3999632
CPython Docs
file://datasets/cpython/Doc/library/pickle.rst
unknown
d611e6ff-74a7-41e7-8f39-27f844eb2f66
32,593
supabase-export-v2
c60689801b7785ae
MyClass.""" if getattr(obj, "__name__", None) == "MyClass": return type, (obj.__name__, obj.__bases__, {'my_attribute': obj.my_attribute}) else: # For any other object, fallback to usual reduction return NotImplemented f = io.BytesIO() p = MyPickler(f) p.dump(MyClass)
trusted_official_docs
CPython Docs
MyClass.""" if getattr(obj, "__name__", None) == "MyClass": return type, (obj.__name__, obj.__bases__, {'my_attribute': obj.my_attribute}) else: # For any other object, fallback to usual reduction return NotImplemented f = io.BytesIO() p = MyPickler(f) p.dump(MyClass)
MyClass.""" if getattr(obj, "__name__", None) == "MyClass": return type, (obj.__name__, obj.__bases__, {'my_attribute': obj.my_attribute}) else: # For any other object, fallback to usual reduction return NotImplemented f = io.BytesIO() p = MyPickler(f) p.dump(MyClass)
python, official-docs, cpython, P0
Local_Trusted_Corpus
40613181-3a76-4c07-8801-6fe2d90773f8
CPython Docs
file://datasets/cpython/Doc/library/pickle.rst
unknown
d611e6ff-74a7-41e7-8f39-27f844eb2f66
32,620
supabase-export-v2
e389b62f4b3fda39
= [] data = pickle.dumps(b, protocol=5, buffer_callback=buffers.append) new_b = pickle.loads(data, buffers=buffers) print(b == new_b) # True print(b is new_b) # True: no copy was made This example is limited by the fact that :class:`bytearray` allocates its own memory: you cannot create a :class:`bytearray` instance th...
trusted_official_docs
CPython Docs
= [] data = pickle.dumps(b, protocol=5, buffer_callback=buffers.append) new_b = pickle.loads(data, buffers=buffers) print(b == new_b) # True print(b is new_b) # True: no copy was made This example is limited by the fact that :class:`bytearray` allocates its own memory: you cannot create a :class:`bytearray` instance th...
= [] data = pickle.dumps(b, protocol=5, buffer_callback=buffers.append) new_b = pickle.loads(data, buffers=buffers) print(b == new_b) # True print(b is new_b) # True: no copy was made This example is limited by the fact that :class:`bytearray` allocates its own memory: you cannot create a :class:`bytearray` instance th...
python, official-docs, cpython, P0
Local_Trusted_Corpus
407cc555-04ff-4a75-b5ba-d103111da0e1
CPython Docs
file://datasets/cpython/Doc/library/pickle.rst
unknown
d611e6ff-74a7-41e7-8f39-27f844eb2f66
32,447
supabase-export-v2
fb3e5a20e6fc9919
.. attribute:: dispatch_table A pickler object's dispatch table is a registry of *reduction functions* of the kind which can be declared using :func:`copyreg.pickle`. It is a mapping whose keys are classes and whose values are reduction functions. A reduction function takes a single argument of the associated class...
trusted_official_docs
CPython Docs
.. attribute:: dispatch_table A pickler object's dispatch table is a registry of *reduction functions* of the kind which can be declared using :func:`copyreg.pickle`. It is a mapping whose keys are classes and whose values are reduction functions. A reduction function takes a single argument of the associated class...
.. attribute:: dispatch_table A pickler object's dispatch table is a registry of *reduction functions* of the kind which can be declared using :func:`copyreg.pickle`. It is a mapping whose keys are classes and whose values are reduction functions. A reduction function takes a single argument of the associated class...
python, official-docs, cpython, P0
Local_Trusted_Corpus
42ec6782-eeb2-4b31-978f-399ff144e48c
CPython Docs
file://datasets/cpython/Doc/library/pickle.rst
unknown
d611e6ff-74a7-41e7-8f39-27f844eb2f66
32,536
supabase-export-v2
78c3d57cad40c253
protocol which implements the :meth:`~object.__reduce__` special method. The copy protocol provides a unified interface for retrieving the data necessary for pickling and copying objects. [#]_ Although powerful, implementing :meth:`~object.__reduce__` directly in your classes is error prone. For this reason, class desi...
trusted_official_docs
CPython Docs
protocol which implements the :meth:`~object.__reduce__` special method. The copy protocol provides a unified interface for retrieving the data necessary for pickling and copying objects. [#]_ Although powerful, implementing :meth:`~object.__reduce__` directly in your classes is error prone. For this reason, class desi...
protocol which implements the :meth:`~object.__reduce__` special method. The copy protocol provides a unified interface for retrieving the data necessary for pickling and copying objects. [#]_ Although powerful, implementing :meth:`~object.__reduce__` directly in your classes is error prone. For this reason, class desi...
python, official-docs, cpython, P0
Local_Trusted_Corpus
455a3326-5e31-4157-80e3-f12f4a8821a8
CPython Docs
file://datasets/cpython/Doc/library/pickle.rst
unknown
d611e6ff-74a7-41e7-8f39-27f844eb2f66
32,371
supabase-export-v2
4e3795954389f4d0
* JSON is interoperable and widely used outside of the Python ecosystem, while pickle is Python-specific; * JSON, by default, can only represent a subset of the Python built-in types, and no custom classes; pickle can represent an extremely large number of Python types (many of them automatically, by clever usage of...
trusted_official_docs
CPython Docs
* JSON is interoperable and widely used outside of the Python ecosystem, while pickle is Python-specific; * JSON, by default, can only represent a subset of the Python built-in types, and no custom classes; pickle can represent an extremely large number of Python types (many of them automatically, by clever usage of...
* JSON is interoperable and widely used outside of the Python ecosystem, while pickle is Python-specific; * JSON, by default, can only represent a subset of the Python built-in types, and no custom classes; pickle can represent an extremely large number of Python types (many of them automatically, by clever usage of...
python, official-docs, cpython, P0
Local_Trusted_Corpus
46606c46-daea-4e43-9ff8-e88f03cb40aa
CPython Docs
file://datasets/cpython/Doc/library/pickle.rst
unknown
d611e6ff-74a7-41e7-8f39-27f844eb2f66
32,460
supabase-export-v2
d2bd1d572561fb42
pickler has already seen, so that shared or recursive objects are pickled by reference and not by value. This method is useful when re-using picklers. .. class:: Unpickler(file, *, fix_imports=True, encoding="ASCII", errors="strict", buffers=None)
trusted_official_docs
CPython Docs
pickler has already seen, so that shared or recursive objects are pickled by reference and not by value. This method is useful when re-using picklers. .. class:: Unpickler(file, *, fix_imports=True, encoding="ASCII", errors="strict", buffers=None)
pickler has already seen, so that shared or recursive objects are pickled by reference and not by value. This method is useful when re-using picklers. .. class:: Unpickler(file, *, fix_imports=True, encoding="ASCII", errors="strict", buffers=None)
python, official-docs, cpython, P0
Local_Trusted_Corpus
4862626d-ec90-4b4e-87f7-9e0989d38c81
CPython Docs
file://datasets/cpython/Doc/library/pickle.rst
unknown
d611e6ff-74a7-41e7-8f39-27f844eb2f66
32,484
supabase-export-v2
0ea2da0a64eeffea
.. method:: raw() Return a :class:`memoryview` of the memory area underlying this buffer. The returned object is a one-dimensional, C-contiguous memoryview with format ``B`` (unsigned bytes). :exc:`BufferError` is raised if the buffer is neither C- nor Fortran-contiguous.
trusted_official_docs
CPython Docs
.. method:: raw() Return a :class:`memoryview` of the memory area underlying this buffer. The returned object is a one-dimensional, C-contiguous memoryview with format ``B`` (unsigned bytes). :exc:`BufferError` is raised if the buffer is neither C- nor Fortran-contiguous.
.. method:: raw() Return a :class:`memoryview` of the memory area underlying this buffer. The returned object is a one-dimensional, C-contiguous memoryview with format ``B`` (unsigned bytes). :exc:`BufferError` is raised if the buffer is neither C- nor Fortran-contiguous.
python, official-docs, cpython, P0
Local_Trusted_Corpus
48b7e97d-2c42-49bd-ac7a-ce83b0262023
CPython Docs
file://datasets/cpython/Doc/library/pickle.rst
unknown
d611e6ff-74a7-41e7-8f39-27f844eb2f66
32,482
supabase-export-v2
46851ec8615c409f
:class:`PickleBuffer` is itself a buffer provider, therefore it is possible to pass it to other APIs expecting a buffer-providing object, such as :class:`memoryview`. :class:`PickleBuffer` objects can only be serialized using pickle protocol 5 or higher. They are eligible for :ref:`out-of-band serialization <pickle-o...
trusted_official_docs
CPython Docs
:class:`PickleBuffer` is itself a buffer provider, therefore it is possible to pass it to other APIs expecting a buffer-providing object, such as :class:`memoryview`. :class:`PickleBuffer` objects can only be serialized using pickle protocol 5 or higher. They are eligible for :ref:`out-of-band serialization <pickle-o...
:class:`PickleBuffer` is itself a buffer provider, therefore it is possible to pass it to other APIs expecting a buffer-providing object, such as :class:`memoryview`. :class:`PickleBuffer` objects can only be serialized using pickle protocol 5 or higher. They are eligible for :ref:`out-of-band serialization <pickle-o...
python, official-docs, cpython, P0
Local_Trusted_Corpus
48d59e96-cbfe-41f4-9e89-0ba1b9213b9f
CPython Docs
file://datasets/cpython/Doc/library/pickle.rst
unknown
d611e6ff-74a7-41e7-8f39-27f844eb2f66
32,497
supabase-export-v2
fa28dc2873fe6a1b
* instances of such classes for which the result of calling :meth:`~object.__getstate__` is picklable (see section :ref:`pickle-inst` for details). Attempts to pickle unpicklable objects will raise the :exc:`PicklingError` exception; when this happens, an unspecified number of bytes may have already been written to the...
trusted_official_docs
CPython Docs
* instances of such classes for which the result of calling :meth:`~object.__getstate__` is picklable (see section :ref:`pickle-inst` for details). Attempts to pickle unpicklable objects will raise the :exc:`PicklingError` exception; when this happens, an unspecified number of bytes may have already been written to the...
* instances of such classes for which the result of calling :meth:`~object.__getstate__` is picklable (see section :ref:`pickle-inst` for details). Attempts to pickle unpicklable objects will raise the :exc:`PicklingError` exception; when this happens, an unspecified number of bytes may have already been written to the...
python, official-docs, cpython, P0
Local_Trusted_Corpus
4bde3ede-274a-41df-8cbe-8802008e302a
CPython Docs
file://datasets/cpython/Doc/library/pickle.rst
unknown
d611e6ff-74a7-41e7-8f39-27f844eb2f66
32,534
supabase-export-v2
1636b5c3600d863c
on some internal invariant being true, the type should implement :meth:`~object.__new__` to establish such an invariant, as :meth:`~object.__init__` is not called when unpickling an instance. .. index:: pair: copy; protocol
trusted_official_docs
CPython Docs
on some internal invariant being true, the type should implement :meth:`~object.__new__` to establish such an invariant, as :meth:`~object.__init__` is not called when unpickling an instance. .. index:: pair: copy; protocol
on some internal invariant being true, the type should implement :meth:`~object.__new__` to establish such an invariant, as :meth:`~object.__init__` is not called when unpickling an instance. .. index:: pair: copy; protocol
python, official-docs, cpython, P0
Local_Trusted_Corpus
4c1abefe-3faa-476b-8347-10b08f3359a2
CPython Docs
file://datasets/cpython/Doc/library/pickle.rst
unknown
d611e6ff-74a7-41e7-8f39-27f844eb2f66
32,609
supabase-export-v2
6a318eebab7d400e
they were passed to *buffer_callback*. Those buffers will provide the data expected by the reconstructors of the objects whose pickling produced the original :class:`PickleBuffer` objects. Between the sending side and the receiving side, the communications system is free to implement its own transfer mechanism for out-...
trusted_official_docs
CPython Docs
they were passed to *buffer_callback*. Those buffers will provide the data expected by the reconstructors of the objects whose pickling produced the original :class:`PickleBuffer` objects. Between the sending side and the receiving side, the communications system is free to implement its own transfer mechanism for out-...
they were passed to *buffer_callback*. Those buffers will provide the data expected by the reconstructors of the objects whose pickling produced the original :class:`PickleBuffer` objects. Between the sending side and the receiving side, the communications system is free to implement its own transfer mechanism for out-...
python, official-docs, cpython, P0
Local_Trusted_Corpus
550995f2-46c3-48d4-8416-711393da41e7
CPython Docs
file://datasets/cpython/Doc/library/pickle.rst
unknown
d611e6ff-74a7-41e7-8f39-27f844eb2f66
32,634
supabase-export-v2
af5c215eae307d7b
from builtins. if module == "builtins" and name in safe_builtins: return getattr(builtins, name) # Forbid everything else. raise pickle.UnpicklingError("global '%s.%s' is forbidden" % (module, name)) def restricted_loads(s): """Helper function analogous to pickle.loads().""" return RestrictedUnpickler(io.BytesIO(s))....
trusted_official_docs
CPython Docs
from builtins. if module == "builtins" and name in safe_builtins: return getattr(builtins, name) # Forbid everything else. raise pickle.UnpicklingError("global '%s.%s' is forbidden" % (module, name)) def restricted_loads(s): """Helper function analogous to pickle.loads().""" return RestrictedUnpickler(io.BytesIO(s))....
from builtins. if module == "builtins" and name in safe_builtins: return getattr(builtins, name) # Forbid everything else. raise pickle.UnpicklingError("global '%s.%s' is forbidden" % (module, name)) def restricted_loads(s): """Helper function analogous to pickle.loads().""" return RestrictedUnpickler(io.BytesIO(s))....
python, official-docs, cpython, P0
Local_Trusted_Corpus
5623a2b8-c880-4cee-9684-ccfd79901c74
CPython Docs
file://datasets/cpython/Doc/library/pickle.rst
unknown
d611e6ff-74a7-41e7-8f39-27f844eb2f66
32,412
supabase-export-v2
feb1290a9390d7fb
the pickled representation of an object from the open :term:`file object` *file* and return the reconstituted object hierarchy specified therein. This is equivalent to ``Unpickler(file).load()``. The protocol version of the pickle is detected automatically, so no protocol argument is needed. Bytes past the pickled rep...
trusted_official_docs
CPython Docs
the pickled representation of an object from the open :term:`file object` *file* and return the reconstituted object hierarchy specified therein. This is equivalent to ``Unpickler(file).load()``. The protocol version of the pickle is detected automatically, so no protocol argument is needed. Bytes past the pickled rep...
the pickled representation of an object from the open :term:`file object` *file* and return the reconstituted object hierarchy specified therein. This is equivalent to ``Unpickler(file).load()``. The protocol version of the pickle is detected automatically, so no protocol argument is needed. Bytes past the pickled rep...
python, official-docs, cpython, P0
Local_Trusted_Corpus
5975ab0a-1240-47ee-b97c-d10b2c4b8b31
CPython Docs
file://datasets/cpython/Doc/library/pickle.rst
unknown
d611e6ff-74a7-41e7-8f39-27f844eb2f66
32,528
supabase-export-v2
1ce348046d683041
.. method:: object.__setstate__(state) Upon unpickling, if the class defines :meth:`__setstate__`, it is called with the unpickled state. In that case, there is no requirement for the state object to be a dictionary. Otherwise, the pickled state must be a dictionary and its items are assigned to the new instance's d...
trusted_official_docs
CPython Docs
.. method:: object.__setstate__(state) Upon unpickling, if the class defines :meth:`__setstate__`, it is called with the unpickled state. In that case, there is no requirement for the state object to be a dictionary. Otherwise, the pickled state must be a dictionary and its items are assigned to the new instance's d...
.. method:: object.__setstate__(state) Upon unpickling, if the class defines :meth:`__setstate__`, it is called with the unpickled state. In that case, there is no requirement for the state object to be a dictionary. Otherwise, the pickled state must be a dictionary and its items are assigned to the new instance's d...
python, official-docs, cpython, P0
Local_Trusted_Corpus
5bdc7105-23cf-41da-8488-897921e5ec07
CPython Docs
file://datasets/cpython/Doc/library/pickle.rst
unknown
d611e6ff-74a7-41e7-8f39-27f844eb2f66
32,618
supabase-export-v2
a7293d6cbb4e654d
b = ZeroCopyByteArray(b"abc") data = pickle.dumps(b, protocol=5) new_b = pickle.loads(data) print(b == new_b) # True print(b is new_b) # False: a copy was made But if we pass a *buffer_callback* and then give back the accumulated buffers when unserializing, we are able to get back the original object::
trusted_official_docs
CPython Docs
b = ZeroCopyByteArray(b"abc") data = pickle.dumps(b, protocol=5) new_b = pickle.loads(data) print(b == new_b) # True print(b is new_b) # False: a copy was made But if we pass a *buffer_callback* and then give back the accumulated buffers when unserializing, we are able to get back the original object::
b = ZeroCopyByteArray(b"abc") data = pickle.dumps(b, protocol=5) new_b = pickle.loads(data) print(b == new_b) # True print(b is new_b) # False: a copy was made But if we pass a *buffer_callback* and then give back the accumulated buffers when unserializing, we are able to get back the original object::
python, official-docs, cpython, P0
Local_Trusted_Corpus
5f22d5fa-ceea-43e9-bb1d-79d22a29b56b
CPython Docs
file://datasets/cpython/Doc/library/pickle.rst
unknown
d611e6ff-74a7-41e7-8f39-27f844eb2f66
32,382
supabase-export-v2
cdc0e5d4d967dcec
* Protocol version 0 is the original "human-readable" protocol and is backwards compatible with earlier versions of Python. * Protocol version 1 is an old binary format which is also compatible with earlier versions of Python.
trusted_official_docs
CPython Docs
* Protocol version 0 is the original "human-readable" protocol and is backwards compatible with earlier versions of Python. * Protocol version 1 is an old binary format which is also compatible with earlier versions of Python.
* Protocol version 0 is the original "human-readable" protocol and is backwards compatible with earlier versions of Python. * Protocol version 1 is an old binary format which is also compatible with earlier versions of Python.
python, official-docs, cpython, P0
Local_Trusted_Corpus
60df0c9f-9b1c-4335-b656-68638eb17f99
CPython Docs
file://datasets/cpython/Doc/library/pickle.rst
unknown
d611e6ff-74a7-41e7-8f39-27f844eb2f66
32,498
supabase-export-v2
d4ea7d22d7136ed0
recursive data structure may exceed the maximum recursion depth, a :exc:`RecursionError` will be raised in this case. You can carefully raise this limit with :func:`sys.setrecursionlimit`. Note that functions (built-in and user-defined) are pickled by fully :term:`qualified name`, not by value. [#]_ This means that onl...
trusted_official_docs
CPython Docs
recursive data structure may exceed the maximum recursion depth, a :exc:`RecursionError` will be raised in this case. You can carefully raise this limit with :func:`sys.setrecursionlimit`. Note that functions (built-in and user-defined) are pickled by fully :term:`qualified name`, not by value. [#]_ This means that onl...
recursive data structure may exceed the maximum recursion depth, a :exc:`RecursionError` will be raised in this case. You can carefully raise this limit with :func:`sys.setrecursionlimit`. Note that functions (built-in and user-defined) are pickled by fully :term:`qualified name`, not by value. [#]_ This means that onl...
python, official-docs, cpython, P0
Local_Trusted_Corpus
65e7efa8-7deb-43be-b17d-4d1b0c3ea35b
CPython Docs
file://datasets/cpython/Doc/library/pickle.rst
unknown
d611e6ff-74a7-41e7-8f39-27f844eb2f66
32,394
supabase-export-v2
523e5ee7b0c36dd9
.. data:: DEFAULT_PROTOCOL An integer, the default :ref:`protocol version <pickle-protocols>` used for pickling. May be less than :data:`HIGHEST_PROTOCOL`. Currently the default protocol is 5, introduced in Python 3.8 and incompatible with previous versions. This version introduces support for out-of-band buffers, ...
trusted_official_docs
CPython Docs
.. data:: DEFAULT_PROTOCOL An integer, the default :ref:`protocol version <pickle-protocols>` used for pickling. May be less than :data:`HIGHEST_PROTOCOL`. Currently the default protocol is 5, introduced in Python 3.8 and incompatible with previous versions. This version introduces support for out-of-band buffers, ...
.. data:: DEFAULT_PROTOCOL An integer, the default :ref:`protocol version <pickle-protocols>` used for pickling. May be less than :data:`HIGHEST_PROTOCOL`. Currently the default protocol is 5, introduced in Python 3.8 and incompatible with previous versions. This version introduces support for out-of-band buffers, ...
python, official-docs, cpython, P0
Local_Trusted_Corpus
660aa6b0-3d6f-4c29-acb2-d55cb5a6e573
CPython Docs
file://datasets/cpython/Doc/library/pickle.rst
unknown
d611e6ff-74a7-41e7-8f39-27f844eb2f66
32,548
supabase-export-v2
fb26886774166afd
the state-updating behavior of a specific object, instead of using ``obj``'s static :meth:`__setstate__` method. If not ``None``, this callable will have priority over ``obj``'s :meth:`__setstate__`. .. versionadded:: 3.8 The optional sixth tuple item, ``(obj, state)``, was added.
trusted_official_docs
CPython Docs
the state-updating behavior of a specific object, instead of using ``obj``'s static :meth:`__setstate__` method. If not ``None``, this callable will have priority over ``obj``'s :meth:`__setstate__`. .. versionadded:: 3.8 The optional sixth tuple item, ``(obj, state)``, was added.
the state-updating behavior of a specific object, instead of using ``obj``'s static :meth:`__setstate__` method. If not ``None``, this callable will have priority over ``obj``'s :meth:`__setstate__`. .. versionadded:: 3.8 The optional sixth tuple item, ``(obj, state)``, was added.
python, official-docs, cpython, P0
Local_Trusted_Corpus
6a5b77a7-c428-432d-962b-1fe1e352f3b3
CPython Docs
file://datasets/cpython/Doc/library/pickle.rst
unknown
d611e6ff-74a7-41e7-8f39-27f844eb2f66
32,550
supabase-export-v2
28ac24b1323e85b9
.. method:: object.__reduce_ex__(protocol) Alternatively, a :meth:`__reduce_ex__` method may be defined. The only difference is this method should take a single integer argument, the protocol version. When defined, pickle will prefer it over the :meth:`__reduce__` method. In addition, :meth:`__reduce__` automaticall...
trusted_official_docs
CPython Docs
.. method:: object.__reduce_ex__(protocol) Alternatively, a :meth:`__reduce_ex__` method may be defined. The only difference is this method should take a single integer argument, the protocol version. When defined, pickle will prefer it over the :meth:`__reduce__` method. In addition, :meth:`__reduce__` automaticall...
.. method:: object.__reduce_ex__(protocol) Alternatively, a :meth:`__reduce_ex__` method may be defined. The only difference is this method should take a single integer argument, the protocol version. When defined, pickle will prefer it over the :meth:`__reduce__` method. In addition, :meth:`__reduce__` automaticall...
python, official-docs, cpython, P0
Local_Trusted_Corpus
70cbfa1f-4857-4e3e-9263-55b5d421d9ef
CPython Docs
file://datasets/cpython/Doc/library/pickle.rst
unknown
d611e6ff-74a7-41e7-8f39-27f844eb2f66
32,373
supabase-export-v2
c43274db949617e6
* Unlike pickle, deserializing untrusted JSON does not in itself create an arbitrary code execution vulnerability. .. seealso:: The :mod:`json` module: a standard library module allowing JSON serialization and deserialization.
trusted_official_docs
CPython Docs
* Unlike pickle, deserializing untrusted JSON does not in itself create an arbitrary code execution vulnerability. .. seealso:: The :mod:`json` module: a standard library module allowing JSON serialization and deserialization.
* Unlike pickle, deserializing untrusted JSON does not in itself create an arbitrary code execution vulnerability. .. seealso:: The :mod:`json` module: a standard library module allowing JSON serialization and deserialization.
python, official-docs, cpython, P0
Local_Trusted_Corpus
726596bb-b942-47c1-9c2b-7e95a5e116ed
CPython Docs
file://datasets/cpython/Doc/library/pickle.rst
unknown
d611e6ff-74a7-41e7-8f39-27f844eb2f66
32,448
supabase-export-v2
4cb1cd5974c99eb9
are reduction functions. A reduction function takes a single argument of the associated class and should conform to the same interface as a :meth:`~object.__reduce__` method. By default, a pickler object will not have a :attr:`dispatch_table` attribute, and it will instead use the global dispatch table managed by the...
trusted_official_docs
CPython Docs
are reduction functions. A reduction function takes a single argument of the associated class and should conform to the same interface as a :meth:`~object.__reduce__` method. By default, a pickler object will not have a :attr:`dispatch_table` attribute, and it will instead use the global dispatch table managed by the...
are reduction functions. A reduction function takes a single argument of the associated class and should conform to the same interface as a :meth:`~object.__reduce__` method. By default, a pickler object will not have a :attr:`dispatch_table` attribute, and it will instead use the global dispatch table managed by the...
python, official-docs, cpython, P0
Local_Trusted_Corpus
72e4d8db-d811-47da-afdb-38ba39f3b242
CPython Docs
file://datasets/cpython/Doc/library/pickle.rst
unknown
d611e6ff-74a7-41e7-8f39-27f844eb2f66
32,544
supabase-export-v2
53b95e55affd461c
* A tuple of arguments for the callable object. An empty tuple must be given if the callable does not accept any argument. * Optionally, the object's state, which will be passed to the object's :meth:`__setstate__` method as previously described. If the object has no such method then, the value must be a dictionary a...
trusted_official_docs
CPython Docs
* A tuple of arguments for the callable object. An empty tuple must be given if the callable does not accept any argument. * Optionally, the object's state, which will be passed to the object's :meth:`__setstate__` method as previously described. If the object has no such method then, the value must be a dictionary a...
* A tuple of arguments for the callable object. An empty tuple must be given if the callable does not accept any argument. * Optionally, the object's state, which will be passed to the object's :meth:`__setstate__` method as previously described. If the object has no such method then, the value must be a dictionary a...
python, official-docs, cpython, P0
Local_Trusted_Corpus
7339518d-a5ed-474b-950f-de33869f8e79
CPython Docs
file://datasets/cpython/Doc/library/pickle.rst
unknown
d611e6ff-74a7-41e7-8f39-27f844eb2f66
32,592
supabase-export-v2
6eb56938cfb914ea
class MyClass: my_attribute = 1 class MyPickler(pickle.Pickler): def reducer_override(self, obj): """Custom reducer for MyClass.""" if getattr(obj, "__name__", None) == "MyClass": return type, (obj.__name__, obj.__bases__, {'my_attribute': obj.my_attribute}) else: # For any other object, fallback to usual reduct...
trusted_official_docs
CPython Docs
class MyClass: my_attribute = 1 class MyPickler(pickle.Pickler): def reducer_override(self, obj): """Custom reducer for MyClass.""" if getattr(obj, "__name__", None) == "MyClass": return type, (obj.__name__, obj.__bases__, {'my_attribute': obj.my_attribute}) else: # For any other object, fallback to usual reduct...
class MyClass: my_attribute = 1 class MyPickler(pickle.Pickler): def reducer_override(self, obj): """Custom reducer for MyClass.""" if getattr(obj, "__name__", None) == "MyClass": return type, (obj.__name__, obj.__bases__, {'my_attribute': obj.my_attribute}) else: # For any other object, fallback to usual reduct...
python, official-docs, cpython, P0
Local_Trusted_Corpus
738eb2c5-ddec-418c-9502-e60cadf625b3
CPython Docs
file://datasets/cpython/Doc/library/pickle.rst
unknown
d611e6ff-74a7-41e7-8f39-27f844eb2f66
32,453
supabase-export-v2
eeea05feeecf14de
:attr:`dispatch_table`. It should conform to the same interface as a :meth:`~object.__reduce__` method, and can optionally return :data:`NotImplemented` to fallback on :attr:`dispatch_table`-registered reducers to pickle ``obj``. For a detailed example, see :ref:`reducer_override`.
trusted_official_docs
CPython Docs
:attr:`dispatch_table`. It should conform to the same interface as a :meth:`~object.__reduce__` method, and can optionally return :data:`NotImplemented` to fallback on :attr:`dispatch_table`-registered reducers to pickle ``obj``. For a detailed example, see :ref:`reducer_override`.
:attr:`dispatch_table`. It should conform to the same interface as a :meth:`~object.__reduce__` method, and can optionally return :data:`NotImplemented` to fallback on :attr:`dispatch_table`-registered reducers to pickle ``obj``. For a detailed example, see :ref:`reducer_override`.
python, official-docs, cpython, P0
Local_Trusted_Corpus
7791f35d-60d5-4ce5-9aad-7f5e226f17f9
CPython Docs
file://datasets/cpython/Doc/library/pickle.rst
unknown
d611e6ff-74a7-41e7-8f39-27f844eb2f66
32,645
supabase-export-v2
811b141af91bf076
An arbitrary collection of objects supported by pickle. data = { 'a': [1, 2.0, 3+4j], 'b': ("character string", b"byte string"), 'c': {None, True, False} } with open('data.pickle', 'wb') as f: # Pickle the 'data' dictionary using the highest protocol available. pickle.dump(data, f, pickle.HIGHEST_PROTOCOL)
trusted_official_docs
CPython Docs
An arbitrary collection of objects supported by pickle. data = { 'a': [1, 2.0, 3+4j], 'b': ("character string", b"byte string"), 'c': {None, True, False} } with open('data.pickle', 'wb') as f: # Pickle the 'data' dictionary using the highest protocol available. pickle.dump(data, f, pickle.HIGHEST_PROTOCOL)
An arbitrary collection of objects supported by pickle. data = { 'a': [1, 2.0, 3+4j], 'b': ("character string", b"byte string"), 'c': {None, True, False} } with open('data.pickle', 'wb') as f: # Pickle the 'data' dictionary using the highest protocol available. pickle.dump(data, f, pickle.HIGHEST_PROTOCOL)
python, official-docs, cpython, P0
Local_Trusted_Corpus
7829bae9-1895-4f7c-a45c-1cef72f01480
CPython Docs
file://datasets/cpython/Doc/library/pickle.rst
unknown
d611e6ff-74a7-41e7-8f39-27f844eb2f66
32,625
supabase-export-v2
a0e17884966d9fb3
.. index:: single: find_class() (pickle protocol) By default, unpickling will import any class or function that it finds in the pickle data. For many applications, this behaviour is unacceptable as it permits the unpickler to import and invoke arbitrary code. Just consider what this hand-crafted pickle data stream does...
trusted_official_docs
CPython Docs
.. index:: single: find_class() (pickle protocol) By default, unpickling will import any class or function that it finds in the pickle data. For many applications, this behaviour is unacceptable as it permits the unpickler to import and invoke arbitrary code. Just consider what this hand-crafted pickle data stream does...
.. index:: single: find_class() (pickle protocol) By default, unpickling will import any class or function that it finds in the pickle data. For many applications, this behaviour is unacceptable as it permits the unpickler to import and invoke arbitrary code. Just consider what this hand-crafted pickle data stream does...
python, official-docs, cpython, P0
Local_Trusted_Corpus
78344df8-3b53-4679-ac98-efc9801c1a45
CPython Docs
file://datasets/cpython/Doc/library/pickle.rst
unknown
d611e6ff-74a7-41e7-8f39-27f844eb2f66
32,509
supabase-export-v2
d43bf51ba771e440
*not* invoked. The default behaviour first creates an uninitialized instance and then restores the saved attributes. The following code shows an implementation of this behaviour:: def save(obj): return (obj.__class__, obj.__dict__)
trusted_official_docs
CPython Docs
*not* invoked. The default behaviour first creates an uninitialized instance and then restores the saved attributes. The following code shows an implementation of this behaviour:: def save(obj): return (obj.__class__, obj.__dict__)
*not* invoked. The default behaviour first creates an uninitialized instance and then restores the saved attributes. The following code shows an implementation of this behaviour:: def save(obj): return (obj.__class__, obj.__dict__)
python, official-docs, cpython, P0
Local_Trusted_Corpus
78c1e762-44d2-4cc8-be2a-75f7526c6de9
CPython Docs
file://datasets/cpython/Doc/library/pickle.rst
unknown
d611e6ff-74a7-41e7-8f39-27f844eb2f66
32,384
supabase-export-v2
3e14acf4d7f92530
in Python 2.3. It provides much more efficient pickling of :term:`new-style classes <new-style class>`. Refer to :pep:`307` for information about improvements brought by protocol 2. * Protocol version 3 was added in Python 3.0. It has explicit support for :class:`bytes` objects and cannot be unpickled by Python 2.x. T...
trusted_official_docs
CPython Docs
in Python 2.3. It provides much more efficient pickling of :term:`new-style classes <new-style class>`. Refer to :pep:`307` for information about improvements brought by protocol 2. * Protocol version 3 was added in Python 3.0. It has explicit support for :class:`bytes` objects and cannot be unpickled by Python 2.x. T...
in Python 2.3. It provides much more efficient pickling of :term:`new-style classes <new-style class>`. Refer to :pep:`307` for information about improvements brought by protocol 2. * Protocol version 3 was added in Python 3.0. It has explicit support for :class:`bytes` objects and cannot be unpickled by Python 2.x. T...
python, official-docs, cpython, P0
Local_Trusted_Corpus
7a53b141-0abc-48b6-9d6a-68c8581b0ab3
CPython Docs
file://datasets/cpython/Doc/library/pickle.rst
unknown
d611e6ff-74a7-41e7-8f39-27f844eb2f66
32,557
supabase-export-v2
a7f0fe7cf161fc92
ID string is returned, the pickler will pickle that object, along with a marker so that the unpickler will recognize it as a persistent ID. To unpickle external objects, the unpickler must have a custom :meth:`~Unpickler.persistent_load` method that takes a persistent ID object and returns the referenced object.
trusted_official_docs
CPython Docs
ID string is returned, the pickler will pickle that object, along with a marker so that the unpickler will recognize it as a persistent ID. To unpickle external objects, the unpickler must have a custom :meth:`~Unpickler.persistent_load` method that takes a persistent ID object and returns the referenced object.
ID string is returned, the pickler will pickle that object, along with a marker so that the unpickler will recognize it as a persistent ID. To unpickle external objects, the unpickler must have a custom :meth:`~Unpickler.persistent_load` method that takes a persistent ID object and returns the referenced object.
python, official-docs, cpython, P0
Local_Trusted_Corpus
7cbb991a-7556-4459-be9d-cf3f75ee9212
CPython Docs
file://datasets/cpython/Doc/library/pickle.rst
unknown
d611e6ff-74a7-41e7-8f39-27f844eb2f66
32,586
supabase-export-v2
7b25751e25977150
may want to customize pickling based on another criterion than the object's type, or we may want to customize the pickling of functions and classes. For those cases, it is possible to subclass from the :class:`Pickler` class and implement a :meth:`~Pickler.reducer_override` method. This method can return an arbitrary r...
trusted_official_docs
CPython Docs
may want to customize pickling based on another criterion than the object's type, or we may want to customize the pickling of functions and classes. For those cases, it is possible to subclass from the :class:`Pickler` class and implement a :meth:`~Pickler.reducer_override` method. This method can return an arbitrary r...
may want to customize pickling based on another criterion than the object's type, or we may want to customize the pickling of functions and classes. For those cases, it is possible to subclass from the :class:`Pickler` class and implement a :meth:`~Pickler.reducer_override` method. This method can return an arbitrary r...
python, official-docs, cpython, P0
Local_Trusted_Corpus
7d3ac6fb-d197-4451-aa84-a4ed7a1a6e68
CPython Docs
file://datasets/cpython/Doc/library/pickle.rst
unknown
d611e6ff-74a7-41e7-8f39-27f844eb2f66
32,358
supabase-export-v2
c5bf76260dc19978
Consider signing data with :mod:`hmac` if you need to ensure that it has not been tampered with. Safer serialization formats such as :mod:`json` may be more appropriate if you are processing untrusted data. See :ref:`comparison-with-json`.
trusted_official_docs
CPython Docs
Consider signing data with :mod:`hmac` if you need to ensure that it has not been tampered with. Safer serialization formats such as :mod:`json` may be more appropriate if you are processing untrusted data. See :ref:`comparison-with-json`.
Consider signing data with :mod:`hmac` if you need to ensure that it has not been tampered with. Safer serialization formats such as :mod:`json` may be more appropriate if you are processing untrusted data. See :ref:`comparison-with-json`.
python, official-docs, cpython, P0
Local_Trusted_Corpus
7ec0e567-4e32-44fa-8e09-2dcdf096d5f9
CPython Docs
file://datasets/cpython/Doc/library/pickle.rst
unknown
d611e6ff-74a7-41e7-8f39-27f844eb2f66
32,601
supabase-export-v2
935465412439c67a
module, as it transforms a graph-like structure of objects into a sequential stream of bytes, intrinsically involves copying data to and from the pickle stream. This constraint can be eschewed if both the *provider* (the implementation of the object types to be transferred) and the *consumer* (the implementation of the...
trusted_official_docs
CPython Docs
module, as it transforms a graph-like structure of objects into a sequential stream of bytes, intrinsically involves copying data to and from the pickle stream. This constraint can be eschewed if both the *provider* (the implementation of the object types to be transferred) and the *consumer* (the implementation of the...
module, as it transforms a graph-like structure of objects into a sequential stream of bytes, intrinsically involves copying data to and from the pickle stream. This constraint can be eschewed if both the *provider* (the implementation of the object types to be transferred) and the *consumer* (the implementation of the...
python, official-docs, cpython, P0
Local_Trusted_Corpus
84203e89-39b6-44aa-ac42-5a77fbd27ca7
CPython Docs
file://datasets/cpython/Doc/library/pickle.rst
unknown
d611e6ff-74a7-41e7-8f39-27f844eb2f66
32,478
supabase-export-v2
4df1956e827486f1
override this to gain control over what type of objects and how they can be loaded, potentially reducing security risks. Refer to :ref:`pickle-restrict` for details. .. audit-event:: pickle.find_class module,name pickle.Unpickler.find_class
trusted_official_docs
CPython Docs
override this to gain control over what type of objects and how they can be loaded, potentially reducing security risks. Refer to :ref:`pickle-restrict` for details. .. audit-event:: pickle.find_class module,name pickle.Unpickler.find_class
override this to gain control over what type of objects and how they can be loaded, potentially reducing security risks. Refer to :ref:`pickle-restrict` for details. .. audit-event:: pickle.find_class module,name pickle.Unpickler.find_class
python, official-docs, cpython, P0
Local_Trusted_Corpus
85af752b-29a8-49e2-bbef-ab538d8fe520
CPython Docs
file://datasets/cpython/Doc/library/pickle.rst
unknown
d611e6ff-74a7-41e7-8f39-27f844eb2f66
32,581
supabase-export-v2
5c687625bd78e9ff
A sample usage might be something like this:: >>> reader = TextReader("hello.txt") >>> reader.readline() '1: Hello world!' >>> reader.readline() '2: I am line number two.' >>> new_reader = pickle.loads(pickle.dumps(reader)) >>> new_reader.readline() '3: Goodbye!'
trusted_official_docs
CPython Docs
A sample usage might be something like this:: >>> reader = TextReader("hello.txt") >>> reader.readline() '1: Hello world!' >>> reader.readline() '2: I am line number two.' >>> new_reader = pickle.loads(pickle.dumps(reader)) >>> new_reader.readline() '3: Goodbye!'
A sample usage might be something like this:: >>> reader = TextReader("hello.txt") >>> reader.readline() '1: Hello world!' >>> reader.readline() '2: I am line number two.' >>> new_reader = pickle.loads(pickle.dumps(reader)) >>> new_reader.readline() '3: Goodbye!'
python, official-docs, cpython, P0
Local_Trusted_Corpus
87701df4-eb67-437b-8a1f-147095891941
CPython Docs
file://datasets/cpython/Doc/library/pickle.rst
unknown
d611e6ff-74a7-41e7-8f39-27f844eb2f66
32,466
supabase-export-v2
94b958b8a16c151e
contained in the pickle stream. This means that the *buffer_callback* argument was ``None`` when a :class:`Pickler` was instantiated (or when :func:`dump` or :func:`dumps` was called). If *buffers* is not ``None``, it should be an iterable of buffer-enabled objects that is consumed each time the pickle stream referenc...
trusted_official_docs
CPython Docs
contained in the pickle stream. This means that the *buffer_callback* argument was ``None`` when a :class:`Pickler` was instantiated (or when :func:`dump` or :func:`dumps` was called). If *buffers* is not ``None``, it should be an iterable of buffer-enabled objects that is consumed each time the pickle stream referenc...
contained in the pickle stream. This means that the *buffer_callback* argument was ``None`` when a :class:`Pickler` was instantiated (or when :func:`dump` or :func:`dumps` was called). If *buffers* is not ``None``, it should be an iterable of buffer-enabled objects that is consumed each time the pickle stream referenc...
python, official-docs, cpython, P0
Local_Trusted_Corpus
87a0df31-311b-4c51-95fd-4e9841bbb5ff
CPython Docs
file://datasets/cpython/Doc/library/pickle.rst
unknown
d611e6ff-74a7-41e7-8f39-27f844eb2f66
32,526
supabase-export-v2
7dd54649f9446c29
a tuple whose first item is ``None`` and whose second item is a dictionary mapping slot names to slot values described in the previous bullet. .. versionchanged:: 3.11 Added the default implementation of the ``__getstate__()`` method in the :class:`object` class.
trusted_official_docs
CPython Docs
a tuple whose first item is ``None`` and whose second item is a dictionary mapping slot names to slot values described in the previous bullet. .. versionchanged:: 3.11 Added the default implementation of the ``__getstate__()`` method in the :class:`object` class.
a tuple whose first item is ``None`` and whose second item is a dictionary mapping slot names to slot values described in the previous bullet. .. versionchanged:: 3.11 Added the default implementation of the ``__getstate__()`` method in the :class:`object` class.
python, official-docs, cpython, P0
Local_Trusted_Corpus
8bd36ee3-af2f-41cf-832e-c81f1ebc033b
CPython Docs
file://datasets/cpython/Doc/library/pickle.rst
unknown
d611e6ff-74a7-41e7-8f39-27f844eb2f66
32,608
supabase-export-v2
3253ad5492c35794
the object graph. Buffers accumulated by the *buffer_callback* will not see their data copied into the pickle stream, only a cheap marker will be inserted. On the receiving side, it needs to pass a *buffers* argument to :class:`Unpickler` (or to the :func:`load` or :func:`loads` function), which is an iterable of the b...
trusted_official_docs
CPython Docs
the object graph. Buffers accumulated by the *buffer_callback* will not see their data copied into the pickle stream, only a cheap marker will be inserted. On the receiving side, it needs to pass a *buffers* argument to :class:`Unpickler` (or to the :func:`load` or :func:`loads` function), which is an iterable of the b...
the object graph. Buffers accumulated by the *buffer_callback* will not see their data copied into the pickle stream, only a cheap marker will be inserted. On the receiving side, it needs to pass a *buffers* argument to :class:`Unpickler` (or to the :func:`load` or :func:`loads` function), which is an iterable of the b...
python, official-docs, cpython, P0
Local_Trusted_Corpus
8cfac9d6-4bd9-4fcc-b236-e790f73d8e6c
CPython Docs
file://datasets/cpython/Doc/library/pickle.rst
unknown
d611e6ff-74a7-41e7-8f39-27f844eb2f66
32,353
supabase-export-v2
d20bcf4dea032216
-------------- The :mod:`!pickle` module implements binary protocols for serializing and de-serializing a Python object structure. *"Pickling"* is the process whereby a Python object hierarchy is converted into a byte stream, and *"unpickling"* is the inverse operation, whereby a byte stream (from a :term:`binary file`...
trusted_official_docs
CPython Docs
-------------- The :mod:`!pickle` module implements binary protocols for serializing and de-serializing a Python object structure. *"Pickling"* is the process whereby a Python object hierarchy is converted into a byte stream, and *"unpickling"* is the inverse operation, whereby a byte stream (from a :term:`binary file`...
-------------- The :mod:`!pickle` module implements binary protocols for serializing and de-serializing a Python object structure. *"Pickling"* is the process whereby a Python object hierarchy is converted into a byte stream, and *"unpickling"* is the inverse operation, whereby a byte stream (from a :term:`binary file`...
python, official-docs, cpython, P0
Local_Trusted_Corpus
8d1d3845-bd28-4aa0-8d6b-0a1b2cd4e650
CPython Docs
file://datasets/cpython/Doc/library/pickle.rst
unknown
d611e6ff-74a7-41e7-8f39-27f844eb2f66
32,444
supabase-export-v2
aad68c512a3f949d
*obj*. The meaning of this persistent ID should be defined by :meth:`Unpickler.persistent_load`. Note that the value returned by :meth:`persistent_id` cannot itself have a persistent ID. See :ref:`pickle-persistent` for details and examples of uses.
trusted_official_docs
CPython Docs
*obj*. The meaning of this persistent ID should be defined by :meth:`Unpickler.persistent_load`. Note that the value returned by :meth:`persistent_id` cannot itself have a persistent ID. See :ref:`pickle-persistent` for details and examples of uses.
*obj*. The meaning of this persistent ID should be defined by :meth:`Unpickler.persistent_load`. Note that the value returned by :meth:`persistent_id` cannot itself have a persistent ID. See :ref:`pickle-persistent` for details and examples of uses.
python, official-docs, cpython, P0
Local_Trusted_Corpus
8de6cf30-14e5-454a-b588-a2bb88ffc3cb
CPython Docs
file://datasets/cpython/Doc/library/pickle.rst
unknown
d611e6ff-74a7-41e7-8f39-27f844eb2f66
32,669
supabase-export-v2
adb80693b04f88e4
.. [#] The :mod:`copy` module uses this protocol for shallow and deep copying operations. .. [#] The limitation on alphanumeric characters is due to the fact that persistent IDs in protocol 0 are delimited by the newline character. Therefore if any kind of newline characters occurs in persistent IDs, the resulting p...
trusted_official_docs
CPython Docs
.. [#] The :mod:`copy` module uses this protocol for shallow and deep copying operations. .. [#] The limitation on alphanumeric characters is due to the fact that persistent IDs in protocol 0 are delimited by the newline character. Therefore if any kind of newline characters occurs in persistent IDs, the resulting p...
.. [#] The :mod:`copy` module uses this protocol for shallow and deep copying operations. .. [#] The limitation on alphanumeric characters is due to the fact that persistent IDs in protocol 0 are delimited by the newline character. Therefore if any kind of newline characters occurs in persistent IDs, the resulting p...
python, official-docs, cpython, P0
Local_Trusted_Corpus
9110962a-b9f8-4010-aba8-c4912dfb44fe
CPython Docs
file://datasets/cpython/Doc/library/pickle.rst
unknown
d611e6ff-74a7-41e7-8f39-27f844eb2f66
32,626
supabase-export-v2
07f646e2568be6dc
behaviour is unacceptable as it permits the unpickler to import and invoke arbitrary code. Just consider what this hand-crafted pickle data stream does when loaded:: >>> import pickle >>> pickle.loads(b"cos\nsystem\n(S'echo hello world'\ntR.") hello world 0
trusted_official_docs
CPython Docs
behaviour is unacceptable as it permits the unpickler to import and invoke arbitrary code. Just consider what this hand-crafted pickle data stream does when loaded:: >>> import pickle >>> pickle.loads(b"cos\nsystem\n(S'echo hello world'\ntR.") hello world 0
behaviour is unacceptable as it permits the unpickler to import and invoke arbitrary code. Just consider what this hand-crafted pickle data stream does when loaded:: >>> import pickle >>> pickle.loads(b"cos\nsystem\n(S'echo hello world'\ntR.") hello world 0
python, official-docs, cpython, P0
Local_Trusted_Corpus
9149e12e-443f-4dd1-993a-d5bdb76692d4
CPython Docs
file://datasets/cpython/Doc/library/pickle.rst
unknown
d611e6ff-74a7-41e7-8f39-27f844eb2f66
32,361
supabase-export-v2
a77307d5705d9ea2
Comparison with ``marshal`` ^^^^^^^^^^^^^^^^^^^^^^^^^^^ Python has a more primitive serialization module called :mod:`marshal`, but in general :mod:`!pickle` should always be the preferred way to serialize Python objects. :mod:`marshal` exists primarily to support Python's :file:`.pyc` files.
trusted_official_docs
CPython Docs
Comparison with ``marshal`` ^^^^^^^^^^^^^^^^^^^^^^^^^^^ Python has a more primitive serialization module called :mod:`marshal`, but in general :mod:`!pickle` should always be the preferred way to serialize Python objects. :mod:`marshal` exists primarily to support Python's :file:`.pyc` files.
Comparison with ``marshal`` ^^^^^^^^^^^^^^^^^^^^^^^^^^^ Python has a more primitive serialization module called :mod:`marshal`, but in general :mod:`!pickle` should always be the preferred way to serialize Python objects. :mod:`marshal` exists primarily to support Python's :file:`.pyc` files.
python, official-docs, cpython, P0
Local_Trusted_Corpus
942c4527-adb9-4587-8922-f4a5f24652f8
CPython Docs
file://datasets/cpython/Doc/library/pickle.rst
unknown
d611e6ff-74a7-41e7-8f39-27f844eb2f66
32,417
supabase-export-v2
53e5823dd3710945
Return the reconstituted object hierarchy of the pickled representation *data* of an object. *data* must be a :term:`bytes-like object`. The protocol version of the pickle is detected automatically, so no protocol argument is needed. Bytes past the pickled representation of the object are ignored.
trusted_official_docs
CPython Docs
Return the reconstituted object hierarchy of the pickled representation *data* of an object. *data* must be a :term:`bytes-like object`. The protocol version of the pickle is detected automatically, so no protocol argument is needed. Bytes past the pickled representation of the object are ignored.
Return the reconstituted object hierarchy of the pickled representation *data* of an object. *data* must be a :term:`bytes-like object`. The protocol version of the pickle is detected automatically, so no protocol argument is needed. Bytes past the pickled representation of the object are ignored.
python, official-docs, cpython, P0
Local_Trusted_Corpus
9472b6b4-7f21-4c6e-9679-ac27aeff9959
CPython Docs
file://datasets/cpython/Doc/library/pickle.rst
unknown
d611e6ff-74a7-41e7-8f39-27f844eb2f66
32,499
supabase-export-v2
dd86de35d4dd4c5c
the defining module must be importable in the unpickling environment, and the module must contain the named object, otherwise an exception will be raised. [#]_ Similarly, classes are pickled by fully qualified name, so the same restrictions in the unpickling environment apply. Note that none of the class's code or data...
trusted_official_docs
CPython Docs
the defining module must be importable in the unpickling environment, and the module must contain the named object, otherwise an exception will be raised. [#]_ Similarly, classes are pickled by fully qualified name, so the same restrictions in the unpickling environment apply. Note that none of the class's code or data...
the defining module must be importable in the unpickling environment, and the module must contain the named object, otherwise an exception will be raised. [#]_ Similarly, classes are pickled by fully qualified name, so the same restrictions in the unpickling environment apply. Note that none of the class's code or data...
python, official-docs, cpython, P0
Local_Trusted_Corpus
947fb7d4-ee94-4d96-a842-b5ad27a443f0
CPython Docs
file://datasets/cpython/Doc/library/pickle.rst
unknown
d611e6ff-74a7-41e7-8f39-27f844eb2f66
32,379
supabase-export-v2
78b05e10bc2a626f
By default, the :mod:`!pickle` data format uses a relatively compact binary representation. If you need optimal size characteristics, you can efficiently :doc:`compress <archiving>` pickled data. The module :mod:`pickletools` contains tools for analyzing data streams generated by :mod:`!pickle`. :mod:`pickletools` sour...
trusted_official_docs
CPython Docs
By default, the :mod:`!pickle` data format uses a relatively compact binary representation. If you need optimal size characteristics, you can efficiently :doc:`compress <archiving>` pickled data. The module :mod:`pickletools` contains tools for analyzing data streams generated by :mod:`!pickle`. :mod:`pickletools` sour...
By default, the :mod:`!pickle` data format uses a relatively compact binary representation. If you need optimal size characteristics, you can efficiently :doc:`compress <archiving>` pickled data. The module :mod:`pickletools` contains tools for analyzing data streams generated by :mod:`!pickle`. :mod:`pickletools` sour...
python, official-docs, cpython, P0
Local_Trusted_Corpus
98eca6f5-e4f8-4b1e-a013-227f1b73ce01
CPython Docs
file://datasets/cpython/Doc/library/pickle.rst
unknown
d611e6ff-74a7-41e7-8f39-27f844eb2f66
32,517
supabase-export-v2
13cdc23764f9003c
.. method:: object.__getnewargs__() This method serves a similar purpose as :meth:`__getnewargs_ex__`, but supports only positional arguments. It must return a tuple of arguments ``args`` which will be passed to the :meth:`__new__` method upon unpickling.
trusted_official_docs
CPython Docs
.. method:: object.__getnewargs__() This method serves a similar purpose as :meth:`__getnewargs_ex__`, but supports only positional arguments. It must return a tuple of arguments ``args`` which will be passed to the :meth:`__new__` method upon unpickling.
.. method:: object.__getnewargs__() This method serves a similar purpose as :meth:`__getnewargs_ex__`, but supports only positional arguments. It must return a tuple of arguments ``args`` which will be passed to the :meth:`__new__` method upon unpickling.
python, official-docs, cpython, P0
Local_Trusted_Corpus
992d2bbc-3cd1-408c-91f6-fff20308252f
CPython Docs
file://datasets/cpython/Doc/library/pickle.rst
unknown
d611e6ff-74a7-41e7-8f39-27f844eb2f66
32,522
supabase-export-v2
8ab7d79ebd77e1a5
:meth:`__getstate__`. It is called and the returned object is pickled as the contents for the instance, instead of a default state. There are several cases: * For a class that has no instance :attr:`~object.__dict__` and no :attr:`~object.__slots__`, the default state is ``None``.
trusted_official_docs
CPython Docs
:meth:`__getstate__`. It is called and the returned object is pickled as the contents for the instance, instead of a default state. There are several cases: * For a class that has no instance :attr:`~object.__dict__` and no :attr:`~object.__slots__`, the default state is ``None``.
:meth:`__getstate__`. It is called and the returned object is pickled as the contents for the instance, instead of a default state. There are several cases: * For a class that has no instance :attr:`~object.__dict__` and no :attr:`~object.__slots__`, the default state is ``None``.
python, official-docs, cpython, P0
Local_Trusted_Corpus
9be026ec-6337-450f-90a7-820c2fad697d
CPython Docs
file://datasets/cpython/Doc/library/pickle.rst
unknown
d611e6ff-74a7-41e7-8f39-27f844eb2f66
32,515
supabase-export-v2
24f3058251a8fde7
You should implement this method if the :meth:`__new__` method of your class requires keyword-only arguments. Otherwise, it is recommended for compatibility to implement :meth:`__getnewargs__`. .. versionchanged:: 3.6 :meth:`__getnewargs_ex__` is now used in protocols 2 and 3.
trusted_official_docs
CPython Docs
You should implement this method if the :meth:`__new__` method of your class requires keyword-only arguments. Otherwise, it is recommended for compatibility to implement :meth:`__getnewargs__`. .. versionchanged:: 3.6 :meth:`__getnewargs_ex__` is now used in protocols 2 and 3.
You should implement this method if the :meth:`__new__` method of your class requires keyword-only arguments. Otherwise, it is recommended for compatibility to implement :meth:`__getnewargs__`. .. versionchanged:: 3.6 :meth:`__getnewargs_ex__` is now used in protocols 2 and 3.
python, official-docs, cpython, P0
Local_Trusted_Corpus
9d496b17-08e7-4ef5-813a-6255ea54dfcc
CPython Docs
file://datasets/cpython/Doc/library/pickle.rst
unknown
d611e6ff-74a7-41e7-8f39-27f844eb2f66
32,428
supabase-export-v2
b6a2c240a2ee84ec
Error raised when there is a problem unpickling an object, such as a data corruption or a security violation. It inherits from :exc:`PickleError`. Note that other exceptions may also be raised during unpickling, including (but not necessarily limited to) AttributeError, EOFError, ImportError, and IndexError.
trusted_official_docs
CPython Docs
Error raised when there is a problem unpickling an object, such as a data corruption or a security violation. It inherits from :exc:`PickleError`. Note that other exceptions may also be raised during unpickling, including (but not necessarily limited to) AttributeError, EOFError, ImportError, and IndexError.
Error raised when there is a problem unpickling an object, such as a data corruption or a security violation. It inherits from :exc:`PickleError`. Note that other exceptions may also be raised during unpickling, including (but not necessarily limited to) AttributeError, EOFError, ImportError, and IndexError.
python, official-docs, cpython, P0
Local_Trusted_Corpus
9f304a5e-6b0f-440b-a7fd-31b39a687328
CPython Docs
file://datasets/cpython/Doc/library/pickle.rst
unknown
d611e6ff-74a7-41e7-8f39-27f844eb2f66
32,436
supabase-export-v2
5e2a0cfe9b6ffb0c
If *buffer_callback* is ``None`` (the default), buffer views are serialized into *file* as part of the pickle stream. If *buffer_callback* is not ``None``, then it can be called any number of times with a buffer view. If the callback returns a false value (such as ``None``), the given buffer is :ref:`out-of-band <pic...
trusted_official_docs
CPython Docs
If *buffer_callback* is ``None`` (the default), buffer views are serialized into *file* as part of the pickle stream. If *buffer_callback* is not ``None``, then it can be called any number of times with a buffer view. If the callback returns a false value (such as ``None``), the given buffer is :ref:`out-of-band <pic...
If *buffer_callback* is ``None`` (the default), buffer views are serialized into *file* as part of the pickle stream. If *buffer_callback* is not ``None``, then it can be called any number of times with a buffer view. If the callback returns a false value (such as ``None``), the given buffer is :ref:`out-of-band <pic...
python, official-docs, cpython, P0
Local_Trusted_Corpus
9f4a1e2d-990b-4a86-b9fb-f9dc97b4a74c
CPython Docs
file://datasets/cpython/Doc/library/pickle.rst
unknown
d611e6ff-74a7-41e7-8f39-27f844eb2f66
32,411
supabase-export-v2
b3038d82a2c1a844
.. function:: load(file, *, fix_imports=True, encoding="ASCII", errors="strict", buffers=None) Read the pickled representation of an object from the open :term:`file object` *file* and return the reconstituted object hierarchy specified therein. This is equivalent to ``Unpickler(file).load()``.
trusted_official_docs
CPython Docs
.. function:: load(file, *, fix_imports=True, encoding="ASCII", errors="strict", buffers=None) Read the pickled representation of an object from the open :term:`file object` *file* and return the reconstituted object hierarchy specified therein. This is equivalent to ``Unpickler(file).load()``.
.. function:: load(file, *, fix_imports=True, encoding="ASCII", errors="strict", buffers=None) Read the pickled representation of an object from the open :term:`file object` *file* and return the reconstituted object hierarchy specified therein. This is equivalent to ``Unpickler(file).load()``.
python, official-docs, cpython, P0
Local_Trusted_Corpus
a0a95716-516e-4085-b3ef-646a08768615
CPython Docs
file://datasets/cpython/Doc/library/pickle.rst
unknown
d611e6ff-74a7-41e7-8f39-27f844eb2f66
32,455
supabase-export-v2
c152051674d7872a
.. attribute:: fast Deprecated. Enable fast mode if set to a true value. The fast mode disables the usage of memo, therefore speeding the pickling process by not generating superfluous PUT opcodes. It should not be used with self-referential objects, doing otherwise will cause :class:`Pickler` to recurse infinitely...
trusted_official_docs
CPython Docs
.. attribute:: fast Deprecated. Enable fast mode if set to a true value. The fast mode disables the usage of memo, therefore speeding the pickling process by not generating superfluous PUT opcodes. It should not be used with self-referential objects, doing otherwise will cause :class:`Pickler` to recurse infinitely...
.. attribute:: fast Deprecated. Enable fast mode if set to a true value. The fast mode disables the usage of memo, therefore speeding the pickling process by not generating superfluous PUT opcodes. It should not be used with self-referential objects, doing otherwise will cause :class:`Pickler` to recurse infinitely...
python, official-docs, cpython, P0
Local_Trusted_Corpus
a161dbe7-e502-402c-95eb-5461ef4aac50
CPython Docs
file://datasets/cpython/Doc/library/pickle.rst
unknown
d611e6ff-74a7-41e7-8f39-27f844eb2f66
32,636
supabase-export-v2
7760167b18fbd3fa
A sample usage of our unpickler working as intended:: >>> restricted_loads(pickle.dumps([1, 2, range(15)])) [1, 2, range(0, 15)] >>> restricted_loads(b"cos\nsystem\n(S'echo hello world'\ntR.") Traceback (most recent call last): ... pickle.UnpicklingError: global 'os.system' is forbidden >>> restricted_loads(b'cbui...
trusted_official_docs
CPython Docs
A sample usage of our unpickler working as intended:: >>> restricted_loads(pickle.dumps([1, 2, range(15)])) [1, 2, range(0, 15)] >>> restricted_loads(b"cos\nsystem\n(S'echo hello world'\ntR.") Traceback (most recent call last): ... pickle.UnpicklingError: global 'os.system' is forbidden >>> restricted_loads(b'cbui...
A sample usage of our unpickler working as intended:: >>> restricted_loads(pickle.dumps([1, 2, range(15)])) [1, 2, range(0, 15)] >>> restricted_loads(b"cos\nsystem\n(S'echo hello world'\ntR.") Traceback (most recent call last): ... pickle.UnpicklingError: global 'os.system' is forbidden >>> restricted_loads(b'cbui...
python, official-docs, cpython, P0
Local_Trusted_Corpus
a44b48da-8619-4e16-b97b-8ae2766acd11
CPython Docs
file://datasets/cpython/Doc/library/pickle.rst
unknown
d611e6ff-74a7-41e7-8f39-27f844eb2f66
32,580
supabase-export-v2
00ee2a42b95c1bc7
read from it until the line count is restored. file = open(self.filename) for _ in range(self.lineno): file.readline() # Finally, save the file. self.file = file A sample usage might be something like this::
trusted_official_docs
CPython Docs
read from it until the line count is restored. file = open(self.filename) for _ in range(self.lineno): file.readline() # Finally, save the file. self.file = file A sample usage might be something like this::
read from it until the line count is restored. file = open(self.filename) for _ in range(self.lineno): file.readline() # Finally, save the file. self.file = file A sample usage might be something like this::
python, official-docs, cpython, P0
Local_Trusted_Corpus
a649c773-bba5-4b20-b046-28b39d87f187
CPython Docs
file://datasets/cpython/Doc/library/pickle.rst
unknown
d611e6ff-74a7-41e7-8f39-27f844eb2f66
32,390
supabase-export-v2
77dcbb833114fbe0
you call the :func:`loads` function. However, if you want more control over serialization and de-serialization, you can create a :class:`Pickler` or an :class:`Unpickler` object, respectively. The :mod:`!pickle` module provides the following constants:
trusted_official_docs
CPython Docs
you call the :func:`loads` function. However, if you want more control over serialization and de-serialization, you can create a :class:`Pickler` or an :class:`Unpickler` object, respectively. The :mod:`!pickle` module provides the following constants:
you call the :func:`loads` function. However, if you want more control over serialization and de-serialization, you can create a :class:`Pickler` or an :class:`Unpickler` object, respectively. The :mod:`!pickle` module provides the following constants:
python, official-docs, cpython, P0
Local_Trusted_Corpus
a66f2a71-01f2-4f6b-8e18-2ed018d26f63
CPython Docs
file://datasets/cpython/Doc/library/pickle.rst
unknown
d611e6ff-74a7-41e7-8f39-27f844eb2f66
32,628
supabase-export-v2
660f986aed60f3d9
then apply the string argument "echo hello world". Although this example is inoffensive, it is not difficult to imagine one that could damage your system. For this reason, you may want to control what gets unpickled by customizing :meth:`Unpickler.find_class`. Unlike its name suggests, :meth:`Unpickler.find_class` is c...
trusted_official_docs
CPython Docs
then apply the string argument "echo hello world". Although this example is inoffensive, it is not difficult to imagine one that could damage your system. For this reason, you may want to control what gets unpickled by customizing :meth:`Unpickler.find_class`. Unlike its name suggests, :meth:`Unpickler.find_class` is c...
then apply the string argument "echo hello world". Although this example is inoffensive, it is not difficult to imagine one that could damage your system. For this reason, you may want to control what gets unpickled by customizing :meth:`Unpickler.find_class`. Unlike its name suggests, :meth:`Unpickler.find_class` is c...
python, official-docs, cpython, P0
Local_Trusted_Corpus
a6fca680-615c-463a-885a-185e84490e21
CPython Docs
file://datasets/cpython/Doc/library/pickle.rst
unknown
d611e6ff-74a7-41e7-8f39-27f844eb2f66
32,543
supabase-export-v2
b1c067a71d34872d
* A callable object that will be called to create the initial version of the object. * A tuple of arguments for the callable object. An empty tuple must be given if the callable does not accept any argument.
trusted_official_docs
CPython Docs
* A callable object that will be called to create the initial version of the object. * A tuple of arguments for the callable object. An empty tuple must be given if the callable does not accept any argument.
* A callable object that will be called to create the initial version of the object. * A tuple of arguments for the callable object. An empty tuple must be given if the callable does not accept any argument.
python, official-docs, cpython, P0
Local_Trusted_Corpus
a7861672-7682-4d94-83f9-f8b8bb699ec0
CPython Docs
file://datasets/cpython/Doc/library/pickle.rst
unknown
d611e6ff-74a7-41e7-8f39-27f844eb2f66
32,615
supabase-export-v2
2eae01f494107267
buffer object obj = m.obj if type(obj) is cls: # Original buffer object is a ZeroCopyByteArray, return it # as-is. return obj else: return cls(obj) The reconstructor (the ``_reconstruct`` class method) returns the buffer's providing object if it has the right type. This is an easy way to simulate zero-copy behaviour on...
trusted_official_docs
CPython Docs
buffer object obj = m.obj if type(obj) is cls: # Original buffer object is a ZeroCopyByteArray, return it # as-is. return obj else: return cls(obj) The reconstructor (the ``_reconstruct`` class method) returns the buffer's providing object if it has the right type. This is an easy way to simulate zero-copy behaviour on...
buffer object obj = m.obj if type(obj) is cls: # Original buffer object is a ZeroCopyByteArray, return it # as-is. return obj else: return cls(obj) The reconstructor (the ``_reconstruct`` class method) returns the buffer's providing object if it has the right type. This is an easy way to simulate zero-copy behaviour on...
python, official-docs, cpython, P0
Local_Trusted_Corpus
a813d313-c655-4f54-9e77-afc3cc9b2ab0
CPython Docs
file://datasets/cpython/Doc/library/pickle.rst
unknown
d611e6ff-74a7-41e7-8f39-27f844eb2f66
32,545
supabase-export-v2
49d7d872481ded44
described. If the object has no such method then, the value must be a dictionary and it will be added to the object's :attr:`~object.__dict__` attribute. * Optionally, an iterator (and not a sequence) yielding successive items. These items will be appended to the object either using ``obj.append(item)`` or, in batch, ...
trusted_official_docs
CPython Docs
described. If the object has no such method then, the value must be a dictionary and it will be added to the object's :attr:`~object.__dict__` attribute. * Optionally, an iterator (and not a sequence) yielding successive items. These items will be appended to the object either using ``obj.append(item)`` or, in batch, ...
described. If the object has no such method then, the value must be a dictionary and it will be added to the object's :attr:`~object.__dict__` attribute. * Optionally, an iterator (and not a sequence) yielding successive items. These items will be appended to the object either using ``obj.append(item)`` or, in batch, ...
python, official-docs, cpython, P0
Local_Trusted_Corpus
a83cb1ef-3b5e-45e2-a048-544801d0b0e7
CPython Docs
file://datasets/cpython/Doc/library/pickle.rst
unknown
d611e6ff-74a7-41e7-8f39-27f844eb2f66
32,578
supabase-export-v2
ed1eef60e606a190
def readline(self): self.lineno += 1 line = self.file.readline() if not line: return None if line.endswith('\n'): line = line[:-1] return "%i: %s" % (self.lineno, line) def __getstate__(self): # Copy the object's state from self.__dict__ which contains # all our instance attributes. Always use the dict.copy() # meth...
trusted_official_docs
CPython Docs
def readline(self): self.lineno += 1 line = self.file.readline() if not line: return None if line.endswith('\n'): line = line[:-1] return "%i: %s" % (self.lineno, line) def __getstate__(self): # Copy the object's state from self.__dict__ which contains # all our instance attributes. Always use the dict.copy() # meth...
def readline(self): self.lineno += 1 line = self.file.readline() if not line: return None if line.endswith('\n'): line = line[:-1] return "%i: %s" % (self.lineno, line) def __getstate__(self): # Copy the object's state from self.__dict__ which contains # all our instance attributes. Always use the dict.copy() # meth...
python, official-docs, cpython, P0
Local_Trusted_Corpus
aa50281c-1492-4fff-851f-46885554aa3d
CPython Docs
file://datasets/cpython/Doc/library/pickle.rst
unknown
d611e6ff-74a7-41e7-8f39-27f844eb2f66
32,619
supabase-export-v2
577bfbd929bb9202
But if we pass a *buffer_callback* and then give back the accumulated buffers when unserializing, we are able to get back the original object:: b = ZeroCopyByteArray(b"abc") buffers = [] data = pickle.dumps(b, protocol=5, buffer_callback=buffers.append) new_b = pickle.loads(data, buffers=buffers) print(b == new_b) ...
trusted_official_docs
CPython Docs
But if we pass a *buffer_callback* and then give back the accumulated buffers when unserializing, we are able to get back the original object:: b = ZeroCopyByteArray(b"abc") buffers = [] data = pickle.dumps(b, protocol=5, buffer_callback=buffers.append) new_b = pickle.loads(data, buffers=buffers) print(b == new_b) ...
But if we pass a *buffer_callback* and then give back the accumulated buffers when unserializing, we are able to get back the original object:: b = ZeroCopyByteArray(b"abc") buffers = [] data = pickle.dumps(b, protocol=5, buffer_callback=buffers.append) new_b = pickle.loads(data, buffers=buffers) print(b == new_b) ...
python, official-docs, cpython, P0
Local_Trusted_Corpus
abf0de23-dbed-46d9-ac33-fcdf05a78794
CPython Docs
file://datasets/cpython/Doc/library/pickle.rst
unknown
d611e6ff-74a7-41e7-8f39-27f844eb2f66
32,429
supabase-export-v2
eaedc3e7dc4f1c53
Note that other exceptions may also be raised during unpickling, including (but not necessarily limited to) AttributeError, EOFError, ImportError, and IndexError. The :mod:`!pickle` module exports three classes, :class:`Pickler`, :class:`Unpickler` and :class:`PickleBuffer`:
trusted_official_docs
CPython Docs
Note that other exceptions may also be raised during unpickling, including (but not necessarily limited to) AttributeError, EOFError, ImportError, and IndexError. The :mod:`!pickle` module exports three classes, :class:`Pickler`, :class:`Unpickler` and :class:`PickleBuffer`:
Note that other exceptions may also be raised during unpickling, including (but not necessarily limited to) AttributeError, EOFError, ImportError, and IndexError. The :mod:`!pickle` module exports three classes, :class:`Pickler`, :class:`Unpickler` and :class:`PickleBuffer`:
python, official-docs, cpython, P0
Local_Trusted_Corpus
abfd5491-67db-45f4-b62b-97a9bc212bc6
CPython Docs
file://datasets/cpython/Doc/library/pickle.rst
unknown
d611e6ff-74a7-41e7-8f39-27f844eb2f66
32,362
supabase-export-v2
0824e3bb7f412c4c
module called :mod:`marshal`, but in general :mod:`!pickle` should always be the preferred way to serialize Python objects. :mod:`marshal` exists primarily to support Python's :file:`.pyc` files. The :mod:`!pickle` module differs from :mod:`marshal` in several significant ways:
trusted_official_docs
CPython Docs
module called :mod:`marshal`, but in general :mod:`!pickle` should always be the preferred way to serialize Python objects. :mod:`marshal` exists primarily to support Python's :file:`.pyc` files. The :mod:`!pickle` module differs from :mod:`marshal` in several significant ways:
module called :mod:`marshal`, but in general :mod:`!pickle` should always be the preferred way to serialize Python objects. :mod:`marshal` exists primarily to support Python's :file:`.pyc` files. The :mod:`!pickle` module differs from :mod:`marshal` in several significant ways:
python, official-docs, cpython, P0
Local_Trusted_Corpus