Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Python: Dev

'text' mode rears its ugly head again

 

 

Python dev RSS feed   Index | Next | Previous | View Threaded


janssen at parc

Sep 16, 2007, 4:01 PM

Post #1 of 4 (289 views)
Permalink
'text' mode rears its ugly head again

I've checked in the asyncore SSL patch, and the Windows buildbots are
failing on the HTTPS test. I believe it's due to this insane
differentiation between between text files and binary files, a bad
idea introduced by Windows and perpetuated (apparently) by Python. I
can't believe this wasn't eliminated in py3k!

Anyway, I think what's going on is that the two data blobs the test
compares, one read from a file opened with "open(filename, 'r')", and
the other a data stream read from an HTTP response "file" returned
from urllib.urlopen(), have different line-endings. Of course, this
only matters on Windows; on UNIX, the faux differentiation doesn't
exist.

Bill

_______________________________________________
Python-Dev mailing list
Python-Dev[at]python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/python-dev/list-python-dev%40lists.gossamer-threads.com


janssen at parc

Sep 16, 2007, 5:16 PM

Post #2 of 4 (272 views)
Permalink
Re: 'text' mode rears its ugly head again [In reply to]

> I've checked in the asyncore SSL patch, and the Windows buildbots are
> failing on the HTTPS test.

Fixed.

Bill
_______________________________________________
Python-Dev mailing list
Python-Dev[at]python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/python-dev/list-python-dev%40lists.gossamer-threads.com


ncoghlan at gmail

Sep 17, 2007, 3:53 AM

Post #3 of 4 (265 views)
Permalink
Re: 'text' mode rears its ugly head again [In reply to]

Bill Janssen wrote:
> I've checked in the asyncore SSL patch, and the Windows buildbots are
> failing on the HTTPS test. I believe it's due to this insane
> differentiation between between text files and binary files, a bad
> idea introduced by Windows and perpetuated (apparently) by Python. I
> can't believe this wasn't eliminated in py3k!

The binary/text distinction is being increased in Py3k rather than
reduced (the API for binary files uses bytes, the API for text files
uses Unicode strings).

Cheers,
Nick.

--
Nick Coghlan | ncoghlan[at]gmail.com | Brisbane, Australia
---------------------------------------------------------------
http://www.boredomandlaziness.org
_______________________________________________
Python-Dev mailing list
Python-Dev[at]python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/python-dev/list-python-dev%40lists.gossamer-threads.com


janssen at parc

Sep 17, 2007, 11:08 AM

Post #4 of 4 (265 views)
Permalink
Re: 'text' mode rears its ugly head again [In reply to]

> > differentiation between between text files and binary files, a bad
> > idea introduced by Windows and perpetuated (apparently) by Python. I
> > can't believe this wasn't eliminated in py3k!
>
> The binary/text distinction is being increased in Py3k rather than
> reduced (the API for binary files uses bytes, the API for text files
> uses Unicode strings).

Actually, it's not so much the differentiation that bothers me, as it
is the default of assuming "text". I think the default should be
"binary", and getting the file in "text" mode should require extra
effort. It should be 'rt', not 'rb' -- an extra qualifier for text
mode, not for binary mode. That would eliminate a lot of the little
bugs like this one that crop up in ports to the ineffable assemblage
that is Windows.

Bill
_______________________________________________
Python-Dev mailing list
Python-Dev[at]python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/python-dev/list-python-dev%40lists.gossamer-threads.com

Python dev RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact lists@gossamer-threads.com
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.