Mercurial > public > mercurial-scm > hg-stable
diff mercurial/chgserver.py @ 36789:ffa3026d4196
cleanup: use stat_result[stat.ST_MTIME] instead of stat_result.st_mtime
The latter is floating point by default, and we've been doing
os.stat_float_times(False). Unfortunately, os.stat_float_times was
removed between Python 3.7.0a1 and 3.7.0b2, so we have to stop using
it.
Differential Revision: https://phab.mercurial-scm.org/D2696
author | Augie Fackler <augie@google.com> |
---|---|
date | Mon, 05 Mar 2018 12:30:20 -0500 |
parents | 72b91f905065 |
children | 5bc7ff103081 |
line wrap: on
line diff
--- a/mercurial/chgserver.py Mon Mar 05 15:07:32 2018 -0500 +++ b/mercurial/chgserver.py Mon Mar 05 12:30:20 2018 -0500 @@ -45,6 +45,7 @@ import os import re import socket +import stat import struct import time @@ -161,7 +162,7 @@ def trystat(path): try: st = os.stat(path) - return (st.st_mtime, st.st_size) + return (st[stat.ST_MTIME], st.st_size) except OSError: # could be ENOENT, EPERM etc. not fatal in any case pass @@ -546,9 +547,9 @@ def _issocketowner(self): try: - stat = os.stat(self._realaddress) - return (stat.st_ino == self._socketstat.st_ino and - stat.st_mtime == self._socketstat.st_mtime) + st = os.stat(self._realaddress) + return (st.st_ino == self._socketstat.st_ino and + st[stat.ST_MTIME] == self._socketstat[stat.ST_MTIME]) except OSError: return False