Skip to content

Commit

Permalink
Updated a number of comments referring to Python 3.6
Browse files Browse the repository at this point in the history
  • Loading branch information
agronholm committed Jan 22, 2022
1 parent d130f12 commit 8ffc1b1
Show file tree
Hide file tree
Showing 10 changed files with 16 additions and 21 deletions.
5 changes: 2 additions & 3 deletions docs/source/reference-io.rst
Original file line number Diff line number Diff line change
Expand Up @@ -237,8 +237,7 @@ other constants and functions in the :mod:`ssl` module.

.. warning:: Avoid instantiating :class:`ssl.SSLContext` directly.
A newly constructed :class:`~ssl.SSLContext` has less secure
defaults than one returned by :func:`ssl.create_default_context`,
dramatically so before Python 3.6.
defaults than one returned by :func:`ssl.create_default_context`.

Instead of using :meth:`ssl.SSLContext.wrap_socket`, you
create a :class:`SSLStream`:
Expand Down Expand Up @@ -722,7 +721,7 @@ subprocess`` in order to access constants such as ``PIPE`` or

Currently, Trio always uses unbuffered byte streams for communicating
with a process, so it does not support the ``encoding``, ``errors``,
``universal_newlines`` (alias ``text`` in 3.7+), and ``bufsize``
``universal_newlines`` (alias ``text``), and ``bufsize``
options.


Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
Vital statistics:
* Supported environments: Linux, macOS, or Windows running some kind of Python
3.6-or-better (either CPython or PyPy3 is fine). \\*BSD and illumos likely
3.7-or-better (either CPython or PyPy3 is fine). \\*BSD and illumos likely
work too, but are not tested.
* Install: ``python3 -m pip install -U trio`` (or on Windows, maybe
Expand Down
4 changes: 2 additions & 2 deletions trio/_core/_entry_queue.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ class EntryQueue:
# not signal-safe. deque is implemented in C, so each operation is atomic
# WRT threads (and this is guaranteed in the docs), AND each operation is
# atomic WRT signal delivery (signal handlers can run on either side, but
# not *during* a deque operation). dict makes similar guarantees - and on
# CPython 3.6 and PyPy, it's even ordered!
# not *during* a deque operation). dict makes similar guarantees - and
# it's even ordered!
queue = attr.ib(factory=deque)
idempotent_queue = attr.ib(factory=dict)

Expand Down
2 changes: 1 addition & 1 deletion trio/_core/_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -2137,7 +2137,7 @@ def unrolled_run(runner, async_fn, args, host_uses_signal_set_wakeup_fd=False):
try:
# We used to unwrap the Outcome object here and send/throw
# its contents in directly, but it turns out that .throw()
# is buggy, at least on CPython 3.6:
# is buggy, at least before CPython 3.9:
# https://bugs.python.org/issue29587
# https://bugs.python.org/issue29590
# So now we send in the Outcome object and unwrap it on the
Expand Down
2 changes: 0 additions & 2 deletions trio/_core/tests/test_multierror.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,6 @@ def test_traceback_recursion():
# This could trigger an infinite recursion; the 'seen' set is supposed to prevent
# this.
exc1.__cause__ = MultiError([exc1, exc2, exc3])
# python traceback.TracebackException < 3.6.4 does not support unhashable exceptions
# and raises a TypeError exception
format_exception(*einfo(exc1))


Expand Down
2 changes: 1 addition & 1 deletion trio/_core/tests/test_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -1056,7 +1056,7 @@ async def child2():
]


# At least as of CPython 3.6, using .throw() to raise an exception inside a
# Before CPython 3.9, using .throw() to raise an exception inside a
# coroutine/generator causes the original exc_info state to be lost, so things
# like re-raising and exception chaining are broken.
#
Expand Down
1 change: 0 additions & 1 deletion trio/_highlevel_ssl_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ async def open_ssl_over_tcp_stream(
*,
https_compatible=False,
ssl_context=None,
# No trailing comma b/c bpo-9232 (fixed in py36)
happy_eyeballs_delay=DEFAULT_DELAY,
):
"""Make a TLS-encrypted Connection to the given host and port over TCP.
Expand Down
2 changes: 1 addition & 1 deletion trio/_socket.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ async def __aexit__(self, etype, value, tb):
try:
from socket import IPPROTO_IPV6
except ImportError:
# As of at least 3.6, python on Windows is missing IPPROTO_IPV6
# Before Python 3.8, Windows is missing IPPROTO_IPV6
# https://bugs.python.org/issue29515
if sys.platform == "win32": # pragma: no branch
IPPROTO_IPV6 = 41
Expand Down
13 changes: 6 additions & 7 deletions trio/_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,13 +270,12 @@ def __getitem__(self, _):


# If a new class inherits from any ABC, then the new class's metaclass has to
# inherit from ABCMeta. If a new class inherits from typing.Generic, and
# you're using Python 3.6, then the new class's metaclass has to
# inherit from typing.GenericMeta. Some of the classes that want to use Final
# or NoPublicConstructor inherit from ABCs and generics, so Final has to
# inherit from these metaclasses. Fortunately, GenericMeta inherits from
# ABCMeta, so inheriting from GenericMeta alone is sufficient (when it
# exists at all).
# inherit from ABCMeta. If a new class inherits from typing.Generic, then the
# new class's metaclass has to inherit from typing.GenericMeta. Some of the
# classes that want to use Final or NoPublicConstructor inherit from ABCs and
# generics, so Final has to inherit from these metaclasses. Fortunately,
# GenericMeta inherits from ABCMeta, so inheriting from GenericMeta alone is
# sufficient (when it exists at all).
if not t.TYPE_CHECKING and hasattr(t, "GenericMeta"):
BaseMeta = t.GenericMeta
else:
Expand Down
4 changes: 2 additions & 2 deletions trio/tests/test_threads.py
Original file line number Diff line number Diff line change
Expand Up @@ -300,8 +300,8 @@ async def test_run_in_worker_thread_limiter(MAX, cancel, use_default_limiter):
try:
# We used to use regular variables and 'nonlocal' here, but it turns
# out that it's not safe to assign to closed-over variables that are
# visible in multiple threads, at least as of CPython 3.6 and PyPy
# 5.8:
# visible in multiple threads, at least as of CPython 3.10 and PyPy
# 7.3:
#
# https://bugs.python.org/issue30744
# https://bitbucket.org/pypy/pypy/issues/2591/
Expand Down

0 comments on commit 8ffc1b1

Please sign in to comment.