Bugs item #1586513, was opened at 2006-10-29 02:56
Message generated for change (Comment added) made by gbrandl
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1586513&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Library
Group: Python 2.5
>Status: Closed
>Resolution: Fixed
Priority: 5
Private: No
Submitted By: Shaun Cutts (shauncutts)
>Assigned to: Georg Brandl (gbrandl)
Summary: codecs.open problem with "with" statement

Initial Comment:
Codecs.open does not seem to properly support the
"with" protocol. Using codecs.open with "with" and
without "with" hill give different results in a simple
test.

-----------------------------------------
from __future__ import with_statement
import codecs

fn = 'test.txt'
f = open( fn, 'w' )
f.write( '\xc5' )
f.close()


f = codecs.open( fn, 'r', 'L1' )
print repr( f.read() )
f.close()

with codecs.open( fn, 'r', 'L1' ) as f:
    print repr( f.read() )
---------------------------------------
output:
---------------------------------------
u'\xc5'
'\xc5'
---------------------------------------
Note: 2nd string not unicode.

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

>Comment By: Georg Brandl (gbrandl)
Date: 2006-10-29 08:39

Message:
Logged In: YES 
user_id=849994

Thanks for the report, this is now fixed in rev. 52517,
52518 (2.5).

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

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1586513&group_id=5470
_______________________________________________
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to