bpo-41818: Make additions to the tty module#23546
Conversation
|
@asvetlov @ethanfurman this follows #23536. TODO: update documentation for the tty module; maybe also add tests for it. Note: I have put my name in one of the files; let me know if that is not customary :D |
Sorry, something went wrong.
asvetlov
left a comment
There was a problem hiding this comment.
I suggest esablish public function names first, update the tty module documentation, and make the final review.
@jonathanslenders I very respect your work on https://github.com/prompt-toolkit/python-prompt-toolkit
Maybe you want to review this (and follow-up) PR? Maybe you can suggest something? I really like to hear voices from experts in PTY/TTY area.
Sorry, something went wrong.
|
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 |
Sorry, something went wrong.
|
@asvetlov Thank you very much for the reviews. As per your suggestion, the updated commit will include documentation, etc. Edit: you mentioned "I suggest esablish public function names first, update the tty module documentation, and make the final review". I am inexperienced when it comes to the cpython development process. How do I "establish public function names"? Thank you in advance. |
Sorry, something went wrong.
16a0c70 to
ce6c808
Compare
November 30, 2020 09:48
|
@asvetlov : Thanks! A few thoughts:
Overall I think this looks good. One thing slightly related, but out of scope for this PR, that often missed in Python is that sys.stdin/sys.stdout are not context variables. So it's impossible to write an asyncssh server that exposes a REPL where print/input is working properly. (I guess I should propose that on python-ideas or bpo, but no energy/time to drive the discussion now.) |
Sorry, something went wrong.
|
@asvetlov Thank you for your patience. I have made the requested changes; please review again. I restructured the files a little bit. As a result, your reviews are showing up as outdated; they are not. Here are some notes to make reviewing easier for you:
I did this to avoid
I too would be honored if this work was reviewed by @jonathanslenders. Edit: after posting this, I noticed that @jonathanslenders has already posted a review! Thank you very much for this! |
Sorry, something went wrong.
|
Thanks for making the requested changes! @asvetlov: please review the changes made to this pull request. |
Sorry, something went wrong.
|
Could we return a namedtuple from getwinsize? |
Sorry, something went wrong.
682510f to
db202cb
Compare
December 1, 2020 13:33
|
@asvetlov @jonathanslenders I have made the requested changes; please review again. |
Sorry, something went wrong.
|
Thanks for making the requested changes! @asvetlov: please review the changes made to this pull request. |
Sorry, something went wrong.
|
These are some of my old comments and notes; I used them to track progress and make decisions; they may be ignored. Since the comment section was a total mess with mostly me talking to myself, I had to put them together to make it look cleaner. I had also made some "reviews" as notes for myself; they are now gone since I removed a lot of code (the entire old comment 1
old comment 2@asvetlov @jonathanslenders I have made the requested changes; please review again. Notes follow.
old comment 3https://pubs.opengroup.org/onlinepubs/7908799/xcurses/intov.html#tag_001_005_002 mentions that cbreak Mode must additionally have old comment 4I compared the following definitions/implementations of "raw mode tty" and "cbreak mode tty": raw
cbreak
I would like to put down what I learned about Edit: @asvetlov Sir, I just realized after reading the devguide that "non-trivial contributions are credited in the Misc/ACKS file" and in the "news entry". Am I eligible for this? Would it be better if I removed my name/email from the main files? I have absolutely no problem in doing that; I just want to understand the correct protocol :) More info: The "Scroll Lock" key on this 1991 IBM Model M can also be used for "software flow control"; this key is unaffected by either old comment 5New commit: old comment 6@jonathanslenders I have made the changes that you requested. I request you to please review this again when you have time. Notes: Edit: to ease the review process, here are the various implementations of
Edit2: Here is where I am using Edit3: List of all POSIX.1-2017 input mode flags - https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/termios.h.html#tag_13_72_03_02 old comment 7
They have decided to include functions
Therefore, now I am highly tempted to change the Additional notes:
Edit: renamed the methods; I am keeping the class definition. old comment 8@asvetlov @jonathanslenders Thank you for your patience. I have added the final test for There should only be one more pull request after this :D Rebased to have only one clean commit. Removed login_tty(); it will be a part of the final pull request. All functions/methods now have standard POSIX/BSD names or are inspired by such names. |
Sorry, something went wrong.
6033b85 to
a2d2d1d
Compare
December 5, 2020 08:59
80fbded to
a639728
Compare
December 7, 2020 18:18
… cfmakeecho(), cfmakeraw(), and cfmakecbreak(). The functions setcbreak() and setraw() now return original termios to save an extra tcgetattr() call. Signed-off-by: Soumendra Ganguly <soumendraganguly@gmail.com>
a639728 to
a684142
Compare
December 11, 2020 05:25
|
@jonathanslenders Sir, can you please review this again? I have removed a lot of the code [ |
Sorry, something went wrong.
Signed-off-by: Soumendra Ganguly <soumendraganguly@gmail.com>
|
This PR is stale because it has been open for 30 days with no activity. |
Sorry, something went wrong.
|
Still waiting for change review. |
Sorry, something went wrong.
|
This PR is stale because it has been open for 30 days with no activity. |
Sorry, something went wrong.
|
@asvetlov @gpshead Please take a look at this if time permits. You can ignore all comments made before since most of that is now covered by New summary for this PR: add |
Sorry, something went wrong.
This follows #23536. Also, see #23686, #23740.
Add
cfmakeraw(),cfmakeecho(), andcfmakecbreak(); makesetraw()andsetcbreak()return saved termios attributes to avoid extratcgetattr()calls.Post #23686, #23546, #23740 goals:
test_winsize()to "Lib/test/test_pty.py";Notes
cfmakeraw()is not POSIX compliant; it is available on the BSDs and in glibc. However, POSIX has functions with similar names; for example, considercfgetispeed(). Please see https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/termios.h.html.test_winch()will be resubmitted as a part of a later pull request.class winsize.tty.login_tty().Signed-off-by: Soumendra Ganguly soumendraganguly@gmail.com
https://bugs.python.org/issue41818