Skip to content

Commit

Permalink
Prepare release of 0.5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
niklasf committed Oct 14, 2014
1 parent 6f85e97 commit 3fff2e4
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
20 changes: 18 additions & 2 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,25 @@ is more important to get things right, than to be consistent with previous
versions. Use this changelog to see what changed in a new release, because this
might include API breaking changes.

Up for the next release
-----------------------
New in v0.5.0
-------------

* PGN parsing is now more robust: `read_game()` ignores invalid tokens.
Still exceptions are going to be thrown on illegal or ambiguous moves, but
this behaviour can be changed by passing an `error_handler` argument.

.. code:: python
>>> # Raises ValueError:
>>> game = chess.pgn.read_game(file_with_illegal_moves)
.. code:: python
>>> # Silently ignores errors and continues parsing:
>>> game = chess.pgn.read_game(file_with_illegal_moves, None)
.. code:: python
>>> # Logs the error, continues parsing:
>>> game = chess.pgn.read_game(file_with_illegal_moves, logger.exception)
Expand All @@ -30,6 +33,19 @@ Up for the next release
Castling moves like 0-0 (with zeros) are now accepted in PGNs.
The `Bitboard.parse_san()` method remains strict as always, though.

Previously the parser was strictly following the PGN spefification in that
empty lines terminate a game. So a game like

[Event "?"]

{ Starting comment block }

1. e4 e5 2. Nf3 Nf6 *

would have ended directly after the starting comment. To avoid this, the
parser will now look ahead until it finds at least one move or a termination
marker like `*`, `1-0`, `1/2-1/2` or `0-1`.

* Introduce a new function `scan_headers()` to quickly scan a PGN file for
headers without having to parse the full games.

Expand Down
2 changes: 1 addition & 1 deletion chess/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

__email__ = "niklas.fiekas@tu-clausthal.de"

__version__ = "0.4.2"
__version__ = "0.5.0"

import collections
import re
Expand Down

0 comments on commit 3fff2e4

Please sign in to comment.