Pending removal in Python 3.15¶
The bundled copy of
libmpdecimal
.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.Py_UNICODE
type and thePy_UNICODE_WIDE
macro: Usewchar_t
instead.Python initialization functions:
PySys_ResetWarnOptions()
: Clearsys.warnoptions
andwarnings.filters
instead.Py_GetExecPrefix()
: Getsys.base_exec_prefix
andsys.exec_prefix
instead.Py_GetPath()
: Getsys.path
instead.Py_GetPrefix()
: Getsys.base_prefix
andsys.prefix
instead.Py_GetProgramFullPath()
: Getsys.executable
instead.Py_GetProgramName()
: Getsys.executable
instead.Py_GetPythonHome()
: GetPyConfig_Get("home")
or thePYTHONHOME
environment variable instead.
See also the
PyConfig_Get()
function.Functions to configure Python’s initialization, deprecated in Python 3.11:
PySys_SetArgvEx()
: SetPyConfig.argv
instead.PySys_SetArgv()
: SetPyConfig.argv
instead.Py_SetProgramName()
: SetPyConfig.program_name
instead.Py_SetPythonHome()
: SetPyConfig.home
instead.
The
Py_InitializeFromConfig()
API should be used withPyConfig
instead.Global configuration variables:
Py_DebugFlag
: UsePyConfig.parser_debug
orPyConfig_Get("parser_debug")
instead.Py_VerboseFlag
: UsePyConfig.verbose
orPyConfig_Get("verbose")
instead.Py_QuietFlag
: UsePyConfig.quiet
orPyConfig_Get("quiet")
instead.Py_InteractiveFlag
: UsePyConfig.interactive
orPyConfig_Get("interactive")
instead.Py_InspectFlag
: UsePyConfig.inspect
orPyConfig_Get("inspect")
instead.Py_OptimizeFlag
: UsePyConfig.optimization_level
orPyConfig_Get("optimization_level")
instead.Py_NoSiteFlag
: UsePyConfig.site_import
orPyConfig_Get("site_import")
instead.Py_BytesWarningFlag
: UsePyConfig.bytes_warning
orPyConfig_Get("bytes_warning")
instead.Py_FrozenFlag
: UsePyConfig.pathconfig_warnings
orPyConfig_Get("pathconfig_warnings")
instead.Py_IgnoreEnvironmentFlag
: UsePyConfig.use_environment
orPyConfig_Get("use_environment")
instead.Py_DontWriteBytecodeFlag
: UsePyConfig.write_bytecode
orPyConfig_Get("write_bytecode")
instead.Py_NoUserSiteDirectory
: UsePyConfig.user_site_directory
orPyConfig_Get("user_site_directory")
instead.Py_UnbufferedStdioFlag
: UsePyConfig.buffered_stdio
orPyConfig_Get("buffered_stdio")
instead.Py_HashRandomizationFlag
: UsePyConfig.use_hash_seed
andPyConfig.hash_seed
orPyConfig_Get("hash_seed")
instead.Py_IsolatedFlag
: UsePyConfig.isolated
orPyConfig_Get("isolated")
instead.Py_LegacyWindowsFSEncodingFlag
: UsePyPreConfig.legacy_windows_fs_encoding
orPyConfig_Get("legacy_windows_fs_encoding")
instead.Py_LegacyWindowsStdioFlag
: UsePyConfig.legacy_windows_stdio
orPyConfig_Get("legacy_windows_stdio")
instead.Py_FileSystemDefaultEncoding
,Py_HasFileSystemDefaultEncoding
: UsePyConfig.filesystem_encoding
orPyConfig_Get("filesystem_encoding")
instead.Py_FileSystemDefaultEncodeErrors
: UsePyConfig.filesystem_errors
orPyConfig_Get("filesystem_errors")
instead.Py_UTF8Mode
: UsePyPreConfig.utf8_mode
orPyConfig_Get("utf8_mode")
instead. (seePy_PreInitialize()
)
The
Py_InitializeFromConfig()
API should be used withPyConfig
to set these options. OrPyConfig_Get()
can be used to get these options at runtime.