Desusos
*******


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

* 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
==============================

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

* 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 "property" respectively.

* "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.

* "struct":

  * Soft-deprecated since Python 3.15, using "'F'" and "'D'" type
    codes are now deprecated.  These codes will be removed in Python
    3.21.  Use instead two-letter forms "'Zf'" and "'Zd'".

* "tempfile":

  * "tempfile._TemporaryFileWrapper" will be removed in Python 3.21.
    Use the public "tempfile.TemporaryFileWrapper" instead.


Pending removal in future versions
==================================

Las siguientes API se eliminarán en el futuro, aunque actualmente no
hay una fecha programada para su eliminación.

* "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":

  * Generadores: las firmas "throw(type, exc, tb)" y "athrow(type,
    exc, tb)" están obsoletas: utilice "throw(exc)" y "athrow(exc)" en
    su lugar, la firma de argumento único.

  * Actualmente, Python acepta literales numéricos seguidos
    inmediatamente de palabras clave, por ejemplo, "0in x", "1or x",
    "0if 1else 2". Permite expresiones confusas y ambiguas como
    "[0x1for x in y]" (que se puede interpretar como "[0x1 for x in
    y]" o "[0x1f or x in y]"). Se genera una advertencia de sintaxis
    si el literal numérico va seguido inmediatamente de una de las
    palabras clave "and", "else", "for", "if", "in", "is" y "or". En
    una versión futura, se cambiará a un error de sintaxis. (gh-87999)

  * Compatibilidad con los métodos "__index__()" y "__int__()" que
    devuelven un tipo que no es int: estos métodos serán necesarios
    para devolver una instancia de una subclase estricta de "int".

  * Compatibilidad con el método "__float__()" que devuelve una
    subclase estricta de "float": estos métodos serán necesarios para
    devolver una instancia de "float".

  * Compatibilidad con el método "__complex__()" que devuelve una
    subclase estricta de "complex": estos métodos serán necesarios
    para devolver una instancia de "complex".

  * Ahora está obsoleto el paso de un número complejo como argumento
    *real* o *imag* en el constructor "complex()"; solo debe pasarse
    como un único argumento posicional. (Contribuido por Serhiy
    Storchaka en gh-109218.)

* "calendar": Las constantes "calendar.January" y "calendar.February"
  han quedado obsoletas y han sido reemplazadas por "calendar.JANUARY"
  y "calendar.FEBRUARY". (Contribuido por Prince Roshan en gh-103636.)

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

* "codeobject.co_lnotab": use the "codeobject.co_lines()" method
  instead.

* "datetime":

  * "utcnow()": utilice "datetime.datetime.now(tz=datetime.UTC)".

  * "utcfromtimestamp()": utilice
    "datetime.datetime.fromtimestamp(timestamp, tz=datetime.UTC)".

* "gettext": El valor plural debe ser un número entero.

* "importlib":

  * "cache_from_source()" El parámetro *debug_override* está obsoleto:
    utilice el parámetro *optimization* en su lugar.

* "importlib.metadata":

  * Interfaz de tupla "EntryPoints".

  * "None" implícito en los valores de retorno.

* "logging": el método "warn()" ha quedado obsoleto desde Python 3.3,
  utilice "warning()" en su lugar.

* "mailbox": El uso del modo de entrada y texto StringIO está
  obsoleto; en su lugar, utilice BytesIO y el modo binario.

* "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": Un valor de tupla para el parámetro
  *exc_info* está obsoleto, utilice una instancia de excepción.

* "re": Ahora se aplican reglas más estrictas para las referencias
  numéricas de grupos y los nombres de grupos en expresiones
  regulares. Ahora solo se aceptan secuencias de dígitos ASCII como
  referencia numérica. El nombre de grupo en patrones de bytes y
  cadenas de reemplazo ahora solo puede contener letras y dígitos
  ASCII y guiones bajos. (Contribuido por Serhiy Storchaka en
  gh-91760.)

* "shutil": El parámetro *onerror* de "rmtree()" está obsoleto en
  Python 3.12; utilice el parámetro *onexc* en su lugar.

* Opciones y protocolos "ssl":

  * "ssl.SSLContext" sin argumento de protocolo está obsoleto.

  * "ssl.SSLContext": "set_npn_protocols()" y
    "selected_npn_protocol()" están obsoletos: utilice ALPN en su
    lugar.

  * Opciones de "ssl.OP_NO_SSL*"

  * Opciones de "ssl.OP_NO_TLS*"

  * "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"

* Métodos "threading":

  * "threading.Condition.notifyAll()": utilice "notify_all()".

  * "threading.Event.isSet()": utilice "is_set()".

  * "threading.Thread.isDaemon()", "threading.Thread.setDaemon()":
    utilice el atributo "threading.Thread.daemon".

  * "threading.Thread.getName()", "threading.Thread.setName()":
    utilice el atributo "threading.Thread.name".

  * "threading.currentThread()": utilice "threading.current_thread()".

  * "threading.activeCount()": utilice "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": está obsoleto devolver un valor
  que no sea "None" de un caso de prueba.

* Funciones obsoletas de "urllib.parse": "urlparse()" en su lugar

  * "splitattr()"

  * "splithost()"

  * "splitnport()"

  * "splitpasswd()"

  * "splitport()"

  * "splitquery()"

  * "splittag()"

  * "splittype()"

  * "splituser()"

  * "splitvalue()"

  * "to_bytes()"

* "wsgiref": "SimpleHandler.stdout.write()" no debería realizar
  escrituras parciales.

* "xml.etree.ElementTree": La prueba del valor de verdad de un
  "Element" está obsoleta. En una versión futura, siempre devolverá
  "True". En su lugar, es preferible realizar pruebas explícitas
  "len(elem)" o "elem is not None".

* "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
==================


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

  * "PyGen_New()": (no replacement).

  * "PyGen_NewWithQualName()": (no replacement).

  * "PyCoro_New()": (no replacement).

  * "PyAsyncGen_New()": (no replacement).

  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.


Pending removal in Python 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
----------------------------------

Las siguientes API están obsoletas y se eliminarán, aunque actualmente
no hay una fecha programada para su eliminación.

* "Py_TPFLAGS_HAVE_FINALIZE": Innecesario desde Python 3.8.

* "PyErr_Fetch()": Utilice "PyErr_GetRaisedException()" en su lugar.

* "PyErr_NormalizeException()": Utilice "PyErr_GetRaisedException()"
  en su lugar.

* "PyErr_Restore()": Utilice "PyErr_SetRaisedException()" en su lugar.

* "PyModule_GetFilename()": Utilice "PyModule_GetFilenameObject()" en
  su lugar.

* "PyOS_AfterFork()": Utilice "PyOS_AfterFork_Child()" en su lugar.

* "PySlice_GetIndicesEx()": Utilice "PySlice_Unpack()" y
  "PySlice_AdjustIndices()" en su lugar.

* "PyUnicode_READY()": Innecesario desde Python 3.12

* "PyErr_Display()": Utilice "PyErr_DisplayException()" en su lugar.

* "_PyErr_ChainExceptions()": Utilice "_PyErr_ChainExceptions1()" en
  su lugar.

* Miembro de "PyBytesObject.ob_shash": llame a "PyObject_Hash()" en su
  lugar.

* API de almacenamiento local de subprocesos (TLS):

  * "PyThread_create_key()": Utilice "PyThread_tss_alloc()" en su
    lugar.

  * "PyThread_delete_key()": Utilice "PyThread_tss_free()" en su
    lugar.

  * "PyThread_set_key_value()": Utilice "PyThread_tss_set()" en su
    lugar.

  * "PyThread_get_key_value()": Utilice "PyThread_tss_get()" en su
    lugar.

  * "PyThread_delete_key_value()": Utilice "PyThread_tss_delete()" en
    su lugar.

  * "PyThread_ReInitTLS()": Innecesario desde Python 3.7.
