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.

classification
Title: 'help' makes linefeed only under Win32
Type: Stage:
Components: Library (Lib) Versions: Python 2.3
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: tim.peters Nosy List: gregsmith, nnorwitz, tim.peters
Priority: normal Keywords:

Created on 2003-01-12 01:04 by gregsmith, last changed 2022-04-10 16:06 by admin. This issue is now closed.

Messages (4)
msg14017 - (view) Author: Gregory Smith (gregsmith) Date: 2003-01-12 01:04
The 'help' command, under a win32 console app, separates
lines with \n instead of \r\n as it has in the past,
making its
output a little hard to follow. Possibly an unintended
side effect
of the 'universal newline' addition?

Python 2.3a1 (#38, Dec 31 2002, 17:53:59) [MSC v.1200
32 bit (Intel)] on win32

(windows 98)

msg14018 - (view) Author: Gregory Smith (gregsmith) Date: 2003-01-16 05:05
Logged In: YES 
user_id=292741

Tracked this down to a change in pydoc.py:
---------------- 2.2.2 -------------------------
def tempfilepager(text, cmd):
    import tempfile
    filename = tempfile.mktemp()
    file = open(filename, 'w')
    file.write(text)
    file.close()
------------------2.3 -------------------------
def tempfilepager(text, cmd):
    import tempfile
    (fd, filename) = tempfile.mkstemp()
    file = os.fdopen(fd, 'w')
    file.write(text)
    file.close()
------------------------------------------------
It seems the use of fdopen means that \n's don't
get  changed to \r\n when the file is written, even though
'w' is used. Whether this should be fixed by modding this
code, or whether this is a fdopen bug, I don't know.

msg14019 - (view) Author: Neal Norwitz (nnorwitz) * (Python committer) Date: 2003-02-07 01:49
Logged In: YES 
user_id=33168

Looking at the code, I don't see any problems.  I'm guessing
this may be a windows issue.  Universal newlines only seems
to affect reading, so shouldn't be an issue.  Hopefully Tim
has time, interest, and a clue, since I don't.  Tim, do you
know if there is a difference between fopen() and fdopen()
on windows?
msg14020 - (view) Author: Tim Peters (tim.peters) * (Python committer) Date: 2003-02-07 02:03
Logged In: YES 
user_id=31435

Neal, yes, it's not even possible for fdopen() to create a 
text-mode file on WIndows, and text mode is needed to get 
the \r\n line ends Windows needs for readability.  
Presumably life on Macs is also screwed by this.

Greg, I reverted the code to the "pre-security craze" 
version.  If someone thinks opening a help file for output is a 
security hole, they can waste their time scratching their 
own paranoid itches <wink>.

Lib/pydoc.py; new revision: 1.75
History
Date User Action Args
2022-04-10 16:06:07adminsetgithub: 37759
2003-01-12 01:04:58gregsmithcreate