[issue7262] codecs.open() + eol (windows)

2014-03-08 Thread analyst

analyst added the comment:

Hi,
  I am new to Python Development. I would like to propose a patch for this 
issue.

--
keywords: +patch
nosy: +analyst
Added file: http://bugs.python.org/file34309/7262.patch

___
Python tracker 

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



[issue7262] codecs.open() + eol (windows)

2014-02-03 Thread Mark Lawrence

Changes by Mark Lawrence :


--
nosy:  -BreamoreBoy

___
Python tracker 

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



[issue7262] codecs.open() + eol (windows)

2014-01-28 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
components: +Documentation -Library (Lib)
keywords: +easy
stage:  -> needs patch
versions: +Python 2.7, Python 3.3, Python 3.4 -Python 2.6

___
Python tracker 

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



[issue7262] codecs.open() + eol (windows)

2013-05-19 Thread Mark Lawrence

Mark Lawrence added the comment:

The docs still read the same.  Would someone in the know like to propose a doc 
patch please.

--
nosy: +BreamoreBoy

___
Python tracker 

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



[issue7262] codecs.open() + eol (windows)

2009-11-04 Thread Marc-Andre Lemburg

Marc-Andre Lemburg  added the comment:

Amaury Forgeot d'Arc wrote:
> 
> Amaury Forgeot d'Arc  added the comment:
> 
> The docs say::
>   Files are always opened in binary mode, even if no binary mode was
>   specified. This is done to avoid data loss due to encodings using
>   8-bit values. This means that no automatic conversion of '\n' is done
>   on reading and writing.
> 
> But this does not match the code of codecs.open()::
> if encoding is not None and \
>'b' not in mode:
> # Force opening of the file in binary mode
> mode = mode + 'b'
> 
> When the encoding is None, the file is opened in text mode.
> Marc-Andre, what do you think? is it a documentation bug instead?

Agreed, it's a documentation bug. If no encoding is specified,
codecs.open() works just like the standard open() (except for
the default value of mode, but that's documented).

The idea was to provide a drop-in replacement for open() - with
the added encoding parameter support.

Perhaps the default mode should have been 'r' to match the
regular open() - I guess it's too late to change that, though.

--

___
Python tracker 

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



[issue7262] codecs.open() + eol (windows)

2009-11-04 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc  added the comment:

The docs say::
  Files are always opened in binary mode, even if no binary mode was
  specified. This is done to avoid data loss due to encodings using
  8-bit values. This means that no automatic conversion of '\n' is done
  on reading and writing.

But this does not match the code of codecs.open()::
if encoding is not None and \
   'b' not in mode:
# Force opening of the file in binary mode
mode = mode + 'b'

When the encoding is None, the file is opened in text mode.
Marc-Andre, what do you think? is it a documentation bug instead?

--
assignee:  -> lemburg
nosy: +amaury.forgeotdarc, lemburg

___
Python tracker 

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



[issue7262] codecs.open() + eol (windows)

2009-11-04 Thread shamilbi

New submission from shamilbi :

different eol when writing to fp = codecs.open(.., 'w', 'cp866')
(windows, python-2.6.4)

def write(fp):
fp.write("""\
a
""")

# eol=0d0a (windows, python-2.6.4)
with open('0d0a.tmp', 'w') as fp:
write(fp)

# eol=0d0a (windows, python-2.6.4)
with codecs.open('0d0a-codecs.tmp', 'w') as fp:
write(fp)

# --- BUG ---
# eol=0a (windows, python-2.6.4)
with codecs.open('0a-codecs.tmp', 'w', 'cp866') as fp:
write(fp)

--
components: Library (Lib)
files: eol-bug.py
messages: 94888
nosy: shamilbi
severity: normal
status: open
title: codecs.open() + eol (windows)
type: behavior
versions: Python 2.6
Added file: http://bugs.python.org/file15256/eol-bug.py

___
Python tracker 

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