Skip to content

Conversation

@vasinkd
Copy link
Contributor

@vasinkd vasinkd commented Oct 23, 2018

Situation:
We use ConversationHandler with run_async decorator and an entry_point function returns None

Result:
We stuck within conversation state (None, Promise) since Promise returns None and None means we do not update conversation state.

Solution:
If Promise returns None AND old state is None - exit Conversation Handler.

Caveats:
May be not suitable if a programmer uses None as a valid state in Conversation states dict. But why would anyone do that?

@jh0ker
Copy link
Member

jh0ker commented Oct 26, 2018

Good catch, thanks for your contribution!

This also seems to be the behavior for when a synchronous entry point handler returns None, although this is never explicitly documented. Perhaps it would be a good idea to do so.

It would also be great if you could add a unit test that tests for this bug, so we won't have any regressions in the future. It should probably look similar to this test.

Edit: I don't think the caveat you mentioned is real, pretty sure it is already not possible to use None for states

jh0ker
jh0ker previously requested changes Oct 26, 2018
Copy link
Member

@jh0ker jh0ker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs a test and documentation

@jsmnbom
Copy link
Member

jsmnbom commented Jan 4, 2019

@vasinkd is test and docs something you would like to do an attempt at?

@vasinkd
Copy link
Contributor Author

vasinkd commented Jan 6, 2019

Totally forgot about this. @jsmnbom , thanks for a reminder!

Ok, I'll add tests, no problemo.
What about documentation? Should I mention this behavior in ConversationHandler class description?

@jsmnbom
Copy link
Member

jsmnbom commented Jan 6, 2019

Thanks a lot :D
In terms of docs I was mostly referring to @jh0ker's comment about

This also seems to be the behavior for when a synchronous entry point handler returns None, although this is never explicitly documented. Perhaps it would be a good idea to do so.

So a note in the ConversationHandler class docstring about this behaviour (both sync and async) sounds good yea :)

@vasinkd
Copy link
Contributor Author

vasinkd commented Jan 27, 2019

Done. Sorry for the delay!
Better late than never :)

@Eldinnie
Copy link
Member

Test for this instance passed. Can we merge for V12 @jsmnbom ?

Copy link
Member

@jsmnbom jsmnbom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see what you mean. Yea let's merge it :)

@Eldinnie Eldinnie changed the base branch from master to V12 February 14, 2019 07:36
@Eldinnie
Copy link
Member

CI is running, should be able to be merged in v12

@Eldinnie
Copy link
Member

Merged V12 after making small adjustment there regarding conversationhandler. If CI agrees we can merge.

jsmnbom added a commit that referenced this pull request Feb 14, 2019
Also include #1270 even though not merged yet, but it should be very soon :)
@Eldinnie Eldinnie dismissed jh0ker’s stale review February 14, 2019 11:25

not reviewed since last changes

@Eldinnie Eldinnie merged commit 60f2044 into python-telegram-bot:V12 Feb 14, 2019
@github-actions github-actions bot locked and limited conversation to collaborators Aug 21, 2020
@Bibo-Joshi Bibo-Joshi added 🔌 bug pr description: bug and removed bug 🐛 labels Nov 3, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

🔌 bug pr description: bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants