From 11c9f32c0f99082adeb8e85b7c022a9c1f9126f1 Mon Sep 17 00:00:00 2001 From: eirrgang Date: Wed, 1 Mar 2017 04:53:38 -0500 Subject: [PATCH] fix python version check (#705) Commit 11a337f1 added major and minor python version checking to cast.h but does not use the macros defined via the Python.h inclusion. This may be due to an intention to use the variables defined by the cmake module FindPythonInterpreter, but nothing in the pybind11 repo does anything to convert the cmake variables to preprocessor defines. --- include/pybind11/cast.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/pybind11/cast.h b/include/pybind11/cast.h index b7128d18..30966006 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