-
-
Notifications
You must be signed in to change notification settings - Fork 66
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
regression: something about stack introspection changed in v7.3.14, which has broken Twisted's test suite #4850
Comments
Doces anything in the changelog remind you of something that could cause these failures? Is there a smaller failing unit test we can run? It seems like there is an error being raised where previously there was none, but I can't tell what the error actually is. |
How do you usually debug this kind of failure? |
The one thing in the changelog which dimly rings a bill here was this one:
because some (but not all) of the tracebacks implicate contextvars. Otherwise it just looks like sometimes |
The semantics of stack-walking rarely change out from under us in the interpreter, so this is a new domain we don't have experience debugging. I guess with the new GIL removal and JIT stuff in CPython we are in for a spicy couple of years but I don't know how to handle it yet :) |
To this question in particular:
|
All the tests passed for me. Maybe connected to hypothesis testing and #4839 which was fixed in hypothesis 6.92.5?
|
FWIW when I run these commands exactly as written I also get passing tests… because zsh cached the wrong Here's a set of commands that fail reliably for me:
Note that the tests hang for about 2 minutes on Our CI does not pin Hypothesis or PyHamcrest, so if that were the bug, we wouldn't be seeing it on current builds. |
Got it: the tests pass if I remove the Line 38 in 824eed9
|
I think this fixes it: diff --git a/src/twisted/internet/defer.py b/src/twisted/internet/defer.py
index 36e1d988f9..14aebeaf3d 100644
--- a/src/twisted/internet/defer.py
+++ b/src/twisted/internet/defer.py
@@ -17,7 +17,7 @@ from asyncio import AbstractEventLoop, Future, iscoroutine
from contextvars import Context as _Context, copy_context as _copy_context
from enum import Enum
from functools import wraps
-from sys import exc_info
+from sys import exc_info, implementation
from types import CoroutineType, GeneratorType, MappingProxyType, TracebackType
from typing import (
TYPE_CHECKING,
@@ -54,6 +54,8 @@ from twisted.python.failure import Failure, _extraneous
log = Logger()
+_STACK_LEVEL_INCOMPATIBLE = _PYPY and implementation.version < (7, 3, 14)
+
_T = TypeVar("_T")
_P = ParamSpec("_P")
@@ -2022,8 +2024,8 @@ def _inlineCallbacks(
appCodeTrace = traceback.tb_next
assert appCodeTrace is not None
- if _PYPY:
- # PyPy as of 3.7 adds an extra frame.
+ if _STACK_LEVEL_INCOMPATIBLE:
+ # PyPy as of 3.7 and before 7.3.14 adds an extra frame.
appCodeTrace = appCodeTrace.tb_next
assert appCodeTrace is not None |
Landed in Twisted, so I think we're done here. Thanks again @mattip ! |
It's a bit hard, from the vantage point of Twisted's test runner, which depends on stack introspection itself, to figure out exactly what has gone wrong, but you can see a successful test run here: https://github.com/twisted/twisted/actions/runs/7496583256/job/20409555911 and a failed one here: https://github.com/twisted/twisted/actions/runs/7496845771/job/20409666634 where the only difference between them is .13 to .14.
The text was updated successfully, but these errors were encountered: