Skip to content

Commit 9a2ea00

Browse files
authored
#11857 test on py 3.12rc (#11910)
2 parents a9ee8e5 + 61cae87 commit 9a2ea00

13 files changed

Lines changed: 1120 additions & 16 deletions

File tree

‎.github/workflows/test.yaml‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ jobs:
6969
# The Python version on which the job is executed.
7070
# We need at least one value here, so we go with latest Python version
7171
# that we support..
72-
python-version: ['3.10']
72+
python-version: ['3.11']
7373
# Just use the default OS.
7474
runs-on: ['']
7575
# Human readable short description for this job.
@@ -124,8 +124,11 @@ jobs:
124124
# Just Python 3.9 with default settings.
125125
- python-version: '3.9'
126126

127-
# Just Python 3.11 with default settings.
128-
- python-version: '3.11'
127+
# Just Python 3.10 with default settings.
128+
- python-version: '3.10'
129+
130+
# Just Python 3.12 with default settings.
131+
- python-version: '3.12'
129132

130133
# Newest macOS and newest Python supported versions.
131134
- python-version: '3.11'
@@ -184,6 +187,7 @@ jobs:
184187
uses: actions/setup-python@v4
185188
with:
186189
python-version: ${{ matrix.python-version }}
190+
allow-prereleases: true
187191

188192
- name: Get pip cache dir
189193
id: pip-cache

‎pyproject.toml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ classifiers = [
2828
"Programming Language :: Python :: 3.8",
2929
"Programming Language :: Python :: 3.9",
3030
"Programming Language :: Python :: 3.10",
31+
"Programming Language :: Python :: 3.11",
32+
"Programming Language :: Python :: 3.12",
3133
]
3234
dependencies = [
3335
"zope.interface >= 5",

‎src/twisted/internet/defer.py‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"""
1010
from __future__ import annotations
1111

12+
import inspect
1213
import traceback
1314
import warnings
1415
from abc import ABC, abstractmethod
@@ -1341,8 +1342,10 @@ def main(reactor):
13411342
13421343
@raise ValueError: If C{coro} is not a coroutine or generator.
13431344
"""
1344-
# asyncio.iscoroutine identifies generators as coroutines, too.
1345-
if iscoroutine(coro):
1345+
# asyncio.iscoroutine <3.12 identifies generators as coroutines, too.
1346+
# for >=3.12 we need to check isgenerator also
1347+
# see https://github.com/python/cpython/issues/102748
1348+
if iscoroutine(coro) or inspect.isgenerator(coro):
13461349
return _cancellableInlineCallbacks(coro)
13471350
raise NotACoroutineError(f"{coro!r} is not a coroutine")
13481351

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
The CI suite was updated to execute the tests using a Python 3.12 pre-release
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
utcfromtimestamp has been deprecated since Python 3.12,
2+
use fromtimestamp(x, timezone.utc).replace(tzinfo=None) instead.

‎src/twisted/persisted/_token.py‎

Lines changed: 150 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
1+
"""
2+
FIXME:https://github.com/twisted/twisted/issues/3843
3+
This can be removed once t.persisted.aot is removed.
4+
New code should not make use of this.
5+
6+
Token constants.
7+
vendored from https://github.com/python/cpython/blob/6b825c1b8a14460641ca6f1647d83005c68199aa/Lib/token.py
8+
Licence: https://docs.python.org/3/license.html
9+
"""
10+
# Auto-generated by Tools/scripts/generate_token.py
11+
12+
__all__ = ["tok_name", "ISTERMINAL", "ISNONTERMINAL", "ISEOF"]
13+
14+
ENDMARKER = 0
15+
NAME = 1
16+
NUMBER = 2
17+
STRING = 3
18+
NEWLINE = 4
19+
INDENT = 5
20+
DEDENT = 6
21+
LPAR = 7
22+
RPAR = 8
23+
LSQB = 9
24+
RSQB = 10
25+
COLON = 11
26+
COMMA = 12
27+
SEMI = 13
28+
PLUS = 14
29+
MINUS = 15
30+
STAR = 16
31+
SLASH = 17
32+
VBAR = 18
33+
AMPER = 19
34+
LESS = 20
35+
GREATER = 21
36+
EQUAL = 22
37+
DOT = 23
38+
PERCENT = 24
39+
LBRACE = 25
40+
RBRACE = 26
41+
EQEQUAL = 27
42+
NOTEQUAL = 28
43+
LESSEQUAL = 29
44+
GREATEREQUAL = 30
45+
TILDE = 31
46+
CIRCUMFLEX = 32
47+
LEFTSHIFT = 33
48+
RIGHTSHIFT = 34
49+
DOUBLESTAR = 35
50+
PLUSEQUAL = 36
51+
MINEQUAL = 37
52+
STAREQUAL = 38
53+
SLASHEQUAL = 39
54+
PERCENTEQUAL = 40
55+
AMPEREQUAL = 41
56+
VBAREQUAL = 42
57+
CIRCUMFLEXEQUAL = 43
58+
LEFTSHIFTEQUAL = 44
59+
RIGHTSHIFTEQUAL = 45
60+
DOUBLESTAREQUAL = 46
61+
DOUBLESLASH = 47
62+
DOUBLESLASHEQUAL = 48
63+
AT = 49
64+
ATEQUAL = 50
65+
RARROW = 51
66+
ELLIPSIS = 52
67+
COLONEQUAL = 53
68+
OP = 54
69+
AWAIT = 55
70+
ASYNC = 56
71+
TYPE_IGNORE = 57
72+
TYPE_COMMENT = 58
73+
SOFT_KEYWORD = 59
74+
# These aren't used by the C tokenizer but are needed for tokenize.py
75+
ERRORTOKEN = 60
76+
COMMENT = 61
77+
NL = 62
78+
ENCODING = 63
79+
N_TOKENS = 64
80+
# Special definitions for cooperation with parser
81+
NT_OFFSET = 256
82+
83+
tok_name = {
84+
value: name
85+
for name, value in globals().items()
86+
if isinstance(value, int) and not name.startswith("_")
87+
}
88+
__all__.extend(tok_name.values())
89+
90+
EXACT_TOKEN_TYPES = {
91+
"!=": NOTEQUAL,
92+
"%": PERCENT,
93+
"%=": PERCENTEQUAL,
94+
"&": AMPER,
95+
"&=": AMPEREQUAL,
96+
"(": LPAR,
97+
")": RPAR,
98+
"*": STAR,
99+
"**": DOUBLESTAR,
100+
"**=": DOUBLESTAREQUAL,
101+
"*=": STAREQUAL,
102+
"+": PLUS,
103+
"+=": PLUSEQUAL,
104+
",": COMMA,
105+
"-": MINUS,
106+
"-=": MINEQUAL,
107+
"->": RARROW,
108+
".": DOT,
109+
"...": ELLIPSIS,
110+
"/": SLASH,
111+
"//": DOUBLESLASH,
112+
"//=": DOUBLESLASHEQUAL,
113+
"/=": SLASHEQUAL,
114+
":": COLON,
115+
":=": COLONEQUAL,
116+
";": SEMI,
117+
"<": LESS,
118+
"<<": LEFTSHIFT,
119+
"<<=": LEFTSHIFTEQUAL,
120+
"<=": LESSEQUAL,
121+
"=": EQUAL,
122+
"==": EQEQUAL,
123+
">": GREATER,
124+
">=": GREATEREQUAL,
125+
">>": RIGHTSHIFT,
126+
">>=": RIGHTSHIFTEQUAL,
127+
"@": AT,
128+
"@=": ATEQUAL,
129+
"[": LSQB,
130+
"]": RSQB,
131+
"^": CIRCUMFLEX,
132+
"^=": CIRCUMFLEXEQUAL,
133+
"{": LBRACE,
134+
"|": VBAR,
135+
"|=": VBAREQUAL,
136+
"}": RBRACE,
137+
"~": TILDE,
138+
}
139+
140+
141+
def ISTERMINAL(x):
142+
return x < NT_OFFSET
143+
144+
145+
def ISNONTERMINAL(x):
146+
return x >= NT_OFFSET
147+
148+
149+
def ISEOF(x):
150+
return x == ENDMARKER

0 commit comments

Comments
 (0)