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.
- Py_UNICODEtype and the- Py_UNICODE_WIDEmacro: Use- wchar_tinstead.
- 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")(- sys.path) instead.
- Py_GetPrefix(): Use- PyConfig_Get("base_prefix")(- sys.base_prefix) instead. Use- PyConfig_Get("prefix")(- sys.prefix) if virtual environments need to be handled.
- Py_GetExecPrefix(): Use- PyConfig_Get("base_exec_prefix")(- sys.base_exec_prefix) instead. Use- PyConfig_Get("exec_prefix")(- sys.exec_prefix) if virtual environments need to be handled.
- Py_GetProgramFullPath(): Use- PyConfig_Get("executable")(- sys.executable) instead.
- Py_GetProgramName(): Use- PyConfig_Get("executable")(- sys.executable) instead.
- Py_GetPythonHome(): Use- PyConfig_Get("home")or the- PYTHONHOMEenvironment variable instead.
 - The pythoncapi-compat project can be used to get - PyConfig_Get()on Python 3.13 and older.
- Functions to configure Python’s initialization, deprecated in Python 3.11: - PySys_SetArgvEx(): Set- PyConfig.argvinstead.
- PySys_SetArgv(): Set- PyConfig.argvinstead.
- Py_SetProgramName(): Set- PyConfig.program_nameinstead.
- Py_SetPythonHome(): Set- PyConfig.homeinstead.
- PySys_ResetWarnOptions(): Clear- sys.warnoptionsand- warnings.filtersinstead.
 - The - Py_InitializeFromConfig()API should be used with- PyConfiginstead.
- Global configuration variables: - Py_DebugFlag: Use- PyConfig.parser_debugor- PyConfig_Get("parser_debug")instead.
- Py_VerboseFlag: Use- PyConfig.verboseor- PyConfig_Get("verbose")instead.
- Py_QuietFlag: Use- PyConfig.quietor- PyConfig_Get("quiet")instead.
- Py_InteractiveFlag: Use- PyConfig.interactiveor- PyConfig_Get("interactive")instead.
- Py_InspectFlag: Use- PyConfig.inspector- PyConfig_Get("inspect")instead.
- Py_OptimizeFlag: Use- PyConfig.optimization_levelor- PyConfig_Get("optimization_level")instead.
- Py_NoSiteFlag: Use- PyConfig.site_importor- PyConfig_Get("site_import")instead.
- Py_BytesWarningFlag: Use- PyConfig.bytes_warningor- PyConfig_Get("bytes_warning")instead.
- Py_FrozenFlag: Use- PyConfig.pathconfig_warningsor- PyConfig_Get("pathconfig_warnings")instead.
- Py_IgnoreEnvironmentFlag: Use- PyConfig.use_environmentor- PyConfig_Get("use_environment")instead.
- Py_DontWriteBytecodeFlag: Use- PyConfig.write_bytecodeor- PyConfig_Get("write_bytecode")instead.
- Py_NoUserSiteDirectory: Use- PyConfig.user_site_directoryor- PyConfig_Get("user_site_directory")instead.
- Py_UnbufferedStdioFlag: Use- PyConfig.buffered_stdioor- PyConfig_Get("buffered_stdio")instead.
- Py_HashRandomizationFlag: Use- PyConfig.use_hash_seedand- PyConfig.hash_seedor- PyConfig_Get("hash_seed")instead.
- Py_IsolatedFlag: Use- PyConfig.isolatedor- PyConfig_Get("isolated")instead.
- Py_LegacyWindowsFSEncodingFlag: Use- PyPreConfig.legacy_windows_fs_encodingor- PyConfig_Get("legacy_windows_fs_encoding")instead.
- Py_LegacyWindowsStdioFlag: Use- PyConfig.legacy_windows_stdioor- PyConfig_Get("legacy_windows_stdio")instead.
- Py_FileSystemDefaultEncoding,- Py_HasFileSystemDefaultEncoding: Use- PyConfig.filesystem_encodingor- PyConfig_Get("filesystem_encoding")instead.
- Py_FileSystemDefaultEncodeErrors: Use- PyConfig.filesystem_errorsor- PyConfig_Get("filesystem_errors")instead.
- Py_UTF8Mode: Use- PyPreConfig.utf8_modeor- PyConfig_Get("utf8_mode")instead. (see- Py_PreInitialize())
 - The - Py_InitializeFromConfig()API should be used with- PyConfigto set these options. Or- PyConfig_Get()can be used to get these options at runtime.