diff --git a/mitogen/core.py b/mitogen/core.py index 6ad7592e..b5f6a372 100644 --- a/mitogen/core.py +++ b/mitogen/core.py @@ -147,9 +147,12 @@ else: AnyTextType = (BytesType, UnicodeType) -if sys.version_info < (2, 5): +try: + next +except NameError: next = lambda it: it.next() + #: Default size for calls to :meth:`Side.read` or :meth:`Side.write`, and the #: size of buffers configured by :func:`mitogen.parent.create_socketpair`. This #: value has many performance implications, 128KiB seems to be a sweet spot. diff --git a/mitogen/parent.py b/mitogen/parent.py index 6305aca8..70a47cd4 100644 --- a/mitogen/parent.py +++ b/mitogen/parent.py @@ -63,6 +63,12 @@ from mitogen.core import b from mitogen.core import LOG from mitogen.core import IOLOG +try: + next +except NameError: + # Python 2.4/2.5 + from mitogen.core import next + itervalues = getattr(dict, 'itervalues', dict.values)