Skip to content

Commit 3a974c5

Browse files
authored
Merge pull request #266 from beeware/pyupgrade-3.7
Update pyupgrade to set py3.7 minimum
2 parents 7be24c6 + 0483f45 commit 3a974c5

File tree

4 files changed

+9
-16
lines changed

4 files changed

+9
-16
lines changed

.pre-commit-config.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ repos:
1717
rev: v3.3.1
1818
hooks:
1919
- id: pyupgrade
20-
args: [--py36-plus]
20+
args: [--py37-plus]
2121
- repo: https://github.com/psf/black
2222
rev: 23.1.0
2323
hooks:

changes/266.misc.rst

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
A backwards compatibility shim for Python 3.6 was removed.

docs/background/releases.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Release History
99
Features
1010
--------
1111

12-
* Support for Python 3.6 was dropped. (#371)
12+
* Support for Python 3.6 was dropped. (#255)
1313

1414
Misc
1515
----

src/rubicon/objc/eventloop.py

+6-14
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""PEP 3156 event loop based on CoreFoundation."""
22

3-
import sys
3+
import contextvars
44
import threading
55
from asyncio import (
66
DefaultEventLoopPolicy,
@@ -324,21 +324,13 @@ def cancel(self):
324324

325325

326326
def context_callback(context, callback):
327-
# Python 3.7 introduced the idea of context variables.
328-
# asyncio.call_{at,later,soon} need to run any callbacks
329-
# *inside* the context provided.
330-
if sys.version_info >= (3, 7):
331-
import contextvars
327+
if context is None:
328+
context = contextvars.copy_context()
332329

333-
if context is None:
334-
context = contextvars.copy_context()
330+
def _callback(*args):
331+
context.run(callback, *args)
335332

336-
def _callback(*args):
337-
context.run(callback, *args)
338-
339-
return _callback
340-
else:
341-
return callback
333+
return _callback
342334

343335

344336
class CFEventLoop(unix_events.SelectorEventLoop):

0 commit comments

Comments
 (0)