comparison mercurial/util.py @ 44989:7af5c1f5b3a0

util: flush stderr explicitly after using warnings.warn() Due to some unknown reasons, when using chg with python3, the warnings.warn() output is not flushed. Fixes test-devel-warnings.t on py3 with chg.
author Pulkit Goyal <7895pulkit@gmail.com>
date Fri, 19 Jun 2020 20:42:14 +0530
parents 3aed7d262bdf
children 4a503c1b664a
comparison
equal deleted inserted replaced
44988:fa151f7af275 44989:7af5c1f5b3a0
202 msg += ( 202 msg += (
203 b"\n(compatibility will be dropped after Mercurial-%s," 203 b"\n(compatibility will be dropped after Mercurial-%s,"
204 b" update your code.)" 204 b" update your code.)"
205 ) % version 205 ) % version
206 warnings.warn(pycompat.sysstr(msg), DeprecationWarning, stacklevel + 1) 206 warnings.warn(pycompat.sysstr(msg), DeprecationWarning, stacklevel + 1)
207 # on python 3 with chg, we will need to explicitly flush the output
208 sys.stderr.flush()
207 209
208 210
209 DIGESTS = { 211 DIGESTS = {
210 b'md5': hashlib.md5, 212 b'md5': hashlib.md5,
211 b'sha1': hashutil.sha1, 213 b'sha1': hashutil.sha1,