Pending removal in Python 3.15¶
The
PyImport_ImportModuleNoBlock(): UsePyImport_ImportModule()instead.PyWeakref_GetObject()andPyWeakref_GET_OBJECT(): UsePyWeakref_GetRef()instead. The pythoncapi-compat project can be used to getPyWeakref_GetRef()on Python 3.12 and older.PyUnicode_AsDecodedObject(): UsePyCodec_Decode()instead.PyUnicode_AsDecodedUnicode(): UsePyCodec_Decode()instead; Note that some codecs (for example, “base64”) may return a type other thanstr, such asbytes.PyUnicode_AsEncodedObject(): UsePyCodec_Encode()instead.PyUnicode_AsEncodedUnicode(): UsePyCodec_Encode()instead; Note that some codecs (for example, “base64”) may return a type other thanbytes, such asstr.Python initialization functions, deprecated in Python 3.13:
Py_GetPath(): UsePyConfig_Get("module_search_paths")(sys.path) instead.Py_GetPrefix(): UsePyConfig_Get("base_prefix")(sys.base_prefix) instead. UsePyConfig_Get("prefix")(sys.prefix) if virtual environments need to be handled.Py_GetExecPrefix(): UsePyConfig_Get("base_exec_prefix")(sys.base_exec_prefix) instead. UsePyConfig_Get("exec_prefix")(sys.exec_prefix) if virtual environments need to be handled.Py_GetProgramFullPath(): UsePyConfig_Get("executable")(sys.executable) instead.Py_GetProgramName(): UsePyConfig_Get("executable")(sys.executable) instead.Py_GetPythonHome(): UsePyConfig_Get("home")or thePYTHONHOMEenvironment variable instead.
The pythoncapi-compat project can be used to get
PyConfig_Get()on Python 3.13 and older.