Skip to content

BUG: segfault when using datetime.datetime.replace on Timestamp #42305

Closed
@johnmreynolds

Description

@johnmreynolds
  • I have checked that this issue has not already been reported.

This seems to be similar to much older bugs 14621 and 7825, but I can't see an open one,

  • I have confirmed this bug exists on the latest version of pandas.

Occurs with 1.2.4 which seems to be the current one I can get.

  • (optional) I have confirmed this bug exists on the master branch of pandas.

Not done.


Note: Please read this guide detailing how to provide the necessary information for us to reproduce your bug.

Code Sample, a copy-pastable example

>>> import pandas as pd
>>> import datetime
>>> datetime.datetime.replace(pd.Timestamp('2021-01-01'), tzinfo=None)
Segmentation fault

Problem description

Unexpected segmentation fault, which shouldn't occur with basic function usage.

Expected Output

It's not entirely clear whether this should work, but it shouldn't crash.

Output of pd.show_versions()

INSTALLED VERSIONS

commit : 2cb9652
python : 3.7.9.final.0
python-bits : 64
OS : Windows
OS-release : 10
Version : 10.0.18362
machine : AMD64
processor : Intel64 Family 6 Model 158 Stepping 10, GenuineIntel
byteorder : little
LC_ALL : None
LANG : en_US.UTF-8
LOCALE : None.None

pandas : 1.2.4
numpy : 1.19.1
pytz : 2020.1
dateutil : 2.8.1
pip : 20.2.3
setuptools : 50.3.0.post20201006
Cython : None
pytest : 6.2.2
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : 1.3.7
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : 2.8.6 (dt dec pq3 ext lo64)
jinja2 : 2.11.2
IPython : 7.18.1
pandas_datareader: None
bs4 : 4.9.3
bottleneck : None
fsspec : 0.8.4
fastparquet : 0.4.1
gcsfs : None
matplotlib : None
numexpr : None
odfpy : None
openpyxl : 3.0.0
pandas_gbq : None
pyarrow : None
pyxlsb : None
s3fs : None
scipy : 1.5.2
sqlalchemy : None
tables : None
tabulate : None
xarray : None
xlrd : 1.2.0
xlwt : None
numba : 0.51.2

Also occurs on python 3.8.8.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugSegfaultNon-Recoverable ErrorUpstream issueIssue related to pandas dependencydatetime.datestdlib datetime.date support

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions