@@ -6,22 +6,25 @@ is more important to get things right, than to be consistent with previous
66versions. Use this changelog to see what changed in a new release, because this
77might include API breaking changes.
88
9- Up for the next release
10- -----------------------
9+ New in v0.5.0
10+ -------------
1111
1212* PGN parsing is now more robust: `read_game() ` ignores invalid tokens.
1313 Still exceptions are going to be thrown on illegal or ambiguous moves, but
1414 this behaviour can be changed by passing an `error_handler ` argument.
1515
1616 .. code :: python
17+
1718 >> > # Raises ValueError:
1819 >> > game = chess.pgn.read_game(file_with_illegal_moves)
1920
2021 .. code :: python
22+
2123 >> > # Silently ignores errors and continues parsing:
2224 >> > game = chess.pgn.read_game(file_with_illegal_moves, None )
2325
2426 .. code :: python
27+
2528 >> > # Logs the error, continues parsing:
2629 >> > game = chess.pgn.read_game(file_with_illegal_moves, logger.exception)
2730
@@ -30,6 +33,19 @@ Up for the next release
3033 Castling moves like 0-0 (with zeros) are now accepted in PGNs.
3134 The `Bitboard.parse_san() ` method remains strict as always, though.
3235
36+ Previously the parser was strictly following the PGN spefification in that
37+ empty lines terminate a game. So a game like
38+
39+ [Event "?"]
40+
41+ { Starting comment block }
42+
43+ 1. e4 e5 2. Nf3 Nf6 *
44+
45+ would have ended directly after the starting comment. To avoid this, the
46+ parser will now look ahead until it finds at least one move or a termination
47+ marker like `* `, `1-0 `, `1/2-1/2 ` or `0-1 `.
48+
3349* Introduce a new function `scan_headers() ` to quickly scan a PGN file for
3450 headers without having to parse the full games.
3551
0 commit comments