Message47395
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.
|
|
Date |
User |
Action |
Args |
2007-08-23 15:40:57 | admin | link | issue1088078 messages |
2007-08-23 15:40:57 | admin | create | |
|