[Python-Dev] test_inspect failure

Tim Peters tim.one@comcast.net
Sun, 21 Apr 2002 01:47:04 -0400


OK, it's down to this:

>>> f = open('../lib/test/regrtest.py', 'rU')
>>> len(f.readlines())
232
>>> g = open('../lib/test/regrtest.py')
>>> len(g.readlines())
715
>>>

IOW, opening in U mode screws up on Windows when universal newlines is
enabled.  This screws test_inspect.py for reasons so complicated I won't
even try to trace the trail here; the bottom line is that lincache.py's
updatecache() uses U mode near the end:

        fp = open(fullname, 'rU')
        lines = fp.readlines()
        fp.close()

For whatever reason, this only delivers the first 232 lines of regrtest.py.
I doubt it's a coincidence this is darned near exactly the first 8192 bytes
of the file.