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_UNICODE type and the Py_UNICODE_WIDE macro: Use wchar_t instead.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 PYTHONHOME environment 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.argv instead.PySys_SetArgv(): Set PyConfig.argv instead.Py_SetProgramName(): Set PyConfig.program_name instead.Py_SetPythonHome(): Set PyConfig.home instead.PySys_ResetWarnOptions(): Clear sys.warnoptions and warnings.filters instead.The Py_InitializeFromConfig() API should be used with PyConfig instead.
Global configuration variables:
Py_DebugFlag: Use PyConfig.parser_debug or PyConfig_Get("parser_debug") instead.Py_VerboseFlag: Use PyConfig.verbose or PyConfig_Get("verbose") instead.Py_QuietFlag: Use PyConfig.quiet or PyConfig_Get("quiet") instead.Py_InteractiveFlag: Use PyConfig.interactive or PyConfig_Get("interactive") instead.Py_InspectFlag: Use PyConfig.inspect or PyConfig_Get("inspect") instead.Py_OptimizeFlag: Use PyConfig.optimization_level or PyConfig_Get("optimization_level") instead.Py_NoSiteFlag: Use PyConfig.site_import or PyConfig_Get("site_import") instead.Py_BytesWarningFlag: Use PyConfig.bytes_warning or PyConfig_Get("bytes_warning") instead.Py_FrozenFlag: Use PyConfig.pathconfig_warnings or PyConfig_Get("pathconfig_warnings") instead.Py_IgnoreEnvironmentFlag: Use PyConfig.use_environment or PyConfig_Get("use_environment") instead.Py_DontWriteBytecodeFlag: Use PyConfig.write_bytecode or PyConfig_Get("write_bytecode") instead.Py_NoUserSiteDirectory: Use PyConfig.user_site_directory or PyConfig_Get("user_site_directory") instead.Py_UnbufferedStdioFlag: Use PyConfig.buffered_stdio or PyConfig_Get("buffered_stdio") instead.Py_HashRandomizationFlag: Use PyConfig.use_hash_seed and PyConfig.hash_seed or PyConfig_Get("hash_seed") instead.Py_IsolatedFlag: Use PyConfig.isolated or PyConfig_Get("isolated") instead.Py_LegacyWindowsFSEncodingFlag: Use PyPreConfig.legacy_windows_fs_encoding or PyConfig_Get("legacy_windows_fs_encoding") instead.Py_LegacyWindowsStdioFlag: Use PyConfig.legacy_windows_stdio or PyConfig_Get("legacy_windows_stdio") instead.Py_FileSystemDefaultEncoding, Py_HasFileSystemDefaultEncoding: Use PyConfig.filesystem_encoding or PyConfig_Get("filesystem_encoding") instead.Py_FileSystemDefaultEncodeErrors: Use PyConfig.filesystem_errors or PyConfig_Get("filesystem_errors") instead.Py_UTF8Mode: Use PyPreConfig.utf8_mode or PyConfig_Get("utf8_mode") instead. (see Py_PreInitialize())The Py_InitializeFromConfig() API should be used with PyConfig to set these options. Or PyConfig_Get() can be used to get these options at runtime.
© 2001–2025 Python Software Foundation
Licensed under the PSF License.
https://docs.python.org/3.14/deprecations/c-api-pending-removal-in-3.15.html