Skip to content

BUG: Removed too much from the MSVC workaround #50979

Open
@tuxillo

Description

@tuxillo

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

Building math/py-pandas in DragonFly BSD results in:

building 'pandas._libs.window.aggregations' extension                                                                                  
cc -Wno-unused-result -Wsign-compare -DNDEBUG -pipe -I/usr/local/include -I/usr/local/include/ncurses -O2 -fno-strict-aliasing -pipe -O
2 -fno-strict-aliasing -fPIC -DNPY_NO_DEPRECATED_API=0 -Ipandas/_libs/window -I/usr/local/lib/python3.9/site-packages/numpy/core/includ
e -I/usr/local/include/python3.9 -c pandas/_libs/window/aggregations.cpp -o build/temp.dragonfly-6.5-DEVELOPMENT-x86_64-cpython-39/pand
as/_libs/window/aggregations.o                                                                                                         pandas/_libs/window/aggregations.cpp: In function 'void __pyx_f_6pandas_5_libs_6window_12aggregations_add_mean(__pyx_t_5numpy_float64_t
, Py_ssize_t*, __pyx_t_5numpy_float64_t*, Py_ssize_t*, __pyx_t_5numpy_float64_t*, __pyx_t_5numpy_int64_t*, __pyx_t_5numpy_float64_t*)':
pandas/_libs/window/aggregations.cpp:4784:18: error: 'signbit' was not declared in this scope                                          
     __pyx_t_1 = (signbit(__pyx_v_val) != 0);                                                                                          
                  ^~~~~~~                                                                                                              
pandas/_libs/window/aggregations.cpp:4784:18: note: suggested alternative:                                                             
In file included from /usr/include/c++/8.0/complex:44,                                                                                 
                 from pandas/_libs/window/aggregations.cpp:1028:                                                                       
/usr/include/c++/8.0/cmath:677:5: note:   'std::signbit'                                                                               
     signbit(_Tp __x)                                                                                                                  
     ^~~~~~~                                                                                                                           
pandas/_libs/window/aggregations.cpp: In function 'void __pyx_f_6pandas_5_libs_6window_12aggregations_remove_mean(__pyx_t_5numpy_float6
4_t, Py_ssize_t*, __pyx_t_5numpy_float64_t*, Py_ssize_t*, __pyx_t_5numpy_float64_t*)':                                                 
pandas/_libs/window/aggregations.cpp:4951:18: error: 'signbit' was not declared in this scope                                          
     __pyx_t_1 = (signbit(__pyx_v_val) != 0);                                                                                          
                  ^~~~~~~                                                                                                              
pandas/_libs/window/aggregations.cpp:4951:18: note: suggested alternative:                                                             
In file included from /usr/include/c++/8.0/complex:44,                                                                                 
                 from pandas/_libs/window/aggregations.cpp:1028:                                                                       
/usr/include/c++/8.0/cmath:677:5: note:   'std::signbit'                                                                               
     signbit(_Tp __x)                                                                                                                  
     ^~~~~~~                                                                                                                           
error: command '/usr/bin/cc' failed with exit code 1                                                                                   
*** Error code 1

Issue Description

When removing the MSVC workaround here (#45008), too much code was removed and the #else case where cmath was included plus the cdef extern declaration in aggregations.pyx should have been kept for the systems that can't provide cmath C++ functions from cmath.h (or at least that's my understanding).

I also think that the MVS macro conditional down below was for z/OS (belonging to #35829) and not for MSVC so this potentially also broke the build there, althought I have not tested it myself:

++#elif defined(__MVS__)
++#include <cmath>
++

Expected Behavior

The build to be successful :)

Installed Versions

pandas.show_versions()

INSTALLED VERSIONS

commit : 91111fd
python : 3.9.16.final.0
python-bits : 64
OS : DragonFly
OS-release : 6.5-DEVELOPMENT
Version : DragonFly v6.5.0.1.gb1258-DEVEL
machine : x86_64
processor : x86_64
byteorder : little
LC_ALL : None
LANG : None
LOCALE : None.None

pandas : 1.5.1
numpy : 1.23.5
pytz : 2022.7
dateutil : 2.8.2
setuptools : 63.1.0
pip : None
Cython : 0.29.32
pytest : None
hypothesis : None
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 : 1.3.5
brotli : None
fastparquet : None
fsspec : None
gcsfs : None
matplotlib : None
numba : None
numexpr : 2.8.4
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
xlwt : None
zstandard : None
tzdata : None

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugBuildLibrary building on various platforms

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions