mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-02-03 21:24:31 +03:00
Replaced deprecated Py_FileSystemDefaultEncoding for Python >= 3.12
This commit is contained in:
parent
7c910c4cd9
commit
c45019fe0c
|
@ -132,6 +132,27 @@ getfont(PyObject *self_, PyObject *args, PyObject *kw) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if PY_MAJOR_VERSION > 3 || PY_MINOR_VERSION > 11
|
||||||
|
PyConfig config;
|
||||||
|
PyConfig_InitPythonConfig(&config);
|
||||||
|
if (!PyArg_ParseTupleAndKeywords(
|
||||||
|
args,
|
||||||
|
kw,
|
||||||
|
"etf|nsy#n",
|
||||||
|
kwlist,
|
||||||
|
config.filesystem_encoding,
|
||||||
|
&filename,
|
||||||
|
&size,
|
||||||
|
&index,
|
||||||
|
&encoding,
|
||||||
|
&font_bytes,
|
||||||
|
&font_bytes_size,
|
||||||
|
&layout_engine)) {
|
||||||
|
PyConfig_Clear(&config);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
PyConfig_Clear(&config);
|
||||||
|
#else
|
||||||
if (!PyArg_ParseTupleAndKeywords(
|
if (!PyArg_ParseTupleAndKeywords(
|
||||||
args,
|
args,
|
||||||
kw,
|
kw,
|
||||||
|
@ -147,6 +168,7 @@ getfont(PyObject *self_, PyObject *args, PyObject *kw) {
|
||||||
&layout_engine)) {
|
&layout_engine)) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
self = PyObject_New(FontObject, &Font_Type);
|
self = PyObject_New(FontObject, &Font_Type);
|
||||||
if (!self) {
|
if (!self) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user