GeospatialPython/pyshp — pull request #17 by riggsd (2014-12-03 23:34:35+00:00)
Title: Don't Use Asserts For Runtime Errors

While pyshp is generally good about raising appropriate exceptions, it currently uses `assert()` in two places:

* Possibly corrupted DBF header
* User attempting to write larger value than a field allows for

Not only are these both examples of cases where `assert()` isn't appropriate, they're cases that could lead to data corruption if uncaught... and when CPython is invoked with -O or -OO, `assert()` conditions are never raised.

This patch raises a descriptive ShapefileException in these two cases.