From 55bd5fd7a42e32cf1f77d0e27212598cf7de2382 Mon Sep 17 00:00:00 2001 From: Alex Willmer Date: Tue, 13 Jan 2026 14:13:17 +0000 Subject: [PATCH] mitogen: Provide mitogen.core.next based on sys.version_info Simplify work of static type checkers, LSPs, etc. --- mitogen/core.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/mitogen/core.py b/mitogen/core.py index 2debaf3e..9d3444db 100644 --- a/mitogen/core.py +++ b/mitogen/core.py @@ -124,6 +124,11 @@ else: def str_rpartition(s, sep): return _part(s, sep, s.rfind) or (u'', u'', s) def bytes_partition(s, sep): return _part(s, sep, s.find) or (s, '', '') +if sys.version_info >= (2, 6): + next = next +else: + def next(it): return it.next() + if sys.version_info >= (2, 5): def _update_linecache(path, data): pass else: @@ -222,11 +227,6 @@ else: AnyTextType = (BytesType, UnicodeType) -try: - next = next -except NameError: - next = lambda it: it.next() - # #550: prehistoric WSL did not advertise itself in uname output. try: fp = open('/proc/sys/kernel/osrelease')