[issue21398] LC_CTYPE=C: pydoc leaves terminal in an unusable state

2015-03-29 Thread R. David Murray

R. David Murray added the comment:

The KeybaordInterrupt problem has been dealt with in issue 23792.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21398] LC_CTYPE=C: pydoc leaves terminal in an unusable state

2014-05-12 Thread STINNER Victor

STINNER Victor added the comment:

I fixed the initial bug and so I close the issue.

Open a new issue if you have an idea to restore the terminal state when the 
pager breaks the terminal. I don't think that it's possible to save/restore the 
terminal state in a portable way.

--
resolution:  -> fixed
status: open -> closed
versions: +Python 3.4

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21398] LC_CTYPE=C: pydoc leaves terminal in an unusable state

2014-05-12 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 89a29e92416f by Victor Stinner in branch '3.4':
Issue #21398: Fix an unicode error in the pydoc pager when the documentation
http://hg.python.org/cpython/rev/89a29e92416f

New changeset 3424d65ad5ce by Victor Stinner in branch 'default':
(Merge 3.4) Issue #21398: Fix an unicode error in the pydoc pager when the
http://hg.python.org/cpython/rev/3424d65ad5ce

--
nosy: +python-dev

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21398] LC_CTYPE=C: pydoc leaves terminal in an unusable state

2014-05-02 Thread Stefan Krah

Stefan Krah added the comment:

The patch works well BTW.  We can create another issue for the
general misbehavior of pydoc with other exceptions.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21398] LC_CTYPE=C: pydoc leaves terminal in an unusable state

2014-05-02 Thread STINNER Victor

STINNER Victor added the comment:

heapq documentation contains "François" which is not encodable to ASCII. When 
using LC_ALL=C, the locale encoding is ASCII (at least on Linux). It's not easy 
to specify a different error handler globally in pydoc, different functions are 
used and child processes are spawned. The subprocess module doesn't allow to 
specify an error handler different than strict (see #6135).

I propose pydoc_encoding.patch which escapes manually non-encodable characters. 
I chose sys.getfilesystemencoding(), I'm not sure that it's the encoding used 
for all cases of getpager() on all platforms. For example, on Windows, 
sys.getfilesystemencoding() is the ANSI code page, whereas sys.stdout.encoding 
is the OEM code page.

--
keywords: +patch
Added file: http://bugs.python.org/file35132/pydoc_encoding.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21398] LC_CTYPE=C: pydoc leaves terminal in an unusable state

2014-05-02 Thread Stefan Krah

Stefan Krah added the comment:

STINNER Victor  wrote:
> I don't see how to ensure that the terminal state is restored, even on error.

Python2 suppresses the exception until after normal exit (pressing 'q').
I think that behavior is better.

In Python3 you can also get the unusable terminal by pressing Ctrl-C,
i.e. without any UnicodeError.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21398] LC_CTYPE=C: pydoc leaves terminal in an unusable state

2014-05-02 Thread STINNER Victor

STINNER Victor added the comment:

"LC_CTYPE=C:  pydoc leaves terminal in an unusable state"

In the use case, pydoc doesn't touch the terminal, it's the pager: the program 
"less". I don't see how to ensure that the terminal state is restored, even on 
error.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21398] LC_CTYPE=C: pydoc leaves terminal in an unusable state

2014-05-02 Thread Éric Araujo

Changes by Éric Araujo :


--
nosy: +haypo

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21398] LC_CTYPE=C: pydoc leaves terminal in an unusable state

2014-04-30 Thread Stéphane Wirtel

Stéphane Wirtel added the comment:

In python 2.7, If I use my working locales (utf-8) and I use CTRL-C, pydoc does 
not quit but leave a message when the screen is cleaned.

same result with LC_CTYPE=C

bash-4.3$ python -m pydoc heapq
Traceback (most recent call last):
  File 
"/usr/local/Cellar/python/2.7.6_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py",
 line 162, in _run_module_as_main
"__main__", fname, loader, pkg_name)
  File 
"/usr/local/Cellar/python/2.7.6_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py",
 line 72, in _run_code
exec code in run_globals
  File 
"/usr/local/Cellar/python/2.7.6_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/pydoc.py",
 line 2359, in 
if __name__ == '__main__': cli()
  File 
"/usr/local/Cellar/python/2.7.6_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/pydoc.py",
 line 2328, in cli
help.help(arg)
  File 
"/usr/local/Cellar/python/2.7.6_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/pydoc.py",
 line 1793, in help
elif request: doc(request, 'Help on %s:')
  File 
"/usr/local/Cellar/python/2.7.6_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/pydoc.py",
 line 1532, in doc
pager(render_doc(thing, title, forceload))
  File 
"/usr/local/Cellar/python/2.7.6_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/pydoc.py",
 line 1337, in pager
pager(text)
  File 
"/usr/local/Cellar/python/2.7.6_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/pydoc.py",
 line 1357, in 
return lambda text: pipepager(text, 'less')
  File 
"/usr/local/Cellar/python/2.7.6_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/pydoc.py",
 line 1379, in pipepager
pipe.close()
KeyboardInterrupt
bash-4.3$

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21398] LC_CTYPE=C: pydoc leaves terminal in an unusable state

2014-04-30 Thread Stefan Krah

Stefan Krah added the comment:

I can also confirm the need to reset the terminal when using
a working locale and Ctrl-C.

So we have two issues then:

   1) The UnicodeDecodeError should not happen.

   2) pydoc behaves erratically after various exceptions.


In Python2.7 neither of the issues is present.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21398] LC_CTYPE=C: pydoc leaves terminal in an unusable state

2014-04-30 Thread Stéphane Wirtel

Stéphane Wirtel added the comment:

I use OSX 10.9 on my laptop, Python 3.5 and I get this error in one case. If I 
use CTRL-C to quit the application and if LC_CTYPE=C.

with the 'q' key, I don't get this problem.

Just LC_CTYPE=C and CTRL-C and I have to reset my terminal.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21398] LC_CTYPE=C: pydoc leaves terminal in an unusable state

2014-04-30 Thread R. David Murray

R. David Murray added the comment:

Ah, yes, my lc_ctype was en_US.utf-8.  I can reproduce it if I change that.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21398] LC_CTYPE=C: pydoc leaves terminal in an unusable state

2014-04-30 Thread Stefan Krah

Stefan Krah added the comment:

Sorry, then I should have been more explicit:  The failure only occurs
with LC_CTYPE=C.

--
title: pydoc heapq leaves terminal in an unusable state -> LC_CTYPE=C:  pydoc 
leaves terminal in an unusable state

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com