Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#11857 test on py 3.12rc #11910

Merged
merged 27 commits into from Aug 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
8799b53
replace utcfromtimezone with fromtimezone(x, utc).replace(tzinfo=None)
graingert Aug 16, 2023
dd1a3fa
add newsfragment
graingert Aug 16, 2023
aec69ad
test on 3.12
graingert Aug 16, 2023
084d956
add newsfragment
graingert Aug 16, 2023
58b7117
asyncio.iscoroutine no longer accepts generators on 3.12
graingert Aug 16, 2023
f8390e3
tokenize no longer accepts \0 bytes in source code in 3.12
graingert Aug 16, 2023
d8edf4c
tempfile.mkdtemp() always returns absolute paths in 3.12
graingert Aug 16, 2023
7b9d4d9
work around builtins.sum accurancy increase on 3.12
graingert Aug 16, 2023
4cf97c5
Update src/twisted/internet/defer.py
graingert Aug 16, 2023
e903eea
Update src/twisted/persisted/aot.py
graingert Aug 16, 2023
c65da07
add py311 and py312 trove classifiers
graingert Aug 16, 2023
1c67617
Revert "Update src/twisted/persisted/aot.py"
graingert Aug 16, 2023
3b3fa36
Revert "tokenize no longer accepts \0 bytes in source code in 3.12"
graingert Aug 16, 2023
d1760b1
vendor tokenize and token for py3.12
graingert Aug 16, 2023
07bd957
fix __all__ and apply pre-commit
graingert Aug 16, 2023
f86129f
flake8 _tokenize
graingert Aug 16, 2023
c261159
Update src/twisted/persisted/aot.py
graingert Aug 16, 2023
985e695
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Aug 16, 2023
2ed22ac
fix _tokenize mypy
graingert Aug 16, 2023
dbb48d6
fix tokenize on py3.7
graingert Aug 16, 2023
c710f0b
warn about _tokenize re aot
graingert Aug 16, 2023
6610c4f
Update src/twisted/test/test_task.py
graingert Aug 16, 2023
2eb25e7
Update test_task.py
graingert Aug 16, 2023
e38335d
Update src/twisted/trial/_synctest.py
graingert Aug 16, 2023
592574e
Update src/twisted/test/test_persisted.py
graingert Aug 16, 2023
13270eb
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Aug 16, 2023
61cae87
fix testIndentify
graingert Aug 16, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 7 additions & 3 deletions .github/workflows/test.yaml
Expand Up @@ -69,7 +69,7 @@ jobs:
# The Python version on which the job is executed.
# We need at least one value here, so we go with latest Python version
# that we support..
python-version: ['3.10']
python-version: ['3.11']
# Just use the default OS.
runs-on: ['']
# Human readable short description for this job.
Expand Down Expand Up @@ -124,8 +124,11 @@ jobs:
# Just Python 3.9 with default settings.
- python-version: '3.9'

# Just Python 3.11 with default settings.
- python-version: '3.11'
# Just Python 3.10 with default settings.
- python-version: '3.10'

# Just Python 3.12 with default settings.
- python-version: '3.12'

# Newest macOS and newest Python supported versions.
- python-version: '3.11'
Expand Down Expand Up @@ -184,6 +187,7 @@ jobs:
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true

- name: Get pip cache dir
id: pip-cache
Expand Down
2 changes: 2 additions & 0 deletions pyproject.toml
Expand Up @@ -28,6 +28,8 @@ classifiers = [
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
]
dependencies = [
"zope.interface >= 5",
Expand Down
7 changes: 5 additions & 2 deletions src/twisted/internet/defer.py
Expand Up @@ -9,6 +9,7 @@
"""
from __future__ import annotations

import inspect
import traceback
import warnings
from abc import ABC, abstractmethod
Expand Down Expand Up @@ -1341,8 +1342,10 @@ def main(reactor):

@raise ValueError: If C{coro} is not a coroutine or generator.
"""
# asyncio.iscoroutine identifies generators as coroutines, too.
if iscoroutine(coro):
# asyncio.iscoroutine <3.12 identifies generators as coroutines, too.
# for >=3.12 we need to check isgenerator also
graingert marked this conversation as resolved.
Show resolved Hide resolved
# see https://github.com/python/cpython/issues/102748
if iscoroutine(coro) or inspect.isgenerator(coro):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't have experince with coroutine.

I don't understand this comment. Sorry

return _cancellableInlineCallbacks(coro)
raise NotACoroutineError(f"{coro!r} is not a coroutine")

Expand Down
1 change: 1 addition & 0 deletions src/twisted/newsfragments/11857.feature
@@ -0,0 +1 @@
The CI suite was updated to execute the tests using a Python 3.12 pre-release
2 changes: 2 additions & 0 deletions src/twisted/newsfragments/11908.bugfix
@@ -0,0 +1,2 @@
utcfromtimestamp has been deprecated since Python 3.12,
use fromtimestamp(x, timezone.utc).replace(tzinfo=None) instead.
150 changes: 150 additions & 0 deletions src/twisted/persisted/_token.py
@@ -0,0 +1,150 @@
"""
FIXME:https://github.com/twisted/twisted/issues/3843
This can be removed once t.persisted.aot is removed.
New code should not make use of this.

Token constants.
vendored from https://github.com/python/cpython/blob/6b825c1b8a14460641ca6f1647d83005c68199aa/Lib/token.py
Licence: https://docs.python.org/3/license.html
"""
# Auto-generated by Tools/scripts/generate_token.py

__all__ = ["tok_name", "ISTERMINAL", "ISNONTERMINAL", "ISEOF"]

ENDMARKER = 0
NAME = 1
NUMBER = 2
STRING = 3
NEWLINE = 4
INDENT = 5
DEDENT = 6
LPAR = 7
RPAR = 8
LSQB = 9
RSQB = 10
COLON = 11
COMMA = 12
SEMI = 13
PLUS = 14
MINUS = 15
STAR = 16
SLASH = 17
VBAR = 18
AMPER = 19
LESS = 20
GREATER = 21
EQUAL = 22
DOT = 23
PERCENT = 24
LBRACE = 25
RBRACE = 26
EQEQUAL = 27
NOTEQUAL = 28
LESSEQUAL = 29
GREATEREQUAL = 30
TILDE = 31
CIRCUMFLEX = 32
LEFTSHIFT = 33
RIGHTSHIFT = 34
DOUBLESTAR = 35
PLUSEQUAL = 36
MINEQUAL = 37
STAREQUAL = 38
SLASHEQUAL = 39
PERCENTEQUAL = 40
AMPEREQUAL = 41
VBAREQUAL = 42
CIRCUMFLEXEQUAL = 43
LEFTSHIFTEQUAL = 44
RIGHTSHIFTEQUAL = 45
DOUBLESTAREQUAL = 46
DOUBLESLASH = 47
DOUBLESLASHEQUAL = 48
AT = 49
ATEQUAL = 50
RARROW = 51
ELLIPSIS = 52
COLONEQUAL = 53
OP = 54
AWAIT = 55
ASYNC = 56
TYPE_IGNORE = 57
TYPE_COMMENT = 58
SOFT_KEYWORD = 59
# These aren't used by the C tokenizer but are needed for tokenize.py
ERRORTOKEN = 60
COMMENT = 61
NL = 62
ENCODING = 63
N_TOKENS = 64
# Special definitions for cooperation with parser
NT_OFFSET = 256

tok_name = {
value: name
for name, value in globals().items()
if isinstance(value, int) and not name.startswith("_")
}
__all__.extend(tok_name.values())

EXACT_TOKEN_TYPES = {
"!=": NOTEQUAL,
"%": PERCENT,
"%=": PERCENTEQUAL,
"&": AMPER,
"&=": AMPEREQUAL,
"(": LPAR,
")": RPAR,
"*": STAR,
"**": DOUBLESTAR,
"**=": DOUBLESTAREQUAL,
"*=": STAREQUAL,
"+": PLUS,
"+=": PLUSEQUAL,
",": COMMA,
"-": MINUS,
"-=": MINEQUAL,
"->": RARROW,
".": DOT,
"...": ELLIPSIS,
"/": SLASH,
"//": DOUBLESLASH,
"//=": DOUBLESLASHEQUAL,
"/=": SLASHEQUAL,
":": COLON,
":=": COLONEQUAL,
";": SEMI,
"<": LESS,
"<<": LEFTSHIFT,
"<<=": LEFTSHIFTEQUAL,
"<=": LESSEQUAL,
"=": EQUAL,
"==": EQEQUAL,
">": GREATER,
">=": GREATEREQUAL,
">>": RIGHTSHIFT,
">>=": RIGHTSHIFTEQUAL,
"@": AT,
"@=": ATEQUAL,
"[": LSQB,
"]": RSQB,
"^": CIRCUMFLEX,
"^=": CIRCUMFLEXEQUAL,
"{": LBRACE,
"|": VBAR,
"|=": VBAREQUAL,
"}": RBRACE,
"~": TILDE,
}


def ISTERMINAL(x):
return x < NT_OFFSET

Check warning on line 142 in src/twisted/persisted/_token.py

View check run for this annotation

Codecov / codecov/patch

src/twisted/persisted/_token.py#L142

Added line #L142 was not covered by tests


def ISNONTERMINAL(x):
return x >= NT_OFFSET

Check warning on line 146 in src/twisted/persisted/_token.py

View check run for this annotation

Codecov / codecov/patch

src/twisted/persisted/_token.py#L146

Added line #L146 was not covered by tests


def ISEOF(x):
return x == ENDMARKER

Check warning on line 150 in src/twisted/persisted/_token.py

View check run for this annotation

Codecov / codecov/patch

src/twisted/persisted/_token.py#L150

Added line #L150 was not covered by tests