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

Mailing List Archive: Python: Bugs

[issue7349] StringIO.StringIO, io.BytesIO, and io.StringIO accept None in places where other file-like objects don't

 

 

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


report at bugs

Nov 18, 2009, 11:01 AM

Post #1 of 3 (164 views)
Permalink
[issue7349] StringIO.StringIO, io.BytesIO, and io.StringIO accept None in places where other file-like objects don't

New submission from Jean-Paul Calderone <exarkun [at] divmod>:

The actual file type rejects None in places like as the argument to read
or readlines. StringIO.StringIO, io.BytesIO, and io.StringIO all accept
None to mean the same as passing no argument at all.

This makes it tricky to write code that might operate on any of these
types (as many APIs accepting a "file-like object" try to). Testing
with one will not demonstrate that code works with any. In particular,
it's common to start test with StringIO, which is more liberal, and only
discover a problem when code is run for real against an actual file.

----------
components: Library (Lib)
messages: 95439
nosy: exarkun
severity: normal
status: open
title: StringIO.StringIO, io.BytesIO, and io.StringIO accept None in places where other file-like objects don't

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue7349>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Nov 18, 2009, 11:08 AM

Post #2 of 3 (146 views)
Permalink
[issue7349] StringIO.StringIO, io.BytesIO, and io.StringIO accept None in places where other file-like objects don't [In reply to]

Philip Jenvey <pjenvey [at] underboss> added the comment:

The original pure-python impl. of io accepted None, and still does. This
is a regression in C impl.

----------
nosy: +pjenvey

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue7349>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Nov 18, 2009, 4:43 PM

Post #3 of 3 (141 views)
Permalink
[issue7349] StringIO.StringIO, io.BytesIO, and io.StringIO accept None in places where other file-like objects don't [In reply to]

Changes by R. David Murray <rdmurray [at] bitdance>:


----------
nosy: +pitrou

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue7349>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com

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


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.