Skip to content

Fix unable to build Pandas with xlc on z/OS #35829

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

Merged
merged 18 commits into from
May 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions doc/source/whatsnew/v1.3.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -913,6 +913,7 @@ Other
- Bug in :func:`pandas.testing.assert_series_equal`, :func:`pandas.testing.assert_frame_equal`, :func:`pandas.testing.assert_index_equal` and :func:`pandas.testing.assert_extension_array_equal` incorrectly raising when an attribute has an unrecognized NA type (:issue:`39461`)
- Bug in :meth:`DataFrame.equals`, :meth:`Series.equals`, :meth:`Index.equals` with object-dtype containing ``np.datetime64("NaT")`` or ``np.timedelta64("NaT")`` (:issue:`39650`)
- Bug in :func:`pandas.util.show_versions` where console JSON output was not proper JSON (:issue:`39701`)
- Let Pandas compile on z/OS when using `xlc <https://www.ibm.com/products/xl-cpp-compiler-zos>`_ (:issue:`35826`)
- Bug in :meth:`DataFrame.convert_dtypes` incorrectly raised ValueError when called on an empty DataFrame (:issue:`40393`)
- Bug in :meth:`DataFrame.clip` not interpreting missing values as no threshold (:issue:`40420`)

Expand Down
12 changes: 12 additions & 0 deletions pandas/_libs/src/headers/cmath
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,18 @@ namespace std {
__inline int isnan(double x) { return _isnan(x); }
__inline int notnan(double x) { return x == x; }
}
#elif defined(__MVS__)
#include <cmath>

#define _signbit signbit
#undef signbit
#undef isnan

namespace std {
__inline int notnan(double x) { return x == x; }
__inline int signbit(double num) { return _signbit(num); }
__inline int isnan(double x) { return isnan(x); }
}
#else
#include <cmath>

Expand Down
12 changes: 12 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -569,6 +569,17 @@ def srcpath(name=None, suffix=".pyx", subdir="src"):
include = data.get("include", [])
include.append(numpy.get_include())

undef_macros = []

if (
sys.platform == "zos"
and data.get("language") == "c++"
and os.path.basename(os.environ.get("CXX", "/bin/xlc++")) in ("xlc", "xlc++")
):
data.get("macros", macros).append(("__s390__", "1"))
extra_compile_args.append("-qlanglvl=extended0x:nolibext")
undef_macros.append("_POSIX_THREADS")

obj = Extension(
f"pandas.{name}",
sources=sources,
Expand All @@ -578,6 +589,7 @@ def srcpath(name=None, suffix=".pyx", subdir="src"):
define_macros=data.get("macros", macros),
extra_compile_args=extra_compile_args,
extra_link_args=extra_link_args,
undef_macros=undef_macros,
)

extensions.append(obj)
Expand Down