Skip to content

Commit 11c9f32

Browse files
eirrgangwjakob
authored andcommitted
fix python version check (#705)
Commit 11a337f 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.
1 parent 5143989 commit 11c9f32

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

include/pybind11/cast.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -646,14 +646,14 @@ struct type_caster<std::basic_string<CharT, Traits, Allocator>, enable_if_t<is_s
646646
using StringType = std::basic_string<CharT, Traits, Allocator>;
647647

648648
bool load(handle src, bool) {
649-
#if PY_VERSION_MAJOR < 3
649+
#if PY_MAJOR_VERSION < 3
650650
object temp;
651651
#endif
652652
handle load_src = src;
653653
if (!src) {
654654
return false;
655655
} else if (!PyUnicode_Check(load_src.ptr())) {
656-
#if PY_VERSION_MAJOR >= 3
656+
#if PY_MAJOR_VERSION >= 3
657657
return false;
658658
// The below is a guaranteed failure in Python 3 when PyUnicode_Check returns false
659659
#else

0 commit comments

Comments
 (0)