Skip to content

Incorrect tzinfo check in tslibs.parsing #22234

Closed
@jbrockmendel

Description

@jbrockmendel

https://github.com/pandas-dev/pandas/blob/master/pandas/_libs/tslibs/parsing.pyx#L339

    if isinstance(tzdata, datetime.tzinfo):
                tzinfo = tzdata

If this were ever hit it would raise an error because datetime.tzinfo refers to the tzinfo attached to a datetime object, not the tzinfo class defined in the datetime module.

There's basically no path by which this would be reached because we never pass a tzdata to this function. So two things should happen: fix this to check for the correct object, and either remove unreachable code or make it reachable.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions