Merge pull request #7192 from radarhere/deprecated

This commit is contained in:
Hugo van Kemenade 2023-05-29 16:08:49 +03:00 committed by GitHub
commit 3e3378fc23
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -132,6 +132,27 @@ getfont(PyObject *self_, PyObject *args, PyObject *kw) {
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(
args,
kw,
@ -147,6 +168,7 @@ getfont(PyObject *self_, PyObject *args, PyObject *kw) {
&layout_engine)) {
return NULL;
}
#endif
self = PyObject_New(FontObject, &Font_Type);
if (!self) {