Skip to content

Commit e58c689

Browse files
ka-boKarsten Bock
and
Karsten Bock
authored
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 <[email protected]>
1 parent d65edfb commit e58c689

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

setup.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import subprocess
1212
import sys
1313
import tempfile
14+
import io
1415

1516
import setuptools.command.sdist
1617

@@ -70,7 +71,7 @@ def build_expected_version_hex(matches):
7071
version = loc["__version__"]
7172

7273
# Verify that the version matches the one in C++
73-
with open("include/pybind11/detail/common.h") as f:
74+
with io.open("include/pybind11/detail/common.h", encoding="utf8") as f:
7475
matches = dict(VERSION_REGEX.findall(f.read()))
7576
cpp_version = "{MAJOR}.{MINOR}.{PATCH}".format(**matches)
7677
if version != cpp_version:

0 commit comments

Comments
 (0)