From 67264ed17437d808f54d93f25a76ecada118fe51 Mon Sep 17 00:00:00 2001 From: Alex Willmer Date: Tue, 13 Jan 2026 14:07:37 +0000 Subject: [PATCH] mitogen: Configure mitogen.core.now based on sys.version_info Simplify work of static type checkers, LSPs, etc. --- mitogen/core.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/mitogen/core.py b/mitogen/core.py index a742c39c..ccd363f6 100644 --- a/mitogen/core.py +++ b/mitogen/core.py @@ -102,6 +102,11 @@ if sys.version_info >= (3, 4): else: import imp +if sys.version_info >= (3, 3): + now = time.monotonic +else: + now = time.time + if sys.version_info >= (2, 5): def _update_linecache(path, data): pass else: @@ -402,10 +407,6 @@ def to_text(o): return UnicodeType(o) -# Documented in api.rst to work around Sphinx limitation. -now = getattr(time, 'monotonic', time.time) - - # Python 2.4 try: all, any = all, any