Pelokalan
Python ID
id en
Masuk
Proyek
whatsnew__3-14.po Berkas proyek · python-docs-id-3.14 · Bahasa Indonesia
Modul PO Hanya lihat
Teks sumber — English
Terjemahan — Bahasa Indonesia
The new :mod:`compression` package contains modules :mod:`!compression.lzma`, :mod:`!compression.bz2`, :mod:`!compression.gzip` and :mod:`!compression.zlib` which re-export the :mod:`lzma`, :mod:`bz2`, :mod:`gzip` and :mod:`zlib` modules respectively. The new import names under :mod:`!compression` are the preferred names for importing these compression modules from Python 3.14. However, the existing modules names have not been deprecated. Any deprecation or removal of the existing compression modules will occur no sooner than five years after the release of 3.14.
Allow using the :mod:`json` module as a script using the :option:`-m` switch: :program:`python -m json`. This is now preferred to :program:`python -m json.tool`, which is :term:`soft deprecated`. See the :ref:`JSON command-line interface <json-commandline>` documentation. (Contributed by Trey Hunner in :gh:`122873`.)
Raise :exc:`DeprecationWarning` for :func:`sys._clear_type_cache`. This function was deprecated in Python 3.13 but it didn't raise a runtime warning.
Remove the *type*, *choices*, and *metavar* parameters of :class:`!BooleanOptionalAction`. These have been deprecated since Python 3.12. (Contributed by Nikita Sobolev in :gh:`118805`.)
Calling :meth:`~argparse.ArgumentParser.add_argument_group` on an argument group now raises a :exc:`ValueError`. Similarly, :meth:`~argparse.ArgumentParser.add_argument_group` or :meth:`~argparse.ArgumentParser.add_mutually_exclusive_group` on a mutually exclusive group now both raise :exc:`ValueError`\ s. This 'nesting' was never supported, often failed to work correctly, and was unintentionally exposed through inheritance. This functionality has been deprecated since Python 3.11. (Contributed by Savannah Ostrowski in :gh:`127186`.)
Remove the following classes, which have been deprecated aliases of :class:`~ast.Constant` since Python 3.8 and have emitted deprecation warnings since Python 3.12:
Remove the following deprecated properties on :class:`ast.Constant`, which were present for compatibility with the now-removed AST classes:
Remove the following classes, methods, and functions, which have been deprecated since Python 3.12:
Remove :func:`email.utils.localtime`'s *isdst* parameter, which was deprecated in and has been ignored since Python 3.12. (Contributed by Hugo van Kemenade in :gh:`118798`.)
Remove deprecated :mod:`importlib.abc` classes:
Remove the :func:`!get_loader` and :func:`!find_loader` functions, which have been deprecated since Python 3.12. (Contributed by Bénédikt Tran in :gh:`97850`.)
Remove the :func:`!master_open` and :func:`!slave_open` functions, which have been deprecated since Python 3.12. Use :func:`pty.openpty` instead. (Contributed by Nikita Sobolev in :gh:`118824`.)
Using a sequence of parameters with named placeholders now raises a :exc:`~sqlite3.ProgrammingError`, having been deprecated since Python 3.12. (Contributed by Erlend E. Aasland in :gh:`118928` and :gh:`101693`.)
Remove the :class:`!Quoter` class from :mod:`urllib.parse`, which has been deprecated since Python 3.11. (Contributed by Nikita Sobolev in :gh:`118827`.)
Remove the :class:`!URLopener` and :class:`!FancyURLopener` classes from :mod:`urllib.request`, which have been deprecated since Python 3.3.
Deprecated
Usang
Passing a complex number as the *real* or *imag* argument in the :func:`complex` constructor is now deprecated; complex numbers should only be passed as a single positional argument. (Contributed by Serhiy Storchaka in :gh:`109218`.)
Passing the undocumented keyword argument *prefix_chars* to the :meth:`~argparse.ArgumentParser.add_argument_group` method is now deprecated. (Contributed by Savannah Ostrowski in :gh:`125563`.)
Deprecated the :class:`argparse.FileType` type converter. Anything relating to resource management should be handled downstream, after the arguments have been parsed. (Contributed by Serhiy Storchaka in :gh:`58032`.)
The :func:`!asyncio.iscoroutinefunction` is now deprecated and will be removed in Python 3.16; use :func:`inspect.iscoroutinefunction` instead. (Contributed by Jiahao Li and Kumar Aditya in :gh:`122875`.)
The :mod:`asyncio` policy system is deprecated and will be removed in Python 3.16. In particular, the following classes and functions are deprecated:
:mod:`codecs`: The :func:`codecs.open` function is now deprecated, and will be removed in a future version of Python. Use :func:`open` instead. (Contributed by Inada Naoki in :gh:`133036`.)
On non-Windows platforms, setting :attr:`.Structure._pack_` to use a MSVC-compatible default memory layout is now deprecated in favor of setting :attr:`.Structure._layout_` to ``'ms'``, and will be removed in Python 3.19. (Contributed by Petr Viktorin in :gh:`131747`.)
Calling :func:`ctypes.POINTER` on a string is now deprecated. Use :ref:`incomplete types <ctypes-incomplete-types>` for self-referential structures. Also, the internal ``ctypes._pointer_type_cache`` is deprecated. See :func:`ctypes.POINTER` for updated implementation details. (Contributed by Sergey Myrianov in :gh:`100926`.)
:mod:`functools`: Calling the Python implementation of :func:`functools.reduce` with *function* or *sequence* as keyword arguments is now deprecated; the parameters will be made positional-only in Python 3.16. (Contributed by Kirill Podoprigora in :gh:`121676`.)
:mod:`logging`: Support for custom logging handlers with the *strm* argument is now deprecated and scheduled for removal in Python 3.16. Define handlers with the *stream* argument instead. (Contributed by Mariusz Felisiak in :gh:`115032`.)
:mod:`mimetypes`: Valid extensions are either empty or must start with '.' for :meth:`mimetypes.MimeTypes.add_type`. Undotted extensions are deprecated and will raise a :exc:`ValueError` in Python 3.16. (Contributed by Hugo van Kemenade in :gh:`75223`.)
:mod:`!nturl2path`: This module is now deprecated. Call :func:`urllib.request.url2pathname` and :func:`~urllib.request.pathname2url` instead. (Contributed by Barney Gale in :gh:`125866`.)
:mod:`os`: The :func:`os.popen` and :func:`os.spawn* <os.spawnl>` functions are now :term:`soft deprecated`. They should no longer be used to write new code. The :mod:`subprocess` module is recommended instead. (Contributed by Victor Stinner in :gh:`120743`.)
:mod:`pathlib`: :meth:`!pathlib.PurePath.as_uri` is now deprecated and scheduled for removal in Python 3.19. Use :meth:`pathlib.Path.as_uri` instead. (Contributed by Barney Gale in :gh:`123599`.)
:mod:`pdb`: The undocumented ``pdb.Pdb.curframe_locals`` attribute is now a deprecated read-only property, which will be removed in a future version of Python. The low overhead dynamic frame locals access added in Python 3.13 by :pep:`667` means the frame locals cache reference previously stored in this attribute is no longer needed. Derived debuggers should access ``pdb.Pdb.curframe.f_locals`` directly in Python 3.13 and later versions. (Contributed by Tian Gao in :gh:`124369` and :gh:`125951`.)
:mod:`tkinter`: The :class:`!tkinter.Variable` methods :meth:`!trace_variable`, :meth:`!trace_vdelete` and :meth:`!trace_vinfo` are now deprecated. Use :meth:`!trace_add`, :meth:`!trace_remove` and :meth:`!trace_info` instead. (Contributed by Serhiy Storchaka in :gh:`120220`.)
:mod:`urllib.parse`: Accepting objects with false values (like ``0`` and ``[]``) except empty strings, bytes-like objects and ``None`` in :func:`~urllib.parse.parse_qsl` and :func:`~urllib.parse.parse_qs` is now deprecated. (Contributed by Serhiy Storchaka in :gh:`116897`.)
Setting ``__cached__`` on a module while failing to set :attr:`__spec__.cached <importlib.machinery.ModuleSpec.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`)
Setting :attr:`~module.__package__` on a module while failing to set :attr:`__spec__.parent <importlib.machinery.ModuleSpec.parent>` is deprecated. In Python 3.15, :attr:`!__package__` will cease to be set or take into consideration by the import system or standard library. (:gh:`97879`)
The undocumented :func:`!ctypes.SetPointerType` function has been deprecated since Python 3.13.
The obsolete and rarely used :class:`!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.
The :option:`!--cgi` flag to the :program:`python -m http.server` command-line interface has been deprecated since Python 3.13.
:meth:`!.PurePath.is_reserved` has been deprecated since Python 3.13. Use :func:`os.path.isreserved` to detect reserved paths on Windows.
:func:`!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.
The *check_home* argument of :func:`sysconfig.is_python_build` has been deprecated since Python 3.12.
:func:`~threading.RLock` will take no arguments in Python 3.15. Passing any arguments has been deprecated since Python 3.14, as the Python version does not permit any arguments, but the C version allows any number of positional or keyword arguments, ignoring every argument.
:class:`types.CodeType`: Accessing :attr:`!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 :exc:`DeprecationWarning` in 3.12. May be removed in 3.15. (Contributed by Nikita Sobolev in :gh:`101866`.)
The undocumented keyword argument syntax for creating :class:`~typing.NamedTuple` classes (for example, ``Point = NamedTuple("Point", x=int, y=int)``) has been deprecated since Python 3.13. Use the class-based syntax or the functional syntax instead.
When using the functional syntax of :class:`~typing.TypedDict`\s, failing to pass a value to the *fields* parameter (``TD = TypedDict("TD")``) or passing ``None`` (``TD = TypedDict("TD", None)``) has been deprecated since Python 3.13. Use ``class TD(TypedDict): pass`` or ``TD = TypedDict("TD", {})`` to create a TypedDict with zero field.
The :deco:`!typing.no_type_check_decorator` decorator function has been deprecated since Python 3.13. After eight years in the :mod:`typing` module, it has yet to be supported by any major type checker.
The ``getmark()``, ``setmark()`` and ``getmarkers()`` methods of the :class:`~wave.Wave_read` and :class:`~wave.Wave_write` classes have been deprecated since Python 3.13.
:meth:`!zipimport.zipimporter.load_module` has been deprecated since Python 3.10. Use :meth:`~zipimport.zipimporter.exec_module` instead. (:gh:`125746`.)
Setting :attr:`~module.__loader__` on a module while failing to set :attr:`__spec__.loader <importlib.machinery.ModuleSpec.loader>` is deprecated. In Python 3.16, :attr:`!__loader__` will cease to be set or taken into consideration by the import system or the standard library.
The ``'u'`` format code (:c:type:`wchar_t`) has been deprecated in documentation since Python 3.3 and at runtime since Python 3.13. Use the ``'w'`` format code (:c:type:`Py_UCS4`) for Unicode characters instead.
:func:`!asyncio.iscoroutinefunction` is deprecated and will be removed in Python 3.16; use :func:`inspect.iscoroutinefunction` instead. (Contributed by Jiahao Li and Kumar Aditya in :gh:`122875`.)
:mod:`asyncio` policy system is deprecated and will be removed in Python 3.16. In particular, the following classes and functions are deprecated:
Bitwise inversion on boolean types, ``~True`` or ``~False`` has been deprecated since Python 3.12, as it produces surprising and unintuitive results (``-2`` and ``-1``). Use ``not x`` instead for the logical negation of a Boolean. In the rare case that you need the bitwise inversion of the underlying integer, convert to ``int`` explicitly (``~int(x)``).
Calling the Python implementation of :func:`functools.reduce` with *function* or *sequence* as keyword arguments has been deprecated since Python 3.14.
Support for custom logging handlers with the *strm* argument is deprecated and scheduled for removal in Python 3.16. Define handlers with the *stream* argument instead. (Contributed by Mariusz Felisiak in :gh:`115032`.)
Valid extensions start with a '.' or are empty for :meth:`mimetypes.MimeTypes.add_type`. Undotted extensions are deprecated and will raise a :exc:`ValueError` in Python 3.16. (Contributed by Hugo van Kemenade in :gh:`75223`.)
The :class:`!ExecError` exception has been deprecated since Python 3.14. It has not been used by any function in :mod:`!shutil` since Python 3.4, and is now an alias of :exc:`RuntimeError`.
The :meth:`Class.get_methods <symtable.Class.get_methods>` method has been deprecated since Python 3.14.
The :func:`~sys._enablelegacywindowsfsencoding` function has been deprecated since Python 3.13. Use the :envvar:`PYTHONLEGACYWINDOWSFSENCODING` environment variable instead.
The :func:`!sysconfig.expand_makefile_vars` function has been deprecated since Python 3.14. Use the ``vars`` argument of :func:`sysconfig.get_paths` instead.
The undocumented and unused :attr:`!TarFile.tarfile` attribute has been deprecated since Python 3.13.
:meth:`~datetime.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`.)
Passing non-ascii *encoding* names to :func:`encodings.normalize_encoding` is deprecated and scheduled for removal in Python 3.17. (Contributed by Stan Ulbrych in :gh:`136702`.)
The :mod:`!profile` module is deprecated and will be removed in Python 3.17. Use :mod:`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`.)
:class:`!webbrowser.MacOSXOSAScript` is deprecated in favour of :class:`!webbrowser.MacOS`. (:gh:`137586`)
:class:`typing.ByteString`, deprecated since Python 3.9, is scheduled for removal in Python 3.17.
The :class:`!tkinter.Variable` methods :meth:`!trace_variable`, :meth:`!trace` (an alias of :meth:`!trace_variable`), :meth:`!trace_vdelete` and :meth:`!trace_vinfo`, deprecated since Python 3.14, are scheduled for removal in Python 3.17. Use :meth:`!trace_add`, :meth:`!trace_remove` and :meth:`!trace_info` instead. (Contributed by Serhiy Storchaka in :gh:`120220`.)
The non-standard and undocumented :class:`~decimal.Decimal` format specifier ``'N'``, which is only supported in the :mod:`!decimal` module's C implementation, has been deprecated since Python 3.13. (Contributed by Serhiy Storchaka in :gh:`89902`.)
Support for the ``string`` keyword argument name is now deprecated and slated for removal in Python 3.19.
:meth:`http.cookies.Morsel.js_output` is deprecated and will be removed in Python 3.19.
:meth:`http.cookies.BaseCookie.js_output` is deprecated and will be removed in Python 3.19.
Altering :attr:`IMAP4.file <imaplib.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.
Calling the ``__new__()`` method of :class:`struct.Struct` without the *format* argument is deprecated and will be removed in Python 3.20. Calling :meth:`~object.__init__` method on initialized :class:`~struct.Struct` objects is deprecated and will be removed in Python 3.20.
The ``__version__``, ``version`` and ``VERSION`` attributes have been deprecated in these standard library modules and will be removed in Python 3.20. Use :py:data:`sys.version_info` instead.
:mod:`logging` (``__date__`` also deprecated)
Creating instances of abstract AST nodes (such as :class:`ast.AST` or :class:`!ast.expr`) is deprecated and will raise an error in Python 3.20.
It is deprecated to call :func:`isinstance` and :func:`issubclass` checks on protocol classes that were not explicitly decorated with :func:`!runtime_checkable` but that inherit from a runtime-checkable protocol class. This will raise a :exc:`TypeError` in Python 3.20.
Nesting argument groups and nesting mutually exclusive groups are deprecated.
Passing the undocumented keyword argument *prefix_chars* to :meth:`~argparse.ArgumentParser.add_argument_group` is now deprecated.
The :class:`argparse.FileType` type converter is deprecated.
Generators: ``throw(type, exc, tb)`` and ``athrow(type, exc, tb)`` signature is deprecated: use ``throw(exc)`` and ``athrow(exc)`` instead, the single argument signature.
Passing a complex number as the *real* or *imag* argument in the :func:`complex` constructor is now deprecated; it should only be passed as a single positional argument. (Contributed by Serhiy Storchaka in :gh:`109218`.)
:mod:`calendar`: ``calendar.January`` and ``calendar.February`` constants are deprecated and replaced by :data:`calendar.JANUARY` and :data:`calendar.FEBRUARY`. (Contributed by Prince Roshan in :gh:`103636`.)
:func:`~importlib.util.cache_from_source` *debug_override* parameter is deprecated: use the *optimization* parameter instead.
:mod:`logging`: the ``warn()`` method has been deprecated since Python 3.3, use :meth:`~logging.warning` instead.
:mod:`mailbox`: Use of StringIO input and text mode is deprecated, use BytesIO and binary mode instead.
:mod:`os.path`: :func:`os.path.commonprefix` is deprecated, use :func:`os.path.commonpath` for path prefixes. The :func:`os.path.commonprefix` function is being deprecated due to having a misleading name and module. The function is not safe to use for path prefixes despite being included in a module about path manipulation, meaning it is easy to accidentally introduce path traversal vulnerabilities into Python programs by using this function.
:class:`!pydoc.ErrorDuringImport`: A tuple value for *exc_info* parameter is deprecated, use an exception instance.
:mod:`shutil`: :func:`~shutil.rmtree`'s *onerror* parameter is deprecated in Python 3.12; use the *onexc* parameter instead.
:class:`ssl.SSLContext` without protocol argument is deprecated.
:class:`ssl.SSLContext`: :meth:`~ssl.SSLContext.set_npn_protocols` and :meth:`!selected_npn_protocol` are deprecated: use ALPN instead.
:class:`unittest.IsolatedAsyncioTestCase`: it is deprecated to return a value that is not ``None`` from a test case.
:mod:`urllib.parse` deprecated functions: :func:`~urllib.parse.urlparse` instead
:mod:`xml.etree.ElementTree`: Testing the truth value of an :class:`~xml.etree.ElementTree.Element` is deprecated. In a future release it will always return ``True``. Prefer explicit ``len(elem)`` or ``elem is not None`` tests instead.
:func:`sys._clear_type_cache` is deprecated: use :func:`sys._clear_internal_caches` instead.
Creating :c:data:`immutable types <Py_TPFLAGS_IMMUTABLETYPE>` with mutable bases was deprecated in Python 3.12, and now raises a :exc:`TypeError`. (Contributed by Nikita Sobolev in :gh:`119775`.)
Remove ``PyDictObject.ma_version_tag`` member, which was deprecated in Python 3.12. Use the :c:func:`PyDict_AddWatcher` API instead. (Contributed by Sam Gross in :gh:`124296`.)
Deprecated C APIs
The :c:macro:`!Py_HUGE_VAL` macro is now :term:`soft deprecated`. Use :c:macro:`!INFINITY` instead. (Contributed by Sergey B Kirpichev in :gh:`120026`.)
The :c:macro:`!Py_IS_NAN`, :c:macro:`!Py_IS_INFINITY`, and :c:macro:`!Py_IS_FINITE` macros are now :term:`soft deprecated`. Use :c:macro:`!isnan`, :c:macro:`!isinf` and :c:macro:`!isfinite` instead, available from :file:`math.h` since C99. (Contributed by Sergey B Kirpichev in :gh:`119613`.)
Non-tuple sequences are now deprecated as argument for the ``(items)`` format unit in :c:func:`PyArg_ParseTuple` and other :ref:`argument parsing <arg-parsing>` functions if *items* contains format units which store a :ref:`borrowed buffer <c-arg-borrowed-buffer>` or a :term:`borrowed reference`. (Contributed by Serhiy Storchaka in :gh:`50333`.)
The ``_PyMonitoring_FireBranchEvent`` function is now deprecated and should be replaced with calls to :c:func:`PyMonitoring_FireBranchLeftEvent` and :c:func:`PyMonitoring_FireBranchRightEvent`.
The previously undocumented function :c:func:`PySequence_In` is now :term:`soft deprecated`. Use :c:func:`PySequence_Contains` instead. (Contributed by Yuki Kobayashi in :gh:`127896`.)
Python initialization functions, deprecated in Python 3.13:
Functions to configure Python's initialization, deprecated in Python 3.11:
The following private functions are deprecated and planned for removal in Python 3.18:
The following APIs are deprecated and will be removed, although there is currently no date scheduled for their removal.
However, this statement is now deprecated and it is expected to be removed in a future version of Python. This removal will not happen until after Python 3.13 reaches its end of life in 2029, being the last version of Python without support for deferred evaluation of annotations.