FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-135273: Unify ZoneInfo.from_file signatures by hrimov · Pull Request #135274 · python/cpython · GitHub

Repository navigation

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .py  (1) .rst  (1) All 2 file types selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
4 changes: 2 additions & 2 deletions Doc/library/zoneinfo.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ The ``ZoneInfo`` class

The ``ZoneInfo`` class has two alternate constructors:

.. classmethod:: ZoneInfo.from_file(fobj, /, key=None)
.. classmethod:: ZoneInfo.from_file(file_obj, /, key=None)

Constructs a ``ZoneInfo`` object from a file-like object returning bytes
(e.g. a file opened in binary mode or an :class:`io.BytesIO` object).
Expand Down Expand Up @@ -325,7 +325,7 @@ The behavior of a ``ZoneInfo`` file depends on how it was constructed:
>>> a is b
False

3. ``ZoneInfo.from_file(fobj, /, key=None)``: When constructed from a file, the
3. ``ZoneInfo.from_file(file_obj, /, key=None)``: When constructed from a file, the
``ZoneInfo`` object raises an exception on pickling. If an end user wants to
pickle a ``ZoneInfo`` constructed from a file, it is recommended that they
use a wrapper type or a custom serialization function: either serializing by
Expand Down
6 changes: 3 additions & 3 deletions Lib/zoneinfo/_zoneinfo.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,12 @@ def _new_instance(cls, key):
return obj

@classmethod
def from_file(cls, fobj, /, key=None):
def from_file(cls, file_obj, /, key=None):
obj = super().__new__(cls)
obj._key = key
obj._file_path = None
obj._load_file(fobj)
obj._file_repr = repr(fobj)
obj._load_file(file_obj)
obj._file_repr = repr(file_obj)

# Disable pickling for objects created from files
obj.__reduce__ = obj._file_reduce
Expand Down

Back | FazBrowse Home | New Git URL