[issue40696] "await" hangs in Python3.9.0b1.

2020-05-21 Thread Chris Jerdonek
Chris Jerdonek added the comment: Also, I just want to point out one thing about _PyErr_SetObject(). I believe it can detect cycles of arbitrary length (which is what the while loop is for). It's just that it can only detect cycles that involve the first node. So for things to fail with

[issue40696] "await" hangs in Python3.9.0b1.

2020-05-21 Thread Chris Jerdonek
Chris Jerdonek added the comment: I just posted a draft PR that implements the narrower fix: https://github.com/python/cpython/pull/20287 I confirmed that the Django test passes with it. I also included two regression tests: one using only generators, and one more like the Django test that

[issue40696] "await" hangs in Python3.9.0b1.

2020-05-21 Thread Chris Jerdonek
Change by Chris Jerdonek : -- keywords: +patch pull_requests: +19561 stage: -> patch review pull_request: https://github.com/python/cpython/pull/20287 ___ Python tracker ___

[issue40696] "await" hangs in Python3.9.0b1.

2020-05-20 Thread Chris Jerdonek
Chris Jerdonek added the comment: Okay, I'll keep it one issue then. Someone else is still welcome to work on the more general issue. Note that there is some chance the narrower fix should happen independent of the more general fix. This is because _PyErr_ChainExceptions() (which is the

[issue40696] "await" hangs in Python3.9.0b1.

2020-05-20 Thread Yury Selivanov
Yury Selivanov added the comment: > If someone else agrees, I can create a new issue. I'd keep this one issue, but really up to you. I don't think I have time in the next few days to work on what I proposed but would be happy to brainstorm / review PRs. --

[issue40696] "await" hangs in Python3.9.0b1.

2020-05-20 Thread Chris Jerdonek
Chris Jerdonek added the comment: >From a process perspective, I think we should probably pursue two PR's for >this: one for the general issue that affects all Python versions (what Yury is >talking about), and something narrower that addresses the 3.9.0b1 case that >came up here. I'd like

[issue40696] "await" hangs in Python3.9.0b1.

2020-05-20 Thread Yury Selivanov
Yury Selivanov added the comment: Just a note, __context__ cycles can theoretically be longer than 2 nodes. I've encountered cycles like `exc.__context__.__context__.__context__ is exc` a few times in my life, typically resulting from some weird third-party libraries. The only solution is

[issue40696] "await" hangs in Python3.9.0b1.

2020-05-20 Thread Chris Jerdonek
Chris Jerdonek added the comment: I don't think that would be a real solution because it looks like that would cause the while loop always to loop at most once (which would defeat its purpose) -- because the loop ends with "o = context": while ((context = PyException_GetContext(o))) {

[issue40696] "await" hangs in Python3.9.0b1.

2020-05-20 Thread Batuhan Taskaya
Batuhan Taskaya added the comment: > Is this a separate bug? So maybe the issue is that the new code is letting > things get into this state. Some of my changes added new chaining in various > places, so that would fit (but still investigating). Looks like there isn't a recursion guard on

[issue40696] "await" hangs in Python3.9.0b1.

2020-05-20 Thread Chris Jerdonek
Chris Jerdonek added the comment: The Django details might not matter so much at this point, but to add to something I said above: It might not only be process_exception_by_middleware() as I mentioned, but also asgiref's sync_to_async() function. In that function, you can see an already

[issue40696] "await" hangs in Python3.9.0b1.

2020-05-20 Thread Chris Jerdonek
Chris Jerdonek added the comment: To start out sharing what I found in the Django code: Here inside BaseHandler._get_response_async(): https://github.com/django/django/blob/3460ea49e839fd6bb924c48eaa1cd3d6dc888035/django/core/handlers/base.py#L226-L232 try: response = await

[issue40696] "await" hangs in Python3.9.0b1.

2020-05-20 Thread Chris Jerdonek
Chris Jerdonek added the comment: FWIW, I found that the following hangs, but it also hangs on earlier versions of Python: import traceback try: raise RuntimeError except Exception as exc: print(f'handling: {exc!r}') exc.__context__ = exc print('printing traceback')

[issue40696] "await" hangs in Python3.9.0b1.

2020-05-20 Thread Emmanuel Arias
Change by Emmanuel Arias : -- nosy: +eamanu ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue40696] "await" hangs in Python3.9.0b1.

2020-05-20 Thread Chris Jerdonek
Chris Jerdonek added the comment: I'm getting close to tracking this down. There is a certain point in the code path of the Django test where `exc is exc.__context__` becomes True. I'm guessing this is what's causing the hang. I'll try to get a simple reproducer (there is a lot of Django

[issue40696] "await" hangs in Python3.9.0b1.

2020-05-20 Thread Pablo Galindo Salgado
Change by Pablo Galindo Salgado : -- nosy: +aeros ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue40696] "await" hangs in Python3.9.0b1.

2020-05-20 Thread Chris Jerdonek
Change by Chris Jerdonek : -- nosy: +chris.jerdonek ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue40696] "await" hangs in Python3.9.0b1.

2020-05-20 Thread Mariusz Felisiak
New submission from Mariusz Felisiak : We noticed a behavior change in Python3.9.0b1 (it works properly in Python3.9.0a6). One of our tests `handlers.tests.AsyncHandlerRequestTests.test_suspiciousop_in_view_returns_400`[1] hangs on `await`. `/suspicious/` is a view that raises a custom