# Python 3.15 中待移除的項目

- 引入系統 (import system)：

  - Setting `__cached__` on a module while failing to set `__spec__.cached` is deprecated. In Python 3.15, `__cached__` will cease to be set or take into consideration by the import system or standard library. (gh-97879)

  - 在模組上設定 `__package__` 而沒有設定 `__spec__.parent` 的做法已被棄用。在 Python 3.15 中，引入系統或標準函式庫將不再設定或考慮 `__package__`。(gh-97879)

- `ctypes`：

  - 自 Python 3.13 起，未記錄的 `ctypes.SetPointerType()` 函式已被棄用。

- `http.server`：

  - The obsolete and rarely used `CGIHTTPRequestHandler` has been deprecated since Python 3.13. No direct replacement exists. Anything is better than CGI to interface a web server with a request handler.

  - 自 Python 3.13 起，python -m http.server 命令列介面的 `--cgi` 旗標已被棄用。

- `importlib`：

  - `load_module()` method：請改用 `exec_module()`。

- `pathlib`：

  - `.PurePath.is_reserved()` has been deprecated since Python 3.13. Use `os.path.isreserved()` to detect reserved paths on Windows.

- `platform`：

  - `platform.java_ver()` has been deprecated since Python 3.13. This function is only useful for Jython support, has a confusing API, and is largely untested.

- `sysconfig`：

  - `sysconfig.is_python_build()` 的 check_home 引數自 Python 3.12 起已被棄用。

- `threading`：

  - `RLock()` 在 Python 3.15 中將不接受任何引數。自 Python 3.14 起，傳遞任何引數的用法已被棄用，因為 Python 版本不允許任何引數，但 C 版本允許任意數量的位置或關鍵字引數，並忽略每個引數。

- `types`：

  - `types.CodeType`: Accessing `codeobject.co_lnotab` was deprecated in PEP 626 since 3.10 and was planned to be removed in 3.12, but it only got a proper `DeprecationWarning` in 3.12. May be removed in 3.15. (Contributed by Nikita Sobolev in gh-101866.)

- `typing`：

  - 用於建立 `NamedTuple` 類別的未以文件記錄之關鍵字引數語法 (`Point = NamedTuple("Point", x=int, y=int)`) 已自 Python 3.13 棄用。請改用基於類別的語法或函式語法 (functional syntax)。

  - 當使用 `TypedDict` 的函式語法時，未傳遞值給 fields 參數 (`TD = TypedDict("TD")`) 或傳遞 `None` (`TD = TypedDict("TD", None)`) 的做法自 Python 3.13 起已被棄用。請使用 `class TD(TypedDict): pass` 或 `TD = TypedDict("TD", {})` 來建立具有零個欄位的 TypedDict。

  - The `typing.no_type_check_decorator()` decorator function has been deprecated since Python 3.13. After eight years in the `typing` module, it has yet to be supported by any major type checker.

- `sre_compile`, `sre_constants` and `sre_parse` modules.

- `wave`：

  - The `getmark()`, `setmark()` and `getmarkers()` methods of the `Wave_read` and `Wave_write` classes have been deprecated since Python 3.13.

- `zipimport`：

  - `zipimport.zipimporter.load_module()` has been deprecated since Python 3.10. Use `exec_module()` instead. (gh-125746.)