Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork33.7k
gh-123228: fix return type for _ReadlineWrapper.get_line_buffer()#123281
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
cfbolz commentedAug 24, 2024
implementation is fine, but why did you revert the test? |
skirpichev commentedAug 24, 2024
This wasn't tested before and I'm not sure if this does make sense. |
cfbolz commentedAug 24, 2024
Let's keep the test. If it had been tested before, we would have found the problem in PyPy long ago (which just shows a test is a good idea). |
This reverts commit119362b.
Lib/test/test_pyrepl/test_pyrepl.py Outdated
| @@ -1,3 +1,4 @@ | |||
| importcurses | |||
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.
this line isfailing on windows. why is theexcept curses.error: pass needed anyway?
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.
Else this fails
Traceback (most recent call last): File "/home/runner/work/cpython/cpython/Lib/test/test_pyrepl/test_pyrepl.py", line 522, in test_basic self.assertIs(type(get_line_buffer()), str) ~~~~~~~~~~~~~~~^^ File "/home/runner/work/cpython/cpython/Lib/_pyrepl/readline.py", line 483, in get_line_buffer return self.get_reader().get_unicode() ~~~~~~~~~~~~~~~^^ File "/home/runner/work/cpython/cpython/Lib/_pyrepl/readline.py", line 358, in get_reader console = Console(self.f_in, self.f_out, encoding=ENCODING) File "/home/runner/work/cpython/cpython/Lib/_pyrepl/unix_console.py", line 154, in __init__ curses.setupterm(term or None, self.output_fd) ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^_curses.error: setupterm: could not find terminfo database`(e.g. here:https://github.com/python/cpython/actions/runs/10536985217/job/29197815100)
cfbolz commentedAug 24, 2024
dropping the import doesn't work, that will still make the test fail if classTestPyReplOutput(TestCase): ...deftest_get_line_buffer_returns_str(self):reader=self.prepare_reader(code_to_events("\n"))wrapper=_ReadlineWrapper(reader=reader)self.assertIs(type(wrapper.get_line_buffer()),str) which doesn't require curses at all. |
Co-authored-by: Carl Friedrich Bolz-Tereick <cfbolz@gmx.de>
cfbolz 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.
looks good, I think!
Thanks@skirpichev for the PR, and@cfbolz for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13. |
…() (pythonGH-123281)(cherry picked from commitca18ff2)Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>Co-authored-by: Carl Friedrich Bolz-Tereick <cfbolz@gmx.de>
GH-123293 is a backport of this pull request to the3.13 branch. |
bedevere-bot commentedAug 24, 2024
|
bedevere-bot commentedAug 24, 2024
|
bedevere-bot commentedAug 24, 2024
|
bedevere-bot commentedAug 24, 2024
|
bedevere-bot commentedAug 24, 2024
|
bedevere-bot commentedAug 24, 2024
|
bedevere-bot commentedAug 24, 2024
|
bedevere-bot commentedAug 24, 2024
|
bedevere-bot commentedAug 24, 2024
|
bedevere-bot commentedAug 24, 2024
|
bedevere-bot commentedAug 24, 2024
|
bedevere-bot commentedAug 24, 2024
|
bedevere-bot commentedAug 24, 2024
|
bedevere-bot commentedAug 24, 2024
|
bedevere-bot commentedAug 24, 2024
|
Uh oh!
There was an error while loading.Please reload this page.
str, not abytesobject #123228