[issue5513] "What's New" should say VERY CLEARLY that the type file is gone
David W. Lambert
report at bugs.python.org
Fri Mar 20 07:00:52 CET 2009
David W. Lambert <lambertdw at corning.com> added the comment:
My file class extends text files with seek or read through condition or
pattern, providing an awk like pattern{action} task separation.
If I allow a pre-existing stream into my constructor (subprocess.Popen
my favorite) I still suffer the same garbage collection problem.
class file(io.TextIOWrapper):
'add condition matching to a stream'
def __init__(self,stream_or_name):
a = stream_or_name
buffer = (a.buffer if isinstance(a, io.TextIOWrapper)
else io.BufferedReader(io.FileIO(a, 'r')))
super().__init__(buffer)
Use this on a stream whose reference count goes to zero causes
ValueError: I/O operation on closed file. Increasing stream's reference
count by saving it with the object corrects it.
I appreciate your considerations.
Dave.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue5513>
_______________________________________
More information about the Python-bugs-list
mailing list