This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients FFY00, belopolsky, gaborjbernat, lemburg, lukasz.langa, p-ganssle, vstinner
Date 2020-05-18.12:47:57
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1589806077.54.0.431635105586.issue40536@roundup.psfhosted.org>
In-reply-to
Content
def valid_key(fpath):
        try:
            with open(fpath, "rb") as f:
                return f.read(4) == b"TZif"
        except Exception:  # pragma: nocover
            return False


Why not only catching "except OSError:" rather than any exception?

Or even "except (FileNotFoundError, PermissionError):" if you want to be pedantic :-p
History
Date User Action Args
2020-05-18 12:47:57vstinnersetrecipients: + vstinner, lemburg, belopolsky, lukasz.langa, p-ganssle, gaborjbernat, FFY00
2020-05-18 12:47:57vstinnersetmessageid: <1589806077.54.0.431635105586.issue40536@roundup.psfhosted.org>
2020-05-18 12:47:57vstinnerlinkissue40536 messages
2020-05-18 12:47:57vstinnercreate