Date conversion recipes do not apply errors= handling to parser overflows
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 2.2k
- Forks
- 172
- Avg merge
- 9m
- Merged PRs (30d)
- 1
Description
parsedate() and parsedatetime() support errors=r.IGNORE and errors=r.SET_NULL for values that cannot be parsed, but they currently only catch dateutil.parser.ParserError.
dateutil.parser.parse() can also raise OverflowError for malformed values with numeric components too large for the underlying date representation. For example:
from sqlite_utils import recipes
value = "999999999999999999999999999999-01-01"
recipes.parsedate(value, errors=recipes.SET_NULL)
Currently this raises OverflowError instead of returning None. The same happens with parsedatetime(), and errors=recipes.IGNORE also fails to return the original value.
A focused fix would treat OverflowError the same as ParserError inside these two recipes while preserving the existing default behavior of re-raising when errors is not set. Targeted tests can cover both recipes and both error-handling modes.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Locate the parsedate() and parsedatetime() recipes and their existing tests; start by reading how they handle ParserError and the errors= modes. Add coverage for oversized numeric date values in both recipes with SET_NULL and IGNORE, while confirming the default still re-raises OverflowError.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, sqlite
- Domain
- database
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 82/100