Đang chờ xóa trong Python 3.15¶
Zz000zz: Thay vào đó hãy sử dụng
PyImport_ImportModule().PyWeakref_GetObject()vàPyWeakref_GET_OBJECT(): Thay vào đó hãy sử dụngPyWeakref_GetRef(). pythoncapi-compat project có thể được sử dụng để nhậnPyWeakref_GetRef()trên Python 3.12 trở lên.loại
Py_UNICODEvà macroPy_UNICODE_WIDE: Thay vào đó hãy sử dụngwchar_t.PyUnicode_AsDecodedObject(): Thay vào đó hãy sử dụngPyCodec_Decode().PyUnicode_AsDecodedUnicode(): Thay vào đó hãy sử dụngPyCodec_Decode(); Lưu ý rằng một số codec (ví dụ: "base64") có thể trả về loại khácstr, chẳng hạn nhưbytes.PyUnicode_AsEncodedObject(): Thay vào đó hãy sử dụngPyCodec_Encode().PyUnicode_AsEncodedUnicode(): Thay vào đó hãy sử dụngPyCodec_Encode(); Lưu ý rằng một số codec (ví dụ: "base64") có thể trả về loại khácbytes, chẳng hạn nhưstr.Các hàm khởi tạo Python, không được dùng nữa trong Python 3.13:
Py_GetPath(): Thay vào đó hãy sử dụngPyConfig_Get("module_search_paths")(sys.path).Py_GetPrefix(): Thay vào đó hãy sử dụngPyConfig_Get("base_prefix")(sys.base_prefix). Sử dụngPyConfig_Get("prefix")(sys.prefix) nếu cần xử lý virtual environments.Py_GetExecPrefix(): Thay vào đó hãy sử dụngPyConfig_Get("base_exec_prefix")(sys.base_exec_prefix). Sử dụngPyConfig_Get("exec_prefix")(sys.exec_prefix) nếu cần xử lý virtual environments.Py_GetProgramFullPath(): Thay vào đó hãy sử dụngPyConfig_Get("executable")(sys.executable).Py_GetProgramName(): Thay vào đó hãy sử dụngPyConfig_Get("executable")(sys.executable).Py_GetPythonHome(): Thay vào đó hãy sử dụngPyConfig_Get("home")hoặc biến môi trườngPYTHONHOME.
pythoncapi-compat project có thể được sử dụng để nhận
PyConfig_Get()trên Python 3.13 trở lên.Các hàm định cấu hình khởi tạo Python, không được dùng nữa trong Python 3.11:
PySys_SetArgvEx(): Thay vào đó hãy đặtPyConfig.argv.PySys_SetArgv(): Thay vào đó hãy đặtPyConfig.argv.Py_SetProgramName(): Thay vào đó hãy đặtPyConfig.program_name.Py_SetPythonHome(): Thay vào đó hãy đặtPyConfig.home.PySys_ResetWarnOptions(): Thay vào đó hãy xóasys.warnoptionsvàwarnings.filters.
Thay vào đó,
Py_InitializeFromConfig()API nên được sử dụng vớiPyConfig.Biến cấu hình toàn cầu:
Py_DebugFlag: Thay vào đó hãy sử dụngPyConfig.parser_debughoặcPyConfig_Get("parser_debug").Py_VerboseFlag: Thay vào đó hãy sử dụngPyConfig.verbosehoặcPyConfig_Get("verbose").Py_QuietFlag: Thay vào đó hãy sử dụngPyConfig.quiethoặcPyConfig_Get("quiet").Py_InteractiveFlag: Thay vào đó hãy sử dụngPyConfig.interactivehoặcPyConfig_Get("interactive").Py_InspectFlag: Thay vào đó hãy sử dụngPyConfig.inspecthoặcPyConfig_Get("inspect").Py_OptimizeFlag: Thay vào đó hãy sử dụngPyConfig.optimization_levelhoặcPyConfig_Get("optimization_level").Py_NoSiteFlag: Thay vào đó hãy sử dụngPyConfig.site_importhoặcPyConfig_Get("site_import").Py_BytesWarningFlag: Thay vào đó hãy sử dụngPyConfig.bytes_warninghoặcPyConfig_Get("bytes_warning").Py_FrozenFlag: Thay vào đó hãy sử dụngPyConfig.pathconfig_warningshoặcPyConfig_Get("pathconfig_warnings").Py_IgnoreEnvironmentFlag: Thay vào đó hãy sử dụngPyConfig.use_environmenthoặcPyConfig_Get("use_environment").Py_DontWriteBytecodeFlag: Thay vào đó hãy sử dụngPyConfig.write_bytecodehoặcPyConfig_Get("write_bytecode").Py_NoUserSiteDirectory: Thay vào đó hãy sử dụngPyConfig.user_site_directoryhoặcPyConfig_Get("user_site_directory").Py_UnbufferedStdioFlag: Thay vào đó hãy sử dụngPyConfig.buffered_stdiohoặcPyConfig_Get("buffered_stdio").Py_HashRandomizationFlag: Thay vào đó hãy sử dụngPyConfig.use_hash_seedvàPyConfig.hash_seedhoặcPyConfig_Get("hash_seed").Py_IsolatedFlag: Thay vào đó hãy sử dụngPyConfig.isolatedhoặcPyConfig_Get("isolated").Py_LegacyWindowsFSEncodingFlag: Thay vào đó hãy sử dụngPyPreConfig.legacy_windows_fs_encodinghoặcPyConfig_Get("legacy_windows_fs_encoding").Py_LegacyWindowsStdioFlag: Thay vào đó hãy sử dụngPyConfig.legacy_windows_stdiohoặcPyConfig_Get("legacy_windows_stdio").Py_FileSystemDefaultEncoding,Py_HasFileSystemDefaultEncoding: Thay vào đó hãy sử dụngPyConfig.filesystem_encodinghoặcPyConfig_Get("filesystem_encoding").Py_FileSystemDefaultEncodeErrors: Thay vào đó hãy sử dụngPyConfig.filesystem_errorshoặcPyConfig_Get("filesystem_errors").Py_UTF8Mode: Thay vào đó hãy sử dụngPyPreConfig.utf8_modehoặcPyConfig_Get("utf8_mode"). (xemPy_PreInitialize())
Nên sử dụng
Py_InitializeFromConfig()API cùng vớiPyConfigđể đặt các tùy chọn này. HoặcPyConfig_Get()có thể được sử dụng để có được các tùy chọn này khi chạy.