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

AssertionError in Deferred.send() (assert self._debugInfo is not None) #12089

Open
thevintik opened this issue Jan 20, 2024 · 0 comments
Open
Labels

Comments

@thevintik
Copy link

Describe the incorrect behavior you saw
Wrong error (AssertionError) raises when Deferred is awaited.

Describe how to cause this behavior

    async def test_error_observation_after_deferredlist(self):
        @contextlib.asynccontextmanager
        async def async_contextmanager():
            await threads.deferToThread(lambda: None)
            try:
                yield
            finally:
                await threads.deferToThread(lambda: None)

        async def coro():
            async with async_contextmanager():
                raise RuntimeError

        deferred = defer.Deferred.fromCoroutine(coro())

        with self.assertRaises(defer.FirstError):
            await defer.DeferredList([deferred], fireOnOneErrback=True, consumeErrors=False)

        with self.assertRaises(RuntimeError):
            await deferred
  File "/home/user/test.py", line 32, in test_error_observation_after_deferredlist
    await deferred
  File "/home/user/.venv/lib/python3.12/site-packages/twisted/internet/defer.py", line 1174, in send
    assert self._debugInfo is not None
builtins.AssertionError:

Complete test file is at https://gist.github.com/thevintik/00e8bef71635690f6a05be724b894c8d

Describe the correct behavior you'd like to see
Original error (RuntimeError) should be raised on await, not an AssertionError.

Testing environment

  • OS-independent (reproduces on both Windows and Linux)
  • Twisted version 23.10.0 (also reproduces on 22.10.0)
@thevintik thevintik added the bug label Jan 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant