Lines Matching defs:file
1048 * file and reuse the pickler buffer for the next frame so as
1050 * a file.
1184 _Pickler_SetOutputStream(PicklerObject *self, PyObject *file)
1186 assert(file != NULL);
1187 if (_PyObject_LookupAttr(file, &_Py_ID(write), &self->write) < 0) {
1192 "file must have a 'write' attribute");
1264 /* If reading from a file, we need to only pull the bytes we need, since there
1272 failure; on success, returns the number of bytes read from the file.
1275 unpickling from a file, the "we've run out of data" code paths will trigger,
1276 causing the Unpickler to go back to the file for more data. Use the returned
1294 /* Prefetch some data without advancing the file pointer, if possible */
1303 /* peek() is probably not supported by the given file object */
1386 /* Read from file */
1396 /* readinto() not supported on file-like object, fall back to read()
1454 Note that when reading from a file-like object, self->next_read_idx won't
1644 _Unpickler_SetInputStream(UnpicklerObject *self, PyObject *file)
1646 /* Optional file methods */
1647 if (_PyObject_LookupAttr(file, &_Py_ID(peek), &self->peek) < 0) {
1650 if (_PyObject_LookupAttr(file, &_Py_ID(readinto), &self->readinto) < 0) {
1653 (void)_PyObject_LookupAttr(file, &_Py_ID(read), &self->read);
1654 (void)_PyObject_LookupAttr(file, &_Py_ID(readline), &self->readline);
1658 "file must have 'read' and 'readline' attributes");
2283 The large contiguous data is written directly into the underlying file
2286 file.read calls in the loader.
2313 into the underlying file object. */
2315 /* Dump the output buffer to the file. */
2320 /* Stream write the payload into the file without going through the
4577 Write a pickled representation of the given object to the open file.
4695 file: object
4700 This takes a binary file for writing a pickle data stream.
4711 The *file* argument must have a write() method that accepts a single
4712 bytes argument. It can thus be a file object opened for binary
4721 serialized into *file* as part of the pickle stream.
4734 _pickle_Pickler___init___impl(PicklerObject *self, PyObject *file,
4746 if (_Pickler_SetOutputStream(self, file) < 0)
6984 Read a pickled object representation from the open file object given
7218 file: object
7225 This takes a binary file for reading a pickle data stream.
7231 The argument *file* must have two methods, a read() method that takes
7233 arguments. Both methods should return bytes. Thus *file* can be a
7234 binary file object opened for reading, an io.BytesIO object, or any
7248 _pickle_Unpickler___init___impl(UnpicklerObject *self, PyObject *file,
7257 if (_Unpickler_SetInputStream(self, file) < 0)
7640 file: object
7646 Write a pickled representation of obj to the open file object file.
7648 This is equivalent to ``Pickler(file, protocol).dump(obj)``, but may
7660 The *file* argument must have a write() method that accepts a single
7661 bytes argument. It can thus be a file object opened for binary
7670 into *file* as part of the pickle stream. It is an error if
7676 _pickle_dump_impl(PyObject *module, PyObject *obj, PyObject *file,
7689 if (_Pickler_SetOutputStream(pickler, file) < 0)
7735 into *file* as part of the pickle stream. It is an error if
7773 file: object
7780 Read and return an object from the pickle data stored in a file.
7782 This is equivalent to ``Unpickler(file).load()``, but may be more
7789 The argument *file* must have two methods, a read() method that takes
7791 arguments. Both methods should return bytes. Thus *file* can be a
7792 binary file object opened for reading, an io.BytesIO object, or any
7806 _pickle_load_impl(PyObject *module, PyObject *file, int fix_imports,
7817 if (_Unpickler_SetInputStream(unpickler, file) < 0)