From dbfcb238dec65f78bfcc1df2243a9a5a41d48a6b Mon Sep 17 00:00:00 2001 From: Itamar Turner-Trauring Date: Mon, 20 May 2019 10:14:41 -0400 Subject: [PATCH 1/4] Try enabling Python 3.5.2. --- .travis.yml | 1 + tox.ini | 1 + 2 files changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index 84c525c..95a1d4f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,6 +2,7 @@ language: python dist: xenial python: - "3.5" + - "3.5.2" - "3.6" - "3.7" - "pypy3" diff --git a/tox.ini b/tox.ini index 74f35dc..9954219 100644 --- a/tox.ini +++ b/tox.ini @@ -6,6 +6,7 @@ envlist = py35-numpy, py36, py37, pypy3, [travis] python = 3.5: py35-numpy, py35-twisted-latest + 3.5.2: py35-numpy 3.6: py36 3.7: py37, linters3, sphinx pypy3: pypy3 From 07047ac788dd2fc0d93bab072c7408c9c243fc2a Mon Sep 17 00:00:00 2001 From: Itamar Turner-Trauring Date: Mon, 20 May 2019 10:19:31 -0400 Subject: [PATCH 2/4] Fix for older versions of Python 3.5. --- docs/source/news.rst | 4 ++++ eliot/__init__.py | 9 +++++++++ 2 files changed, 13 insertions(+) diff --git a/docs/source/news.rst b/docs/source/news.rst index f42b06e..17c7b94 100644 --- a/docs/source/news.rst +++ b/docs/source/news.rst @@ -4,6 +4,10 @@ What's New 1.9.0 ^^^^^ +Bug fixes: + +* Older versions of Python 3.5, e.g. the 3.5.2 on Ubuntu Xenial, should work again. Fixes #418. + Features: * If you call ``to_file()/FileDestination()`` with a non-writable file, an diff --git a/eliot/__init__.py b/eliot/__init__.py index 8112060..3300d33 100644 --- a/eliot/__init__.py +++ b/eliot/__init__.py @@ -6,6 +6,15 @@ # Enable asyncio contextvars support in Python 3.5/3.6: if version_info < (3, 7): + # On Python 3.5.2 and earlier, some of the necessary attributes aren't exposed: + import asyncio + if getattr(asyncio, "_get_running_loop", None) is None: + from asyncio import events + asyncio._get_running_loop = events._get_running_loop + asyncio._set_running_loop = events._set_running_loop + del events + del asyncio + import aiocontextvars dir(aiocontextvars) # pacify pyflakes From c9e51fad9f67e240166aca0366bfc4d690545f62 Mon Sep 17 00:00:00 2001 From: Itamar Turner-Trauring Date: Mon, 20 May 2019 13:22:31 -0400 Subject: [PATCH 3/4] Break in a more understandable manner on Python 3.5.2 and earlier. --- docs/source/news.rst | 4 ++-- eliot/__init__.py | 15 +++++++-------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/docs/source/news.rst b/docs/source/news.rst index 17c7b94..4c64309 100644 --- a/docs/source/news.rst +++ b/docs/source/news.rst @@ -4,9 +4,9 @@ What's New 1.9.0 ^^^^^ -Bug fixes: +Deprecation: -* Older versions of Python 3.5, e.g. the 3.5.2 on Ubuntu Xenial, should work again. Fixes #418. +* Python versions older than 3.5.3, e.g. the 3.5.2 on Ubuntu Xenial, don't work with Eliot, so added a more informative error message explaining that. Fixes #418. Features: diff --git a/eliot/__init__.py b/eliot/__init__.py index 3300d33..0b9e444 100644 --- a/eliot/__init__.py +++ b/eliot/__init__.py @@ -7,14 +7,13 @@ # Enable asyncio contextvars support in Python 3.5/3.6: if version_info < (3, 7): # On Python 3.5.2 and earlier, some of the necessary attributes aren't exposed: - import asyncio - if getattr(asyncio, "_get_running_loop", None) is None: - from asyncio import events - asyncio._get_running_loop = events._get_running_loop - asyncio._set_running_loop = events._set_running_loop - del events - del asyncio - + if version_info < (3, 5, 3): + raise RuntimeError( + "This version of Eliot doesn't work on Python 3.5.2 or earlier. " + "Either upgrade to a newer version of Python (e.g. on Ubuntu 16.04 " + "you can use the deadsnakes PPA to get Python 3.6), or pin Eliot " + "to version 1.7." + ) import aiocontextvars dir(aiocontextvars) # pacify pyflakes From 7a7ea92c23f96fbde3c74ede67458d35bcf188ef Mon Sep 17 00:00:00 2001 From: Itamar Turner-Trauring Date: Mon, 20 May 2019 13:27:06 -0400 Subject: [PATCH 4/4] Disable 3.5.2 testing, since we're not supporting it. --- .travis.yml | 1 - eliot/__init__.py | 6 +++--- tox.ini | 1 - 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index 95a1d4f..84c525c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,7 +2,6 @@ language: python dist: xenial python: - "3.5" - - "3.5.2" - "3.6" - "3.7" - "pypy3" diff --git a/eliot/__init__.py b/eliot/__init__.py index 0b9e444..feacde5 100644 --- a/eliot/__init__.py +++ b/eliot/__init__.py @@ -10,9 +10,9 @@ if version_info < (3, 5, 3): raise RuntimeError( "This version of Eliot doesn't work on Python 3.5.2 or earlier. " - "Either upgrade to a newer version of Python (e.g. on Ubuntu 16.04 " - "you can use the deadsnakes PPA to get Python 3.6), or pin Eliot " - "to version 1.7." + "Either upgrade to Python 3.5.3 or later (on Ubuntu 16.04 " + "you can use https://launchpad.net/~deadsnakes/+archive/ubuntu/ppa " + "to get Python 3.6), or pin Eliot to version 1.7." ) import aiocontextvars diff --git a/tox.ini b/tox.ini index 9954219..74f35dc 100644 --- a/tox.ini +++ b/tox.ini @@ -6,7 +6,6 @@ envlist = py35-numpy, py36, py37, pypy3, [travis] python = 3.5: py35-numpy, py35-twisted-latest - 3.5.2: py35-numpy 3.6: py36 3.7: py37, linters3, sphinx pypy3: pypy3