diff --git a/include/pybind11/cast.h b/include/pybind11/cast.h index b7128d1847..3096600666 100644 --- a/include/pybind11/cast.h +++ b/include/pybind11/cast.h @@ -646,14 +646,14 @@ struct type_caster, enable_if_t; bool load(handle src, bool) { -#if PY_VERSION_MAJOR < 3 +#if PY_MAJOR_VERSION < 3 object temp; #endif handle load_src = src; if (!src) { return false; } else if (!PyUnicode_Check(load_src.ptr())) { -#if PY_VERSION_MAJOR >= 3 +#if PY_MAJOR_VERSION >= 3 return false; // The below is a guaranteed failure in Python 3 when PyUnicode_Check returns false #else