mercurial/utils/hashutil.py
author Matt Harbison <matt_harbison@yahoo.com>
Tue, 14 Dec 2021 17:29:30 -0500
changeset 48527 f8540fe4be0f
parent 46413 521ac0d7047f
child 48966 6000f5b25c9b
permissions -rw-r--r--
procutil: avoid an uninitialized variable usage on tempfile exception If `pycompat.unnamedtempfile()` raises an exception, it would have called `stdin.close()` in the `finally` block without it being initialized first. Differential Revision: https://phab.mercurial-scm.org/D11928

from __future__ import absolute_import

import hashlib

try:
    from ..thirdparty import sha1dc  # pytype: disable=import-error

    sha1 = sha1dc.sha1
except (ImportError, AttributeError):
    sha1 = hashlib.sha1