Skip to content

fix python version check #705

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 1 commit into from
Mar 1, 2017
Merged
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
4 changes: 2 additions & 2 deletions include/pybind11/cast.h
Original file line number Diff line number Diff line change
Expand Up @@ -646,14 +646,14 @@ struct type_caster<std::basic_string<CharT, Traits, Allocator>, enable_if_t<is_s
using StringType = std::basic_string<CharT, Traits, Allocator>;

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
Expand Down