Skip to content

BUG: Timestamp array comparison may raise RecursionError #15183

Closed
@sinhrks

Description

@sinhrks

Code Sample, a copy-pastable example if possible

import numpy as np
import pandas as pd

n1 = np.array([pd.Timestamp('2011-01-01 00:00:00'),
               pd.Timestamp('2011-01-03 00:00:00-0500', tz='US/Eastern')], dtype=object)

pd.Timestamp('2011-01-03 00:00:00-0500', tz='US/Eastern') == n1 
# RecursionError: maximum recursion depth exceeded

Problem description

Related to #12780. This issue causes datetime-like .replace to raise SystemError. Recursion is caused by this line:

https://github.com/pandas-dev/pandas/blob/master/pandas/tslib.pyx#L1040

Expected Output

raises TypeError.

Output of pd.show_versions()

# Paste the output here pd.show_versions() here

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