mirror of
https://github.com/python/cpython.git
synced 2025-11-25 04:34:37 +00:00
bpo-44289: Keep argument file object's current position in tarfile.is_tarfile (GH-26488)
This commit is contained in:
parent
d2d1d49eac
commit
128ab092ca
3 changed files with 15 additions and 0 deletions
|
|
@ -2493,7 +2493,9 @@ def is_tarfile(name):
|
|||
"""
|
||||
try:
|
||||
if hasattr(name, "read"):
|
||||
pos = name.tell()
|
||||
t = open(fileobj=name)
|
||||
name.seek(pos)
|
||||
else:
|
||||
t = open(name)
|
||||
t.close()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue