-
-
Notifications
You must be signed in to change notification settings - Fork 18.1k
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
TST: Failing test when built with Cython 3.0b2 #53125
Comments
CC @lithomas1 (saw you worked on this in #51640) |
Windows has a couple more failures than unix:
Failure for the first three looks like:
|
Same behavior we xfailed for npdev |
@h-vetinari I have couple of questions:
|
First time I'm testing it, no idea about the stat of 3.0.0b1, though we have builds of that in conda-forge and I could answer that if you want.
Due to the separation of all the various build artefacts, it's hard to use Cython master (though not absolutely impossible, if something is urgent). Otherwise I'd retest with the next beta. |
I did not went in deep with pandas and Cython3 compatibility. So It would be great to know which is last version of Cython without issue. |
On conda-forge infra, the latest released pandas (2.0.1) passes its test suite when compiled with the latest released Cython (0.29.34), see conda-forge/pandas-feedstock#163 |
I double checked pandas with multiple cython versions:
Additional observation of pandas codebase compatibility with Cython 3.0: pandas code base was not migrated to new
|
OK. I have found the culprit. The issue is here: pandas/pandas/_libs/tslibs/offsets.pyx Line 4540 in a90fbc8
The simple reproducer is following: from cpython.datetime cimport datetime
from pandas import Timestamp
import numpy as np
cdef datetime ts = Timestamp(np.datetime64("-20000-12-31"))
ts2 = Timestamp(np.datetime64("-20000-12-31"))
print(ts.year)
print(ts2.year)
So the workaround is simple - just remove
|
I played a bit with the issue. I am not sure whether the bug is on Cython side. Cython is using datetime API which should not support dates with year set to >>> datetime(year=-2000, month=12, day=31)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: year -2000 is out of range |
I have investigated another bit. Here is a function definition generated by Cython: static CYTHON_INLINE int __pyx_f_7cpython_8datetime_8datetime_4year_year(PyDateTime_DateTime *__pyx_v_self) {
int __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("year", 0);
/* "cpython/datetime.pxd":112
* @property
* cdef inline int year(self):
* return PyDateTime_GET_YEAR(self) # <<<<<<<<<<<<<<
*
* @property
*/
__pyx_r = PyDateTime_GET_YEAR(((PyObject *)__pyx_v_self));
goto __pyx_L0;
/* "cpython/datetime.pxd":111
* ctypedef extern class datetime.datetime[object PyDateTime_DateTime]:
* @property
* cdef inline int year(self): # <<<<<<<<<<<<<<
* return PyDateTime_GET_YEAR(self)
*
*/
/* function exit code */
__pyx_L0:;
__Pyx_RefNannyFinishContext();
return __pyx_r;
} Basically it returns data directly from |
Encountered in conda-forge/pandas-feedstock#162 on linux when building pandas 2.0.1 against Cython 3.0.0b2 and running the test suite
Thankfully, it is the only error:
Test environment
The text was updated successfully, but these errors were encountered: