Pending removal in Python 3.17

  • datetime:

    • strptime() calls using a format string containing %e (day of month) without a year. This has been deprecated since Python 3.15. (Contributed by Stan Ulbrych in gh-70647.)

  • collections.abc:

    • collections.abc.ByteString is scheduled for removal in Python 3.17.

      実行時に obj が バッファプロトコル を実装しているか調べるには、isinstance(obj, collections.abc.Buffer) を使ってください。 型アノテーションには Buffer を使うか、コードが対応する型を明示したユニオン (例えば bytes | bytearray | memoryview) を使ってください。

      ByteString は当初、bytes と bytearray の両方の上位型となる抽象クラスとして意図されていました。 しかし、この ABC はメソッドを一つも持たないため、あるオブジェクトが ByteString のインスタンスだと分かっても、そのオブジェクトに関する有用な情報は何も得られませんでした。 memoryview など、他の一般的なバッファ型も、実行時にも静的型チェッカーによっても ByteString のサブタイプとして認識されることはありませんでした。

      See PEP 688 for more details. (Contributed by Shantanu Jain in gh-91896.)

  • encodings:

  • profile:

    • The profile module is deprecated and will be removed in Python 3.17. Use profiling.tracing instead, which provides a compatible API. See PEP 799 for details. (Contributed by Pablo Galindo and László Kiss Kollár in gh-138122.)

  • webbrowser:

    • webbrowser.MacOSXOSAScript is deprecated in favour of webbrowser.MacOS. (gh-137586)

  • typing:

    • Before Python 3.14, old-style unions were implemented using the private class typing._UnionGenericAlias. This class is no longer needed for the implementation, but it has been retained for backward compatibility, with removal scheduled for Python 3.17. Users should use documented introspection helpers like typing.get_origin() and typing.get_args() instead of relying on private implementation details.

    • typing.ByteString, deprecated since Python 3.9, is scheduled for removal in Python 3.17.

      実行時に obj が バッファプロトコル を実装しているか調べるには、isinstance(obj, collections.abc.Buffer) を使ってください。 型アノテーションには Buffer を使うか、コードが対応する型を明示したユニオン (例えば bytes | bytearray | memoryview) を使ってください。

      ByteString は当初、bytes と bytearray の両方の上位型となる抽象クラスとして意図されていました。 しかし、この ABC はメソッドを一つも持たないため、あるオブジェクトが ByteString のインスタンスだと分かっても、そのオブジェクトに関する有用な情報は何も得られませんでした。 memoryview など、他の一般的なバッファ型も、実行時にも静的型チェッカーによっても ByteString のサブタイプとして認識されることはありませんでした。

      See PEP 688 for more details. (Contributed by Shantanu Jain in gh-91896.)

  • tkinter:

    • The tkinter.Variable methods trace_variable(), trace() (an alias of trace_variable()), trace_vdelete() and trace_vinfo(), deprecated since Python 3.14, are scheduled for removal in Python 3.17. Use trace_add(), trace_remove() and trace_info() instead. (Contributed by Serhiy Storchaka in gh-120220.)