From e58c6897cc7b77b92e1c49df82a3504f777b97c9 Mon Sep 17 00:00:00 2001 From: ka-bo <55587089+ka-bo@users.noreply.github.com> Date: Wed, 21 Jul 2021 18:00:57 +0200 Subject: [PATCH] Specified encoding in setup.py calls of open() (#3137) * Specified encoding in setup.py calls of open() * Fix for Python2 Co-authored-by: Karsten Bock --- setup.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index ced3d6958..7aa151c01 100644 --- a/setup.py +++ b/setup.py @@ -11,6 +11,7 @@ import string import subprocess import sys import tempfile +import io import setuptools.command.sdist @@ -70,7 +71,7 @@ exec(code, loc) version = loc["__version__"] # Verify that the version matches the one in C++ -with open("include/pybind11/detail/common.h") as f: +with io.open("include/pybind11/detail/common.h", encoding="utf8") as f: matches = dict(VERSION_REGEX.findall(f.read())) cpp_version = "{MAJOR}.{MINOR}.{PATCH}".format(**matches) if version != cpp_version: