Skip to content

Commit 5f81bad

Browse files
pitmanstJulianWgs
authored andcommitted
Fix unable to build Pandas with xlc on z/OS (pandas-dev#35829)
1 parent c488e6b commit 5f81bad

File tree

3 files changed

+25
-0
lines changed

3 files changed

+25
-0
lines changed

doc/source/whatsnew/v1.3.0.rst

+1
Original file line numberDiff line numberDiff line change
@@ -1101,6 +1101,7 @@ Other
11011101
- Bug in :func:`pandas.testing.assert_index_equal` with ``exact=True`` not raising when comparing :class:`CategoricalIndex` instances with ``Int64Index`` and ``RangeIndex`` categories (:issue:`41263`)
11021102
- Bug in :meth:`DataFrame.equals`, :meth:`Series.equals`, :meth:`Index.equals` with object-dtype containing ``np.datetime64("NaT")`` or ``np.timedelta64("NaT")`` (:issue:`39650`)
11031103
- Bug in :func:`pandas.util.show_versions` where console JSON output was not proper JSON (:issue:`39701`)
1104+
- Let Pandas compile on z/OS when using `xlc <https://www.ibm.com/products/xl-cpp-compiler-zos>`_ (:issue:`35826`)
11041105
- Bug in :meth:`DataFrame.convert_dtypes` incorrectly raised ValueError when called on an empty DataFrame (:issue:`40393`)
11051106
- Bug in :meth:`DataFrame.agg()` not sorting the aggregated axis in the order of the provided aggragation functions when one or more aggregation function fails to produce results (:issue:`33634`)
11061107
- Bug in :meth:`DataFrame.clip` not interpreting missing values as no threshold (:issue:`40420`)

pandas/_libs/src/headers/cmath

+12
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,18 @@ namespace std {
2525
__inline int isnan(double x) { return _isnan(x); }
2626
__inline int notnan(double x) { return x == x; }
2727
}
28+
#elif defined(__MVS__)
29+
#include <cmath>
30+
31+
#define _signbit signbit
32+
#undef signbit
33+
#undef isnan
34+
35+
namespace std {
36+
__inline int notnan(double x) { return x == x; }
37+
__inline int signbit(double num) { return _signbit(num); }
38+
__inline int isnan(double x) { return isnan(x); }
39+
}
2840
#else
2941
#include <cmath>
3042

setup.py

+12
Original file line numberDiff line numberDiff line change
@@ -570,6 +570,17 @@ def srcpath(name=None, suffix=".pyx", subdir="src"):
570570
include = data.get("include", [])
571571
include.append(numpy.get_include())
572572

573+
undef_macros = []
574+
575+
if (
576+
sys.platform == "zos"
577+
and data.get("language") == "c++"
578+
and os.path.basename(os.environ.get("CXX", "/bin/xlc++")) in ("xlc", "xlc++")
579+
):
580+
data.get("macros", macros).append(("__s390__", "1"))
581+
extra_compile_args.append("-qlanglvl=extended0x:nolibext")
582+
undef_macros.append("_POSIX_THREADS")
583+
573584
obj = Extension(
574585
f"pandas.{name}",
575586
sources=sources,
@@ -579,6 +590,7 @@ def srcpath(name=None, suffix=".pyx", subdir="src"):
579590
define_macros=data.get("macros", macros),
580591
extra_compile_args=extra_compile_args,
581592
extra_link_args=extra_link_args,
593+
undef_macros=undef_macros,
582594
)
583595

584596
extensions.append(obj)

0 commit comments

Comments
 (0)