Andrei Kulakov <andrei....@gmail.com> added the comment:

This affects more use cases than just is_tarfile() and getmembers() results.

is_tarfile() calls open() which is the root cause of the issue. Calling open() 
2+ times will also cause the same issue.

In addition to getmembers(), extracting the tar will also silently fail. (and 
possibly other operations).

I've suggested a different fix in the comment on the PR:
https://github.com/python/cpython/pull/26488#issuecomment-989367707

----------
nosy: +andrei.avk
title: tarfile.is_tarfile() modifies file object's current position -> 
tarfile.is_tarfile() and tarfile.open() when used with file object may cause 
tarfile operations to fail

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue44289>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to