This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author donut
Recipients
Date 2005-02-07.08:29:17
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
Logged In: YES 
user_id=65253

Hi, I'm not a Python developer, but I've looked at your patch.

The following two problems jump out at me:

1) The mode is being saved in a single global variable,
which would be overwritten if the functions are called on
different fds.

2) If setraw and/or setcbreak are called multiple times, the
initial value of _mode is lost.

The obvious fix would just be to use a dict and not set the
value if it is already set.  

Also, I think think setsane is a somewhat misleading name,
perhaps something along the lines of setinitial or
restoremode would be more accurate.

Aside from all that, I don't know if keeping hidden state in
the module is really the best solution to the problem.  
Requiring the users to save and restore the value from
tcgetattr is not significantly harder and makes it more
obvious what is going on.  If some fix is required, adding a
note to the tty docs about how to save and restore the mode
using termios may be enough, or perhaps adding some (really)
thin savemode/restoremode wrappers to the tty module.
History
Date User Action Args
2007-08-23 15:40:57adminlinkissue1088078 messages
2007-08-23 15:40:57admincreate