27 lines
893 B
Diff
27 lines
893 B
Diff
From 2a3d42d44c6315ebd73899a35118380d2d5979b5 Mon Sep 17 00:00:00 2001
|
|
From: Tommaso Caiazzi <tommasocaiazzi@gmail.com>
|
|
Date: Mon, 15 May 2023 18:48:01 +0200
|
|
Subject: [PATCH] build: fix building for Python3.11
|
|
|
|
Co-authored-by: Mariano Scazzariello <marianoscazzariello@gmail.com>
|
|
---
|
|
src/common.c | 4 ++++
|
|
1 file changed, 4 insertions(+)
|
|
|
|
diff --git a/src/common.c b/src/common.c
|
|
index ecac76ea..e6bf2935 100644
|
|
--- a/src/common.c
|
|
+++ b/src/common.c
|
|
@@ -39,7 +39,11 @@ pyuv_PyUnicode_EncodeFSDefault(PyObject *unicode)
|
|
return PyUnicode_AsEncodedString(unicode, Py_FileSystemDefaultEncoding, "surrogateescape");
|
|
else
|
|
#endif
|
|
+ #if PY_MAJOR_VERSION >= 3 && PY_MINOR_VERSION >= 11
|
|
+ return PyUnicode_AsUTF8String(unicode);
|
|
+ #else
|
|
return PyUnicode_EncodeUTF8(PyUnicode_AS_UNICODE(unicode), PyUnicode_GET_SIZE(unicode), "surrogateescape");
|
|
+ #endif
|
|
}
|
|
|
|
|