Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork34.3k
gh-146065: Fix NULL dereference in FutureIter_am_send#146304
gh-146065: Fix NULL dereference in FutureIter_am_send#146304VanshAgarwal24036 wants to merge 5 commits intopython:mainfrom
Conversation
| try: | ||
| it.throw(RuntimeError) | ||
| except RuntimeError: | ||
| pass |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Why do we silently suppress this exception here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
The RuntimeError is intentionally triggered to clearit->future viaFutureIter_throw().
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Then do not suppress it but eagerly catch it with assertRaises.
Uh oh!
There was an error while loading.Please reload this page.
| deftest_futureiter_send_after_throw_no_crash(self): | ||
| asyncdefrun_test(): | ||
| loop=asyncio.get_event_loop() | ||
| fut=loop.create_future() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Alos I would suggest you use the _new_future() helper
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
i.e I do not think you need a wrapper and asyncio.run()
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase |
VanshAgarwal24036 commentedMar 22, 2026
I have made the requested changes; please review again |
Thanks for making the requested changes! @picnixz: please review the changes made to this pull request. |
Uh oh!
There was an error while loading.Please reload this page.
After throw() or close(), it->future can be NULL. A subsequent send() call would dereference it and crash. This adds a NULL check and raises StopIteration instead.
NULLpointer dereference inFutureIter_am_send#146065