Cezary Wagner <cezary.wag...@gmail.com> added the comment:

I tested is and it is not "state cookie" but it is "absolute position" and it 
is "stateless".

> The I/O stack in Python 3 does not use C FILE streams, and this issue is not 
> related to Windows. TextIOWrapper.tell returns a "cookie" based on the 
> decoder state:

I will study: 
https://github.com/python/cpython/blob/3.8/Modules/_io/textio.c#L2589 - Thank 
you for reference.

See this test code (wrong seek is good - decoder has not state before - first 
line of program).
You can swap this two fragments and it still works.

print('seek 18446744073709554618')
with open('../s01_parser_eval/data/out-6976.txt') as pgn:
    pgn.seek(18446744073709554618)
    while pgn.tell() != 3003:
        pgn.readline()
        print(pgn.tell())

print()
print('seek 0')
with open('../s01_parser_eval/data/out-6976.txt') as pgn:
    pgn.seek(0)
    while pgn.tell() != 18446744073709554618:
        pgn.readline()
        print(pgn.tell())
    pgn.readline()
    print('next', pgn.tell())

print('seek 18446744073709554618')
with open('../s01_parser_eval/data/out-6976.txt') as pgn:
    pgn.seek(18446744073709554618)
    while pgn.tell() != 3003:
        pgn.readline()
        print(pgn.tell()))

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue39962>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to