跳转到主要内容

Pending removal in Python 3.15

  • The !PyImport_ImportModuleNoBlock: Use PyImport_ImportModule instead.

  • !PyWeakref_GetObject and !PyWeakref_GET_OBJECT: Use PyWeakref_GetRef instead. The pythoncapi-compat project can be used to get PyWeakref_GetRef on Python 3.12 and older.

  • !PyUnicode_AsDecodedObject: Use PyCodec_Decode instead.

  • !PyUnicode_AsDecodedUnicode: Use PyCodec_Decode instead; Note that some codecs (for example, "base64") may return a type other than str, such as bytes.

  • !PyUnicode_AsEncodedObject: Use PyCodec_Encode instead.

  • !PyUnicode_AsEncodedUnicode: Use PyCodec_Encode instead; Note that some codecs (for example, "base64") may return a type other than bytes, such as str.

  • Python initialization functions, deprecated in Python 3.13:

    • !Py_GetPath: Use PyConfig_Get("module_search_paths") <PyConfig_Get> (sys.path) instead.
    • !Py_GetPrefix: Use PyConfig_Get("base_prefix") <PyConfig_Get> (sys.base_prefix) instead. Use PyConfig_Get("prefix") <PyConfig_Get> (sys.prefix) if virtual environments <venv-def> need to be handled.
    • !Py_GetExecPrefix: Use PyConfig_Get("base_exec_prefix") <PyConfig_Get> (sys.base_exec_prefix) instead. Use PyConfig_Get("exec_prefix") <PyConfig_Get> (sys.exec_prefix) if virtual environments <venv-def> need to be handled.
    • !Py_GetProgramFullPath: Use PyConfig_Get("executable") <PyConfig_Get> (sys.executable) instead.
    • !Py_GetProgramName: Use PyConfig_Get("executable") <PyConfig_Get> (sys.executable) instead.
    • !Py_GetPythonHome: Use PyConfig_Get("home") <PyConfig_Get> or the PYTHONHOME environment variable instead.

    The pythoncapi-compat project can be used to get PyConfig_Get on Python 3.13 and older.