Pending removal in Python 3.17
datetime:~datetime.datetime.strptimecalls using a format string containing%e(day of month) without a year. This has been deprecated since Python 3.15. (Contributed by Stan Ulbrych in70647.)
collections.abc:-
collections.abc.ByteStringis scheduled for removal in Python 3.17.Use
isinstance(obj, collections.abc.Buffer)to test ifobjimplements thebuffer protocol <bufferobjects>at runtime. For use in type annotations, either use~collections.abc.Bufferor a union that explicitly specifies the types your code supports (e.g.,bytes | bytearray | memoryview).!ByteStringwas originally intended to be an abstract class that would serve as a supertype of bothbytesandbytearray. However, since the ABC never had any methods, knowing that an object was an instance of!ByteStringnever actually told you anything useful about the object. Other common buffer types such asmemoryviewwere also never understood as subtypes of!ByteString(either at runtime or by static type checkers).See
PEP 688 <688#current-options>for more details. (Contributed by Shantanu Jain in91896.)
-
encodings:- Passing non-ascii encoding names to
encodings.normalize_encodingis deprecated and scheduled for removal in Python 3.17. (Contributed by Stan Ulbrych in136702.)
- Passing non-ascii encoding names to
profile:- The
!profilemodule is deprecated and will be removed in Python 3.17. Useprofiling.tracinginstead, which provides a compatible API. See799for details. (Contributed by Pablo Galindo and László Kiss Kollár in138122.)
- The
webbrowser:!webbrowser.MacOSXOSAScriptis deprecated in favour of!webbrowser.MacOS. (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 liketyping.get_originandtyping.get_argsinstead of relying on private implementation details. -
typing.ByteString, deprecated since Python 3.9, is scheduled for removal in Python 3.17.Use
isinstance(obj, collections.abc.Buffer)to test ifobjimplements thebuffer protocol <bufferobjects>at runtime. For use in type annotations, either use~collections.abc.Bufferor a union that explicitly specifies the types your code supports (e.g.,bytes | bytearray | memoryview).!ByteStringwas originally intended to be an abstract class that would serve as a supertype of bothbytesandbytearray. However, since the ABC never had any methods, knowing that an object was an instance of!ByteStringnever actually told you anything useful about the object. Other common buffer types such asmemoryviewwere also never understood as subtypes of!ByteString(either at runtime or by static type checkers).See
PEP 688 <688#current-options>for more details. (Contributed by Shantanu Jain in91896.)
-
tkinter:- The
!tkinter.Variablemethods!trace_variable,!trace(an alias of!trace_variable),!trace_vdeleteand!trace_vinfo, deprecated since Python 3.14, are scheduled for removal in Python 3.17. Use!trace_add,!trace_removeand!trace_infoinstead. (Contributed by Serhiy Storchaka in120220.)
- The
谢谢你的反馈!