BUG: (PyPy) sometimes find_stack_level()
will stop on functools.partial
#54478
Labels
Bug
PyPy
Unreliable Test
Unit tests that occasionally fail
Warnings
Warnings that appear or should be added to pandas
Pandas version checks
I have checked that this issue has not already been reported.
I have confirmed this bug exists on the latest version of pandas.
I have confirmed this bug exists on the main branch of pandas.
Reproducible Example
I am not sure the bug exists in the latest version and main branch, this is tested against 2.0.1. Although I have no reason to think someone fixed it. Searching issues for
find_stack_level
does not work, github seems to find unrelated issues. In any case, this reproduces running thetest_datetime64
tests with PyPy:Issue Description
Working through the failures in conda-forge/pandas-feedstock#162, it seems there is a difference between CPython and PyPy when emitting warnings on
array_ops
. On PyPy, some of these arefunctools.partial
functions, so when climbing the stack to figure out at what level to emit the warning, the algorithm stops insidefunctools
. I instrumented the function with print statements to figure out what is going on (and added a change to make the tests pass):This prints out, for some tests
and for others (note the functools in the middle)
Expected Behavior
Without the fix, tests fail (and the warning has the wrong source file position). With the fix they pass. The fix I proposed seems rather hacky.
Installed Versions
INSTALLED VERSIONS
commit : 0f43794
python : 3.9.16.final.0
python-bits : 64
OS : Linux
OS-release : 5.15.0-78-generic
Version : #85-Ubuntu SMP Fri Jul 7 15:25:09 UTC 2023
machine : x86_64
processor : x86_64
byteorder : little
LC_ALL : None
LANG : en_US.UTF-8
LOCALE : en_US.UTF-8
pandas : 2.0.3
numpy : 1.25.2
pytz : 2023.3
dateutil : 2.8.2
setuptools : 68.0.0
pip : 23.2.1
Cython : None
pytest : 7.4.0
hypothesis : 6.82.2
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : None
IPython : None
pandas_datareader: None
bs4 : None
bottleneck : None
brotli :
fastparquet : None
fsspec : None
gcsfs : None
matplotlib : 3.7.2
numba : None
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : None
pyreadstat : None
pyxlsb : None
s3fs : None
scipy : None
snappy : None
sqlalchemy : None
tables : None
tabulate : None
xarray : None
xlrd : None
zstandard : None
tzdata : 2023.3
qtpy : None
pyqt5 : None
The text was updated successfully, but these errors were encountered: