[Patches] [ python-Patches-1088078 ] Patch for bug 1088077

SourceForge.net noreply at sourceforge.net
Fri Mar 4 00:49:32 CET 2005


Patches item #1088078, was opened at 2004-12-19 22:27
Message generated for change (Comment added) made by loewis
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1088078&group_id=5470

Category: Library (Lib)
Group: Python 2.4
>Status: Closed
>Resolution: Rejected
Priority: 5
Submitted By: Mike Meyer (mwm)
Assigned to: Nobody/Anonymous (nobody)
Summary: Patch for bug 1088077

Initial Comment:
This patches adds a setsane function to the tty module.

----------------------------------------------------------------------

>Comment By: Martin v. Löwis (loewis)
Date: 2005-03-04 00:49

Message:
Logged In: YES 
user_id=21627

I agree with all these observations. In addition,
documentation is missing for the new function. 

Given all these issues (in particular the questionable value
of the new function in the first place), I'm rejecting the
patch. If you think a functionality like this should still
be added to Python, please submit a new patch, and give a
rationale for why this new function is needed.

----------------------------------------------------------------------

Comment By: Matthew Mueller (donut)
Date: 2005-02-07 09:29

Message:
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.


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1088078&group_id=5470


More information about the Patches mailing list