Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0a4efbe

Browse files
authored
Merge pull request #27359 from QuLogic/fix-pypy
Fix build on PyPy
2 parents 166e27a + e08cbf1 commit 0a4efbe

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/_tkagg.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -309,8 +309,8 @@ load_tkinter_funcs()
309309
module = py::module_::import("_tkinter"); // CPython
310310
}
311311
auto py_path = module.attr("__file__");
312-
py::bytes py_path_b = py_path.attr("encode")(
313-
Py_FileSystemDefaultEncoding, Py_FileSystemDefaultEncodeErrors);
312+
auto py_path_b = py::reinterpret_steal<py::bytes>(
313+
PyUnicode_EncodeFSDefault(py_path.ptr()));
314314
std::string path = py_path_b;
315315
auto tkinter_lib = dlopen(path.c_str(), RTLD_LAZY);
316316
if (!tkinter_lib) {

0 commit comments

Comments
 (0)