- Notifications
You must be signed in to change notification settings - Fork6k
Ensure Safe Handler Looping inApplication.process_update/error#4802
Ensure Safe Handler Looping inApplication.process_update/error#4802Bibo-Joshi merged 11 commits intomasterfrom
Application.process_update/error#4802Conversation
Uh oh!
There was an error while loading.Please reload this page.
aelkheir left a comment
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.
LGTM
At first I thought the exception being raised is reasonable, because i'm not sure of a use case where one would need to add handlers dynamically.
And the fact that it was not working, means that PTB users are also just discovering these use cases.
Maybe bot builders (?) where users of the bot add custom command/messages handers base on their input, also then how can the callback part be dynamic.
But that's for users to answer. We can have it.
Just one thought considering how this should work, for now if one dynamically adds a handler in a different group than the one currently selected, it will not be considered for the same update currently being processed, as the list of handlers was copied long before.
would that be a normal/abnormal behavior?
Uh oh!
There was an error while loading.Please reload this page.
Bibo-Joshi commentedMay 26, 2025
At least I'd say since we're offering add/remove_handler at runtime, it should not throw an exception, independently on how exactly that's achieved :D
Yes, I'd say that's expected. I think there are a few different options one could choosev
Also I've realized that we need the same logic in where we loop over the handler list within the group .. |
* cover also process-error* cover non-critical list-loops* document behavior as implementation detail
Application.process_updateApplication.process_update/errorBibo-Joshi commentedMay 26, 2025
Explanation of additional changes:
|
aelkheir commentedMay 26, 2025
👍
the hint+warning are sensible imo |
Bibo-Joshi commentedMay 26, 2025
mh, apparently some test case is in a deadlock now 😵💫 will have to investigate. not today, though |
Bibo-Joshi commentedMay 28, 2025
hanging tests apparently were already fixed by2373596 🕺 |
aelkheir left a comment
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.
Uh oh!
There was an error while loading.Please reload this page.
Co-authored-by: Abdelrahman Elkheir <90580077+aelkheir@users.noreply.github.com>
1fbab91 intomasterUh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Based on user inputhttps://t.me/pythontelegrambotgroup/779167
Closes#4803
Details