# Deprecjacje

## Oczekujące na usunięcie w Pythonie 3.15

- The 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)

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

- `ctypes`:

  - The undocumented `ctypes.SetPointerType()` function has been deprecated since Python 3.13.

- `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.

  - The `--cgi` flag to the python -m http.server command-line interface has been deprecated since Python 3.13.

- `importlib`:

  - `load_module()` method: use `exec_module()` instead.

- `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`:

  - The check_home argument of `sysconfig.is_python_build()` has been deprecated since Python 3.12.

- `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.

- `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`:

  - The undocumented keyword argument syntax for creating `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 `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 `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.)

## Pending removal in Python 3.16

- The import system:

  - Setting `__loader__` on a module while failing to set `__spec__.loader` is deprecated. In Python 3.16, `__loader__` will cease to be set or taken into consideration by the import system or the standard library.

- `array`:

  - The `'u'` format code (`wchar_t`) has been deprecated in documentation since Python 3.3 and at runtime since Python 3.13. Use the `'w'` format code (`Py_UCS4`) for Unicode characters instead.

- `asyncio`:

  - `asyncio.iscoroutinefunction()` is deprecated and will be removed in Python 3.16; use `inspect.iscoroutinefunction()` instead. (Contributed by Jiahao Li and Kumar Aditya in gh-122875.)

  - `asyncio` policy system is deprecated and will be removed in Python 3.16. In particular, the following classes and functions are deprecated:

    - `asyncio.AbstractEventLoopPolicy`

    - `asyncio.DefaultEventLoopPolicy`

    - `asyncio.WindowsSelectorEventLoopPolicy`

    - `asyncio.WindowsProactorEventLoopPolicy`

    - `asyncio.get_event_loop_policy()`

    - `asyncio.set_event_loop_policy()`

    Users should use `asyncio.run()` or `asyncio.Runner` with loop_factory to use the desired event loop implementation.

    For example, to use `asyncio.SelectorEventLoop` on Windows:

        import asyncio

        async def main():
            ...

        asyncio.run(main(), loop_factory=asyncio.SelectorEventLoop)

    (Contributed by Kumar Aditya in gh-127949.)

- `builtins`:

  - 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)`).

- `functools`:

  - Calling the Python implementation of `functools.reduce()` with function or sequence as keyword arguments has been deprecated since Python 3.14.

- `logging`:

  - 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.)

- `mimetypes`:

  - Valid extensions start with a «.» or are empty for `mimetypes.MimeTypes.add_type()`. Undotted extensions are deprecated and will raise a `ValueError` in Python 3.16. (Contributed by Hugo van Kemenade in gh-75223.)

- `shutil`:

  - The `ExecError` exception has been deprecated since Python 3.14. It has not been used by any function in `shutil` since Python 3.4, and is now an alias of `RuntimeError`.

- `symtable`:

  - The `symtable.Class.get_methods()` method has been deprecated since Python 3.14.

- `sys`:

  - The `_enablelegacywindowsfsencoding()` function has been deprecated since Python 3.13. Use the `PYTHONLEGACYWINDOWSFSENCODING` environment variable instead.

- `sysconfig`:

  - The `sysconfig.expand_makefile_vars()` function has been deprecated since Python 3.14. Use the `vars` argument of `sysconfig.get_paths()` instead.

- `tarfile`:

  - The undocumented and unused `TarInfo.tarfile` attribute has been deprecated since Python 3.13.

## 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.)

- `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.)

## 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.)

- Wycofania zdefiniowane przez PEP 829:

  - `import` lines in `name.pth` files are silently ignored.

  (Wkład Barry’ego Warsawa w gh-148641.)

## Pending removal in Python 3.19

- `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.

## Oczekujące na usunięcie w Pythonie 3.20

- Dzwonienie do ``__new__()``metoda z `struct.Struct` bez argumentu format jest przestarzałe i zostanie usunięte w Python 3.20. Wywołanie `__init__()` Metoda na zainicjowanych `Struct` obiektach jest przestarzała i zostanie usunięta w Python 3.20.

  (Nadesłane przez Sergeya B. Kirpicheva i Serhiya Storchakę w gh-143715.)

- The `__version__`, `version` I ``VERSION``atrybut były przestarzały w tychbibl standardowe moduły biblioteczne i zostaną usunięte w Python 3.20. Użyjioteka `sys.version_info` Zamiast.

  - `argparse`

  - `csv`

  - `ctypes`

  - `ctypes.macholib`

  - `decimal` (używać `decimal.SPEC_VERSION` Zamiast)

  - `http.server`

  - `imaplib`

  - `ipaddress`

  - `json`

  - `logging`(``__date__`` Również przestarzały)

  - `optparse`

  - `pickle`

  - `platform`

  - `re`

  - `socketserver`

  - `tabnanny`

  - `tarfile`

  - `tkinter.font`

  - `tkinter.ttk`

  - `wsgiref.simple_server`

  - `xml.etree.ElementTree`

  - `xml.sax.expatreader`

  - `xml.sax.handler`

  - `zlib`

  (Wkład Hugo van Kemenade i Stana Ulbrycha w gh-76007.)

- Wycofania zdefiniowane przez PEP 829:

  - Warnings are produced for `import` lines found in `name.pth` files.

  - `name.pth` Pliki nie są już domyślnie dekodowane w kodowaniu regionalnym. MUSZĄ być zakodowane w formacie `utf-8-sig` .

  (Wkład Barry’ego Warsawa w gh-148641.)

- `ast`

  - Tworzenie wystąpień abstrakcyjnych węzłów AST (takich jak `ast.AST` lub `ast.expr`) Jest przestarzały i będzie rzucić jakiś błąd w Python 3.20.

## Pending removal in Python 3.21

- `ast`

  - Classes `slice`, `Index`, `ExtSlice`, `Suite`, `Param`, `AugLoad` and `AugStore`, will be removed in Python 3.21. These types are not generated by the parser or accepted by the code generator.

  - The `dims` property of `ast.Tuple` will be removed in Python 3.21. Use the `ast.Tuple.elts` property instead.

## Pending removal in future versions

The following APIs will be removed in the future, although there is currently no date scheduled for their removal.

- `argparse`:

  - Nesting argument groups and nesting mutually exclusive groups are deprecated.

  - Passing the undocumented keyword argument prefix_chars to `add_argument_group()` is now deprecated.

  - The `argparse.FileType` type converter is deprecated.

- `builtins`:

  - Generators: `throw(type, exc, tb)` and `athrow(type, exc, tb)` signature is deprecated: use `throw(exc)` and `athrow(exc)` instead, the single argument signature.

  - Currently Python accepts numeric literals immediately followed by keywords, for example `0in x`, `1or x`, `0if 1else 2`. It allows confusing and ambiguous expressions like `[0x1for x in y]` (which can be interpreted as `[0x1 for x in y]` or `[0x1f or x in y]`). A syntax warning is raised if the numeric literal is immediately followed by one of keywords `and`, `else`, `for`, `if`, `in`, `is` and `or`. In a future release it will be changed to a syntax error. (gh-87999)

  - Support for `__index__()` and `__int__()` method returning non-int type: these methods will be required to return an instance of a strict subclass of `int`.

  - Support for `__float__()` method returning a strict subclass of `float`: these methods will be required to return an instance of `float`.

  - Support for `__complex__()` method returning a strict subclass of `complex`: these methods will be required to return an instance of `complex`.

  - 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.)

- `calendar`: `calendar.January` and `calendar.February` constants are deprecated and replaced by `calendar.JANUARY` and `calendar.FEBRUARY`. (Contributed by Prince Roshan in gh-103636.)

- `codecs`: use `open()` instead of `codecs.open()`. (gh-133038)

- `codeobject.co_lnotab`: use the `codeobject.co_lines()` method instead.

- `datetime`:

  - `utcnow()`: use `datetime.datetime.now(tz=datetime.UTC)`.

  - `utcfromtimestamp()`: use `datetime.datetime.fromtimestamp(timestamp, tz=datetime.UTC)`.

- `gettext`: Plural value must be an integer.

- `importlib`:

  - `cache_from_source()` debug_override parameter is deprecated: use the optimization parameter instead.

- `importlib.metadata`:

  - `EntryPoints` tuple interface.

  - Implicit `None` on return values.

- `logging`: the `warn()` method has been deprecated since Python 3.3, use `warning()` instead.

- `mailbox`: Use of StringIO input and text mode is deprecated, use BytesIO and binary mode instead.

- `os`: Calling `os.register_at_fork()` in a multi-threaded process.

- `os.path`: `os.path.commonprefix()` is deprecated, use `os.path.commonpath()` for path prefixes. The `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.

- `pydoc.ErrorDuringImport`: A tuple value for exc_info parameter is deprecated, use an exception instance.

- `re`: More strict rules are now applied for numerical group references and group names in regular expressions. Only sequence of ASCII digits is now accepted as a numerical reference. The group name in bytes patterns and replacement strings can now only contain ASCII letters and digits and underscore. (Contributed by Serhiy Storchaka in gh-91760.)

- `shutil`: `rmtree()`»s onerror parameter is deprecated in Python 3.12; use the onexc parameter instead.

- `ssl` options and protocols:

  - `ssl.SSLContext` without protocol argument is deprecated.

  - `ssl.SSLContext`: `set_npn_protocols()` and `selected_npn_protocol()` are deprecated: use ALPN instead.

  - `ssl.OP_NO_SSL*` options

  - `ssl.OP_NO_TLS*` options

  - `ssl.PROTOCOL_SSLv3`

  - `ssl.PROTOCOL_TLS`

  - `ssl.PROTOCOL_TLSv1`

  - `ssl.PROTOCOL_TLSv1_1`

  - `ssl.PROTOCOL_TLSv1_2`

  - `ssl.TLSVersion.SSLv3`

  - `ssl.TLSVersion.TLSv1`

  - `ssl.TLSVersion.TLSv1_1`

- `threading` methods:

  - `threading.Condition.notifyAll()`: use `notify_all()`.

  - `threading.Event.isSet()`: use `is_set()`.

  - `threading.Thread.isDaemon()`, `threading.Thread.setDaemon()`: use `threading.Thread.daemon` attribute.

  - `threading.Thread.getName()`, `threading.Thread.setName()`: use `threading.Thread.name` attribute.

  - `threading.currentThread()`: use `threading.current_thread()`.

  - `threading.activeCount()`: use `threading.active_count()`.

- `typing.Text` (gh-92332).

- The internal class `typing._UnionGenericAlias` is no longer used to implement `typing.Union`. To preserve compatibility with users using this private class, a compatibility shim will be provided until at least Python 3.17. (Contributed by Jelle Zijlstra in gh-105499.)

- `unittest.IsolatedAsyncioTestCase`: it is deprecated to return a value that is not `None` from a test case.

- `urllib.parse` deprecated functions: `urlparse()` instead

  - `splitattr()`

  - `splithost()`

  - `splitnport()`

  - `splitpasswd()`

  - `splitport()`

  - `splitquery()`

  - `splittag()`

  - `splittype()`

  - `splituser()`

  - `splitvalue()`

  - `to_bytes()`

- `wsgiref`: `SimpleHandler.stdout.write()` should not do partial writes.

- `xml.etree.ElementTree`: Testing the truth value of an `Element` is deprecated. In a future release it will always return `True`. Prefer explicit `len(elem)` or `elem is not None` tests instead.

- `sys._clear_type_cache()` is deprecated: use `sys._clear_internal_caches()` instead.

## Soft deprecations

There are no plans to remove soft deprecated APIs.

- `re.match()` and `re.Pattern.match()` are now soft deprecated in favor of the new `re.prefixmatch()` and `re.Pattern.prefixmatch()` APIs, which have been added as alternate, more explicit names. These are intended to be used to alleviate confusion around what match means by following the Zen of Python’s „Explicit is better than implicit” mantra. Most other language regular expression libraries use an API named match to mean what Python has always called search.

  We do not plan to remove the older `match()` name, as it has been used in code for over 30 years. Code supporting older versions of Python should continue to use `match()`, while new code should prefer `prefixmatch()`. See prefixmatch() vs. match().

  (Contributed by Gregory P. Smith in gh-86519 and Hugo van Kemenade in gh-148100.)

## C API deprecations

### Oczekujące na usunięcie w Pythonie 3.15

- The `PyImport_ImportModuleNoBlock()`: Używać:c:func:`PyImport_ImportModule`Zamiast.

- `PyWeakref_GetObject()` and `PyWeakref_GET_OBJECT()`: Use `PyWeakref_GetRef()` instead. The pythoncapi-compat project can be used to get `PyWeakref_GetRef()` on Python 3.12 and older.

- `PyUnicode_AsDecodedObject()` : Używać `PyCodec_Decode()` Zamiast.

- `PyUnicode_AsDecodedUnicode()` : Używać `PyCodec_Decode()` zamiast tego; Należy pamiętać, że niektóre kodeki (na przykład „base64”) mogą zwracać typ inny niż:class:str , taki jak `bytes`.

- `PyUnicode_AsEncodedObject()` : Używać `PyCodec_Encode()` Zamiast.

- `PyUnicode_AsEncodedUnicode()` : używać `PyCodec_Encode()` zamiast; Notatka że niektóre kodeki (na przykład „base64”) mogą zwracać typ inny niż:class:bytes , taki jak `str`.

- Python Funkcje inicjalizacyjne języka Python, przestarzałe w Python 3.13:

  - `Py_GetPath()` : Użyj `PyConfig_Get("module_search_paths") <PyConfig_Get> ( :data:`sys.path()`)

  - `Py_GetPrefix()` : Użyj `PyConfig_Get("base_prefix")` (`sys.base_prefix`) Zamiast tego użyj `PyConfig_Get("prefix") <PyConfig_Get> ` (:data:`sys.prefix()`) jeśli :ref:`środowiska wirtualne.

  - `Py_GetExecPrefix()` : Użyj `PyConfig_Get("base_exec_prefix")` (`sys.base_exec_prefix`) Zamiast tego użyj `PyConfig_Get("exec_prefix") <PyConfig_Get> ` ( :data:`sys.exec_prefix()`) jeśli :ref:środowisko wirtualne <venv-def> ` trzeba się tym zająć.

  - `Py_GetProgramFullPath()` : Użyj `PyConfig_Get("executable") <PyConfig_Get> ` ( :data:`sys.executable()` ) Zamiast.

  - `Py_GetProgramName()` : Użyj `PyConfig Get("executable") <PyConfig_Get> ` (:data:`sys.executable()` ) Zamiast.

  - `Py_GetPythonHome`<PyConfig_Get> ` ` lub:envvar:`PYTHONHOME()` zmienną środowiskową.

  Projekt python api-compat można użyć do uruchomienia :c:func:`PyConfig_Get`Pythona w wersji 3.13 i starszych.

- Funkcje do konfiguracji inicjalizacji Pythona, przestarzałe w Pythonie 3.11:

  - `PySys_SetArgvEx()` : Ustawić `PyConfig.argv` Zamiast.

  - `PySys_SetArgv()` : Ustawić `PyConfig.argv` Zamiast.

  - `Py_SetProgramName()` : Ustawić `PyConfig.program_name` Zamiast.

  - `Py_SetPythonHome()`: Set `PyConfig.home` instead.

  - `PySys_ResetWarnOptions()` Wyczyść `sys.warnoptions` i `warnings.filters` zamiast tego.

  The `Py_InitializeFromConfig`API należy używać z :c:type:`PyConfig()` Zamiast.

- Globalne zmienne konfiguracyjne:

  - `Py_DebugFlag` : używać `PyConfig.parser_debug` Lub tego użyj `PyConfig_Get("parser_debug") <PyConfig_Get> Zamiast.()` .

  - `Py_VerboseFlag` :używać `PyConfig.verbose` or :c:func:`PyConfig_Get(„verbose”) <PyConfig_Get> ` zamiast.

  - `Py_QuietFlag` : Zamiast tego użyj `PyConfig.quiet`:c:func:`PyConfig_Get(„quiet”) `.<PyConfig_Get>

  - `Py_InteractiveFlag` : Zamiast tego użyj `PyConfig.interactive` `PyConfig_Get("interactive")()`.<PyConfig_Get>

  - `Py_InspectFlag` lub :c:func:`PyConfig_Get(„inspect”) ` zamiast tego.

  - `Py_OptimizeFlag` Używać `PyConfig.optimization_level` lub `PyConfig_Get("optimization_level")` zamiast tego.

  - `Py_NoSiteFlag` używać :c:member:`PyConfig.site_import`lub :c:func:`PyConfig_Get(„site_import”) <PyConfig_Get> zamiast tego.

  - `Py_BytesWarningFlag` : używać `PyConfig.bytes_warning` lub :c:func:`PyConfig_Get(„bytes_warning”) <PyConfig_Get> zamiast tego.

  - `Py_FrozenFlag` : używać `PyConfig.pathconfig_warnings` lub: :c:func:`PyConfig_Get(„pathconfig_warnings”) <PyConfig_Get> Zamiast.

  - `Py_IgnoreEnvironmentFlag` używać `PyConfig.use_environment` lub :c:func:`PyConfig_Get(„use_environment”) <PyConfig_Get> zamiast tego.

  - `Py_DontWriteBytecodeFlag`: Use `PyConfig.write_bytecode` or `PyConfig_Get("write_bytecode")` instead.

  - `Py_NoUserSiteDirectory` : używać `PyConfig.user_site_directory` lub :c:func:`PyConfig_Get(„user_site_directory”) <PyConfig_Get> zamiast tego.

  - `Py_UnbufferedStdioFlag` : Użyj `PyConfig.buffered_stdio` lub :c:func:`PyConfig_Get(„buffered_stdio”) <PyConfig_Get> zamiast tego.

  - `Py_HashRandomizationFlag` : Używać `PyConfig.use_hash_seed` I `PyConfig.hash_seed` or :c:func:`PyConfig_Get(„hash_seed”) <PyConfig_Get> zamiast tego.

  - `Py_IsolatedFlag` `PyConfig.isolated` lub :c:func:`PyConfig_Get(„isolated”) <PyConfig_Get> zamiast tego.

  - `Py_LegacyWindowsFSEncodingFlag`: używać `PyPreConfig.legacy_windows_fs_encoding` lub :c:func:`PyConfig_Get(„legacy_windows_fs_encoding”)<PyConfig_Get> `zamiast tego.

  - `Py_LegacyWindowsStdioFlag`używać :c:member:`PyConfig.legacy_windows_stdio` lub `PyConfig_Get("legacy_windows_stdio")` zamiast tego.

  - `Py_FileSystemDefaultEncoding`,:c:var:!Py_HasFileSystemDefaultEncoding: używać `PyConfig.filesystem_encoding` lub :c:func:`PyConfig_Get(„filesystem_encoding”) <PyConfig_Get> zamiast tego.

  - `Py_FileSystemDefaultEncodeErrors`: używać `PyConfig.filesystem_errors` lub :c:func:`PyConfig_Get(„filesystem_errors”) <PyConfig_Get>`zamiast tego.

  - `Py_UTF8Mode`: używać `PyPreConfig.utf8_mode` lub `PyConfig_Get("utf8_mode")` zamiast tego (Widzieć:c:func:Py_PreInitialize)

  The:c:func:Py_InitializeFromConfig`API należy używać z:c:type:`PyConfig`aby ustawić te opcje. Można:c:func:`PyConfig_Get też użyć tego polecenia, aby uzyskać te opcje w czasie wykonywania.

### Pending removal in Python 3.16

- The bundled copy of `libmpdec`.

### Pending removal in Python 3.18

- The following private functions are deprecated and planned for removal in Python 3.18:

  - `_PyBytes_Join()`: use `PyBytes_Join()`.

  - `_PyDict_GetItemStringWithError()`: use `PyDict_GetItemStringRef()`.

  - `_PyDict_Pop()`: use `PyDict_Pop()`.

  - `_PyLong_Sign()`: use `PyLong_GetSign()`.

  - `_PyLong_FromDigits()` and `_PyLong_New()`: use `PyLongWriter_Create()`.

  - `_PyThreadState_UncheckedGet()`: use `PyThreadState_GetUnchecked()`.

  - `_PyUnicode_AsString()`: use `PyUnicode_AsUTF8()`.

  - `_PyUnicodeWriter_Init()`: replace `_PyUnicodeWriter_Init(&writer)` with `writer = PyUnicodeWriter_Create(0)`.

  - `_PyUnicodeWriter_Finish()`: replace `_PyUnicodeWriter_Finish(&writer)` with `PyUnicodeWriter_Finish(writer)`.

  - `_PyUnicodeWriter_Dealloc()`: replace `_PyUnicodeWriter_Dealloc(&writer)` with `PyUnicodeWriter_Discard(writer)`.

  - `_PyUnicodeWriter_WriteChar()`: replace `_PyUnicodeWriter_WriteChar(&writer, ch)` with `PyUnicodeWriter_WriteChar(writer, ch)`.

  - `_PyUnicodeWriter_WriteStr()`: replace `_PyUnicodeWriter_WriteStr(&writer, str)` with `PyUnicodeWriter_WriteStr(writer, str)`.

  - `_PyUnicodeWriter_WriteSubstring()`: replace `_PyUnicodeWriter_WriteSubstring(&writer, str, start, end)` with `PyUnicodeWriter_WriteSubstring(writer, str, start, end)`.

  - `_PyUnicodeWriter_WriteASCIIString()`: replace `_PyUnicodeWriter_WriteASCIIString(&writer, str)` with `PyUnicodeWriter_WriteASCII(writer, str)`.

  - `_PyUnicodeWriter_WriteLatin1String()`: replace `_PyUnicodeWriter_WriteLatin1String(&writer, str)` with `PyUnicodeWriter_WriteUTF8(writer, str)`.

  - `_PyUnicodeWriter_Prepare()`: (no replacement).

  - `_PyUnicodeWriter_PrepareKind()`: (no replacement).

  - `_Py_HashPointer()`: use `Py_HashPointer()`.

  - `_Py_fopen_obj()`: use `Py_fopen()`.

  The pythoncapi-compat project can be used to get these new public functions on Python 3.13 and older. (Contributed by Victor Stinner in gh-128863.)

### Pending removal in Python 3.19

- PEP 456 embedders support for the string hashing scheme definition.

### Oczekujące na usunięcie w Pythonie 3.20

- `_PyObject_CallMethodId()`, `_PyObject_GetAttrId()` and `_PyUnicode_FromId()` are deprecated since 3.15 and will be removed in 3.20. Instead, use `PyUnicode_InternFromString()` and cache the result in the module state, then call `PyObject_CallMethod()` or `PyObject_GetAttr()`. (Contributed by Victor Stinner in gh-141049.)

- The `cval` field in `PyComplexObject` (gh-128813). Use `PyComplex_AsCComplex()` and `PyComplex_FromCComplex()` to convert a Python complex number to/from the C `Py_complex` representation.

- Macros `Py_MATH_PIl` and `Py_MATH_El`.

### Pending removal in future versions

The following APIs are deprecated and will be removed, although there is currently no date scheduled for their removal.

- `Py_TPFLAGS_HAVE_FINALIZE`: Unneeded since Python 3.8.

- `PyErr_Fetch()`: Use `PyErr_GetRaisedException()` instead.

- `PyErr_NormalizeException()`: Use `PyErr_GetRaisedException()` instead.

- `PyErr_Restore()`: Use `PyErr_SetRaisedException()` instead.

- `PyModule_GetFilename()`: Use `PyModule_GetFilenameObject()` instead.

- `PyOS_AfterFork()`: Use `PyOS_AfterFork_Child()` instead.

- `PySlice_GetIndicesEx()`: Use `PySlice_Unpack()` and `PySlice_AdjustIndices()` instead.

- `PyUnicode_READY()`: Unneeded since Python 3.12

- `PyErr_Display()`: Use `PyErr_DisplayException()` instead.

- `_PyErr_ChainExceptions()`: Use `_PyErr_ChainExceptions1()` instead.

- `PyBytesObject.ob_shash` member: call `PyObject_Hash()` instead.

- Thread Local Storage (TLS) API:

  - `PyThread_create_key()`: Use `PyThread_tss_alloc()` instead.

  - `PyThread_delete_key()`: Use `PyThread_tss_free()` instead.

  - `PyThread_set_key_value()`: Use `PyThread_tss_set()` instead.

  - `PyThread_get_key_value()`: Use `PyThread_tss_get()` instead.

  - `PyThread_delete_key_value()`: Use `PyThread_tss_delete()` instead.

  - `PyThread_ReInitTLS()`: Unneeded since Python 3.7.