8000 gh-135273: Unify `ZoneInfo.from_file` signatures (#135274) · python/cpython@7cc8949 · GitHub
[go: up one dir, main page]

Skip to content

Commit 7cc8949

Browse files
authored
gh-135273: Unify ZoneInfo.from_file signatures (#135274)
Align `ZoneInfo.from_file` pure-Python signature with Argument Clinic signature.
1 parent 0243260 commit 7cc8949

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

Doc/library/zoneinfo.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ The ``ZoneInfo`` class
195195

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

198-
.. classmethod:: ZoneInfo.from_file(fobj, /, key=None)
198+
.. classmethod:: ZoneInfo.from_file(file_obj, /, key=None)
199199

200200
Constructs a ``ZoneInfo`` object from a file-like object returning bytes
201201
(e.g. a file opened in binary mode or an :class:`io.BytesIO` object).
@@ -325,7 +325,7 @@ The behavior of a ``ZoneInfo`` file depends on how it was constructed:
325325
>>> a is b
326326
False
327327
328-
3. ``ZoneInfo.from_file(fobj, /, key=None)``: When constructed from a file, the
328+
3. ``ZoneInfo.from_file(file_obj, /, key=None)``: When constructed from a file, the
329329
``ZoneInfo`` object raises an exception on pickling. If an end user wants to
330330
pickle a ``ZoneInfo`` constructed from a file, it is recommended that they
331331
use a wrapper type or a custom serialization function: either serializing by

Lib/zoneinfo/_zoneinfo.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,12 @@ def _new_instance(cls, key):
7575
return obj
7676

7777
@classmethod
78-
def from_file(cls, fobj, /, key=None):
78+
def from_file(cls, file_obj, /, key=None):
7979
obj = super().__new__(cls)
8080
obj._key = key
8181
obj._file_path = None
82-
obj._load_file(fobj)
83-
obj._file_repr = repr(fobj)
82+
obj._load_file(file_obj)
83+
obj._file_repr = repr(file_obj)
8484

8585
# Disable pickling for objects created from files
8686
obj.__reduce__ = obj._file_reduce

0 commit comments

Comments
 (0)
0