Merge pull request #7097 from radarhere/seek

`Image.open()` seeks to the start of file objects
This commit is contained in:
Hugo van Kemenade 2023-06-30 01:05:47 +03:00 committed by GitHub
commit 1174a9e7f4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3170,7 +3170,8 @@ def open(fp, mode="r", formats=None):
:param fp: A filename (string), pathlib.Path object or a file object. :param fp: A filename (string), pathlib.Path object or a file object.
The file object must implement ``file.read``, The file object must implement ``file.read``,
``file.seek``, and ``file.tell`` methods, ``file.seek``, and ``file.tell`` methods,
and be opened in binary mode. and be opened in binary mode. The file object will also seek to zero
before reading.
:param mode: The mode. If given, this argument must be "r". :param mode: The mode. If given, this argument must be "r".
:param formats: A list or tuple of formats to attempt to load the file in. :param formats: A list or tuple of formats to attempt to load the file in.
This can be used to restrict the set of formats checked. This can be used to restrict the set of formats checked.