Skip to content

Date conversion recipes do not apply errors= handling to parser overflows #857

Description

@RamiNoodle733

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions