This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Cezary.Wagner
Recipients Cezary.Wagner
Date 2020-03-13.23:39:01
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1584142741.89.0.229638402821.issue39962@roundup.psfhosted.org>
In-reply-to
Content
I wrote code which scan very large file PGN (chess games database).

But I found that tell() function is buggy see results.

Here is some code:
    with open('../s01_parser_eval/data/out-6976.txt') as pgn:

            is_game_parsed = parser.parse_game(visitor=visitor)

            # if processing_statistics.games % 100 == 0:
            print(processing_statistics.games,
                  processing_statistics.positions,
                  processing_statistics.moves,
                  '%.2f' % processing_statistics.get_games_to_moves(),
                  '%.2f' % processing_statistics.get_positions_to_moves(),
                  '%.2f' % speed if speed else speed,
                  pgn.tell())
            print(pgn.tell())

This code can be simplified to this:
    with open('../s01_parser_eval/data/out-6976.txt') as pgn:
        while True:
            pgn.readline()
            print(pgn.tell())



1 1 0 0.00 0.00 318.64 1008917597
1008917597
2 47 46 23.00 1.02 343.64 1008917599
1008917599
3 47 46 15.33 1.02 291.08 1008920549
1008920549
4 107 107 26.75 1.00 292.03 1008920551
1008920551
5 107 107 21.40 1.00 185.41 18446744074718477807 <- ???
18446744074718477807
6 234 235 39.17 1.00 157.63 1008926192
1008926192
7 234 235 33.57 1.00 167.75 1008928371
1008928371
8 276 278 34.75 0.99 180.48 1008928373
1008928373
9 276 278 30.89 0.99 185.30 1008931145
1008931145
10 334 336 33.60 0.99 192.58 1008931147
1008931147
11 334 336 30.55 0.99 164.90 1008937220
1008937220
12 468 472 39.33 0.99 149.00 1008937222
1008937222
13 468 472 36.31 0.99 157.58 1008938833
1008938833
14 495 502 35.86 0.99 165.96 1008938835
1008938835
15 495 502 33.47 0.99 167.89 1008941875
1008941875
16 556 567 35.44 0.98 172.10 1008941877
1008941877
17 556 567 33.35 0.98 177.84 1008943769
1008943769
18 591 604 33.56 0.98 184.09 1008943771
1008943771
19 591 604 31.79 0.98 185.38 1008946692
1008946692
20 653 666 33.30 0.98 188.68 1008946694
1008946694
21 653 666 31.71 0.98 192.90 18446744074718500485  <- ???
18446744074718500485
History
Date User Action Args
2020-03-13 23:39:01Cezary.Wagnersetrecipients: + Cezary.Wagner
2020-03-13 23:39:01Cezary.Wagnersetmessageid: <1584142741.89.0.229638402821.issue39962@roundup.psfhosted.org>
2020-03-13 23:39:01Cezary.Wagnerlinkissue39962 messages
2020-03-13 23:39:01Cezary.Wagnercreate