Text of docs.python.org › 3.16 › deprecations › index.html as Styx crawled it on Nov 19, 2026. The page may have changed since. Only its words are kept, without pictures or layout, and only the first part of a long page.

Open the live page

Deprecations — Python 3.16.0a2 documentation

Navigation index modules | next | previous | Python » 3.16.0a2 documentation » Deprecations | Theme | Deprecations ¶ 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.

Use isinstance(obj, collections.abc.Buffer) to test if obj implements the buffer protocol at runtime. For use in type annotations, either use Buffer or a union that explicitly specifies the types your code supports (e.g., bytes | bytearray | memoryview ). ByteString was originally intended to be an abstract class that would serve as a supertype of both bytes and bytearray . However, since the ABC never had any methods, knowing that an object was an instance of ByteString never actually told you anything useful about the object.

Other common buffer types such as memoryview were also never understood as subtypes of ByteString (either at runtime or by static type checkers). See PEP 688 for more details. (Contributed by Shantanu Jain in gh-91896 .) encodings : Passing non-ascii encoding names to encodings.normalize_encoding() is deprecated and scheduled for removal in Python 3.17. (Contributed by Stan Ulbrych in gh-136702 .) 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. Use isinstance(obj, collections.abc.Buffer) to test if obj implements the buffer protocol at runtime. For use in type annotations, either use Buffer or a union that explicitly specifies the types your code supports (e.g., bytes | bytearray | memoryview ).

ByteString was originally intended to be an abstract class that would serve as a supertype of both bytes and bytearray . However, since the ABC never had any methods, knowing that an object was an instance of ByteString never actually told you anything useful about the object. Other common buffer types such as memoryview were also never understood as subtypes of ByteString (either at runtime or by static type checkers).

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 .) Pending removal in Python 3.18 ¶ No longer accept a boolean value when a file descriptor is expected. (Contributed by Serhiy Storchaka in gh-82626 .) decimal : The non-standard and undocumented Decimal format specifier 'N' , which is only supported in the decimal module’s C implementation, has been deprecated since Python 3.13. (Contributed by Serhiy Storchaka in gh-89902 .) urllib.parse : Accepting objects with false values (like 0 and [] ) except empty strings, byte-like objects and None in the URL parsing functions has been deprecated since Python 3.16. (Contributed by Jacob Walls in gh-63293 .) Deprecations defined by PEP 829 : import lines in name .pth files are silently ignored. (Contributed by Barry Warsaw in gh-148641 .) Pending removal in Python 3.19 ¶ builtins : Passing a complex number as the real or imag argument in the complex() constructor is now deprecated; it should only be passed as a single positional argument. (Contributed by Serhiy Storchaka in gh-109218 .) ctypes : Implicitly switching to the MSVC-compatible struct layout by setting _pack_ but not _layout_ on non-Windows platforms. hashlib : In hash function constructors such as new() or the direct hash-named constructors such as md5() and sha256() , their optional initial data parameter could also be passed a keyword argument named data= or string= in various hashlib implementations.

Support for the string keyword argument name is now deprecated and slated for removal in Python 3.19. Before Python 3.13, the string keyword parameter was not correctly supported depending on the backend implementation of hash functions. Prefer passing the initial data as a positional argument for maximum backwards compatibility. http.cookies : http.cookies.Morsel.js_output() is deprecated and will be removed in Python 3.19. http.cookies.BaseCookie.js_output() is deprecated and will be removed in Python 3.19. imaplib : Altering IMAP4.file is now deprecated and slated for removal in Python 3.19.

This property is now unused and changing its value does not automatically close the current file. Before Python 3.14, this property was used to implement the corresponding read() and readline() methods for IMAP4 but this is no longer the case since then. tkinter : tkinter.filedialog.askopenfiles() has been deprecated since Python 3.16. Iterate over the names returned by askopenfilenames() and open them one by one instead. (Contributed by Serhiy Storchaka in gh-152638 .) Pending removal in Python 3.20 ¶ Calling the __new__() method of struct.Struct without the format argument is deprecated and will be removed in Python 3.20.

Calling __init__() method on initialized Struct objects is deprecated and will be removed in Python 3.20. (Contributed by Sergey B Kirpichev and Serhiy Storchaka in gh-143715 .) The __version__ , version and VERSION attributes have been deprecated in these standard library modules and will be removed in Python 3.20. Use sys.version_info instead. argparse csv ctypes ctypes.macholib decimal (use decimal.SPEC_VERSION instead) http.server imaplib ipaddress json logging ( __date__ also deprecated) optparse pickle platform re socketserver tabnanny tarfile tkinter.font tkinter.ttk wsgiref.simple_server xml.etree.ElementTree xml.sax.expatreader xml.sax.handler zlib (Contributed by Hugo van Kemenade and Stan Ulbrych in gh-76007 .) The __author__ , __credits__ , __copyright__ and __date__ attributes have been deprecated in these standard library modules and will be removed in Python 3.20.

Attribution is preserved in the source code and the version control history. bz2 concurrent.futures inspect io json logging optparse platform pydoc tarfile tkinter.ttk tokenize uuid (Contributed by Stan Ulbrych in gh-159240 .) Deprecations defined by PEP 829 : Warnings are produced for import lines found in name .pth files. name .pth files are no longer decoded in the locale encoding by default. They MUST be encoded in utf-8-sig . (Contributed by Barry Warsaw in gh-148641 .) ast : Creating instances of abstract AST nodes (such as ast.AST or ast.expr ) is deprecated and will raise an error in Python 3.20. typing : It is deprecated to call isinstance() and issubclass() checks on protocol classes that were not explicitly decorated with runtime_checkable() but that inherit from a runtime-checkable protocol class.

This will raise a TypeError in Python 3.20. (Contributed by Bartosz Sławecki in gh-132604 .) Pending removal in Python 3.21 ¶ abc Soft-deprecated since Python 3.3 abc.abstractclassmethod , abc.abstractstaticmethod , and abc.abstractproperty now raise a DeprecationWarning . These classes will be removed in Python 3.21, instead use abc.abstractmethod() with classmethod() , staticmethod() , and p

The rest of this page is on the live site.