-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: GH42866 DatetimeIndex de-serializing fails in PYTHONOPTIMIZE mode #42871
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BUG: GH42866 DatetimeIndex de-serializing fails in PYTHONOPTIMIZE mode #42871
Conversation
GorAlexander
commented
Aug 3, 2021
•
edited
Loading
edited
- closes BUG: DatetimeIndex de-serializing fails in PYTHONOPTIMIZE mode (python -O) #42866
- tests added / passed
- Ensure all linting tests pass, see here for how to run them
- whatsnew entry
Thanks @GorAlexander @jbrockmendel does pandas have any way of testing code run in |
take a look at test_oo_optimizable |
Thanks - @GorAlexander do you want to have a look there and add a test? |
Hello @GorAlexander! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found: There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻 Comment last updated at 2021-08-04 21:56:34 UTC |
looks fine, can you add a whatsnew note. 1.4 bug fix, Datetimelike section. ping on green. |
…e [fix pre-commit check]
@github-actions pre-commit |
Hi @jreback , I have fixed code-styles and added whatsnew note. |
would be ok for 1.3.x if u can move the note |
no we merge to master and then backport just change the note |
@jreback , thanks! I've moved the note to v1.3.2, so it must be ready. |
Hi @jreback , the whatsnew note was corrected, however GH still highlights about 'changes requested'. Is there smth else to do to get the PR approved? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me
Tried this out and it fails on master
but passes here 👍
(pandas-dev) marcogorelli@OVMG025 pandas-dev % pytest pandas/tests/test_downstream.py -k test_oo_optimized_datetime_index_unpickle -qq
.
------- generated xml file: /Users/marcogorelli/pandas-dev/test-data.xml -------
============================= slowest 30 durations =============================
0.55s call pandas/tests/test_downstream.py::test_oo_optimized_datetime_index_unpickle
(2 durations < 0.005s hidden. Use -vv to show these durations.)
(pandas-dev) marcogorelli@OVMG025 pandas-dev % git checkout upstream/master -- pandas/core/indexes/datetimes.py
(pandas-dev) marcogorelli@OVMG025 pandas-dev % pytest pandas/tests/test_downstream.py -k test_oo_optimized_datetime_index_unpickle -qq
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/Users/marcogorelli/pandas-dev/pandas/core/indexes/datetimes.py", line 96, in _new_DatetimeIndex
result = cls._simple_new(dta, **d)
TypeError: _simple_new() got an unexpected keyword argument 'freq'
F
================================================ FAILURES =================================================
________________________________ test_oo_optimized_datetime_index_unpickle ________________________________
def test_oo_optimized_datetime_index_unpickle():
# GH 42866
> subprocess.check_call(
[
sys.executable,
"-OO",
"-c",
(
"import pandas as pd, pickle; "
"pickle.loads(pickle.dumps(pd.date_range('2021-01-01', periods=1)))"
),
]
)
pandas/tests/test_downstream.py:78:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
popenargs = (['/Users/marcogorelli/opt/miniconda3/envs/pandas-dev/bin/python', '-OO', '-c', "import pandas as pd, pickle; pickle.loads(pickle.dumps(pd.date_range('2021-01-01', periods=1)))"],)
kwargs = {}, retcode = 1
cmd = ['/Users/marcogorelli/opt/miniconda3/envs/pandas-dev/bin/python', '-OO', '-c', "import pandas as pd, pickle; pickle.loads(pickle.dumps(pd.date_range('2021-01-01', periods=1)))"]
def check_call(*popenargs, **kwargs):
"""Run command with arguments. Wait for command to complete. If
the exit code was zero then return, otherwise raise
CalledProcessError. The CalledProcessError object will have the
return code in the returncode attribute.
The arguments are the same as for the call function. Example:
check_call(["ls", "-l"])
"""
retcode = call(*popenargs, **kwargs)
if retcode:
cmd = kwargs.get("args")
if cmd is None:
cmd = popenargs[0]
> raise CalledProcessError(retcode, cmd)
E subprocess.CalledProcessError: Command '['/Users/marcogorelli/opt/miniconda3/envs/pandas-dev/bin/python', '-OO', '-c', "import pandas as pd, pickle; pickle.loads(pickle.dumps(pd.date_range('2021-01-01', periods=1)))"]' returned non-zero exit status 1.
../opt/miniconda3/envs/pandas-dev/lib/python3.8/subprocess.py:364: CalledProcessError
-------------------- generated xml file: /Users/marcogorelli/pandas-dev/test-data.xml ---------------------
========================================== slowest 30 durations ===========================================
0.58s call pandas/tests/test_downstream.py::test_oo_optimized_datetime_index_unpickle
(2 durations < 0.005s hidden. Use -vv to show these durations.)
========================================= short test summary info =========================================
FAILED pandas/tests/test_downstream.py::test_oo_optimized_datetime_index_unpickle - subprocess.CalledPro...
(pandas-dev) marcogorelli@OVMG025 pandas-dev %
thanks @GorAlexander |
…ng fails in PYTHONOPTIMIZE mode
@meeseeksdev backport 1.3.x |
Something went wrong ... Please have a look at my logs. |
…n PYTHONOPTIMIZE mode (#42904) Co-authored-by: Alexander Gorodetsky <[email protected]>