From 696776b65ae5b58c5e21a5e64cd6e8d898731e16 Mon Sep 17 00:00:00 2001 From: Carlos Mena <50986837+carlosm00@users.noreply.github.com> Date: Sat, 25 Oct 2025 02:42:01 +0200 Subject: [PATCH 01/10] =?UTF-8?q?Traducci=C3=B3n=20de=20library/exceptions?= =?UTF-8?q?.po=20(#3420)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes #2966 --- library/exceptions.po | 341 ++++++++++++++++++++++++++++-------------- 1 file changed, 227 insertions(+), 114 deletions(-) diff --git a/library/exceptions.po b/library/exceptions.po index 79d24555ad..5b28a1dfb9 100644 --- a/library/exceptions.po +++ b/library/exceptions.po @@ -11,15 +11,16 @@ msgstr "" "Project-Id-Version: Python 3.8\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-11-21 16:38-0300\n" -"PO-Revision-Date: 2024-11-05 23:29+0100\n" +"PO-Revision-Date: 2025-10-24 19:09+0200\n" "Last-Translator: Carlos Mena Pérez <@carlosm00>\n" -"Language: es\n" "Language-Team: python-doc-es\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"Language: es\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" "Generated-By: Babel 2.16.0\n" +"X-Generator: Poedit 3.7\n" #: ../Doc/library/exceptions.rst:4 msgid "Built-in Exceptions" @@ -38,12 +39,11 @@ msgstr "" "derive de :class:`BaseException`. En una instrucción :keyword:`try` con una " "cláusula :keyword:`except` que menciona una clase determinada, esa cláusula " "también controla las clases de excepción derivadas de esa clase (excepto las " -"clases de excepción de las que se deriva *it*). Dos clases de excepción que " +"clases de excepción de las que esta se deriva). Dos clases de excepción que " "no están relacionadas mediante subclases nunca son equivalentes, incluso si " "tienen el mismo nombre." #: ../Doc/library/exceptions.rst:19 -#, fuzzy msgid "" "The built-in exceptions listed in this chapter can be generated by the " "interpreter or built-in functions. Except where mentioned, they have an " @@ -52,13 +52,13 @@ msgid "" "and a string explaining the code). The associated value is usually passed " "as arguments to the exception class's constructor." msgstr "" -"Las excepciones predefinidas enumeradas a continuación pueden ser generadas " -"por el intérprete o funciones predefinidas. Excepto donde se mencione lo " -"contrario, tienen un *associated value* que indica la causa detallada del " -"error. Esto podría una cadena de caracteres o una tupla elementos con " -"grandes elementos de información (por ejemplo, un código de error y una " -"cadena que explica el código). El valor asociado generalmente se pasa como " -"argumentos al constructor de la clase de excepción." +"Las excepciones incorporadas enumeradas en este apartado pueden ser lanzadas " +"por el intérprete o funciones integradas. Excepto donde se mencione lo " +"contrario, tienen un \"valor asociado\" que indica la causa detallada " +"del error. Esto podría una cadena de caracteres o una tupla de varios " +"elementos de información (por ejemplo, un código de error y una cadena que " +"explica el código). El valor asociado generalmente se pasa como argumentos " +"al constructor de la clase de excepción." #: ../Doc/library/exceptions.rst:26 msgid "" @@ -98,9 +98,10 @@ msgid "" "Three attributes on exception objects provide information about the context " "in which the exception was raised:" msgstr "" +"Tres atributos en los objetos de excepción ofrecen información sobre el " +"contexto en el cual la excepción fue lanzada:" #: ../Doc/library/exceptions.rst:53 -#, fuzzy msgid "" "When raising a new exception while another exception is already being " "handled, the new exception's :attr:`!__context__` attribute is automatically " @@ -109,7 +110,7 @@ msgid "" "used." msgstr "" "Al lanzar una nueva excepción mientras otra excepción está siendo manejada, " -"el atributo :attr:`__context__` de la nueva excepción es automáticamente " +"el atributo :attr:`!__context__` de la nueva excepción es automáticamente " "asignado a la excepción manejada. Una excepción puede ser manejada cuando " "se utiliza la cláusula :keyword:`except` o :keyword:`finally`, o con la " "sentencia :keyword:`with`." @@ -124,10 +125,9 @@ msgstr "" #: ../Doc/library/exceptions.rst:63 msgid "raise new_exc from original_exc" -msgstr "" +msgstr "raise new_exc from original_exc" #: ../Doc/library/exceptions.rst:65 -#, fuzzy msgid "" "The expression following :keyword:`from` must be an exception or " "``None``. It will be set as :attr:`!__cause__` on the raised exception. " @@ -139,16 +139,15 @@ msgid "" "introspection when debugging." msgstr "" "La expresión que sigue a :keyword:`from` debe ser una excepción o " -"``None``. Se establecerá como :attr:`__cause__` en la excepción generada. La " -"configuración de :attr:`__cause__` también establece implícitamente el " -"atributo :attr:`__suppress_context__` en ``True``, de modo que el uso de " +"``None``. Se establecerá como :attr:`!__cause__` en la excepción lanzada. La " +"configuración de :attr:`!__cause__` también establece implícitamente el " +"atributo :attr:`!__suppress_context__` a ``True``, de modo que el uso de " "``raise new_exc from None`` reemplaza efectivamente la excepción anterior " "con la nueva para fines de visualización (por ejemplo, conversión de :exc:" "`KeyError` a :exc:`AttributeError`), dejando la excepción anterior " -"disponible en :attr:`__context__` para introspección durante la depuración." +"disponible en :attr:`!__context__` para introspección durante la depuración." #: ../Doc/library/exceptions.rst:74 -#, fuzzy msgid "" "The default traceback display code shows these chained exceptions in " "addition to the traceback for the exception itself. An explicitly chained " @@ -156,12 +155,12 @@ msgid "" "chained exception in :attr:`!__context__` is shown only if :attr:`!" "__cause__` is :const:`None` and :attr:`!__suppress_context__` is false." msgstr "" -"La visualización por defecto de la traza de error muestra estas excepciones " -"encadenadas además de la traza de la propia excepción. Siempre se muestra " -"una excepción encadenada explícitamente en :attr:`__cause__` cuando está " -"presente. Una excepción implícitamente encadenada en :attr:`__context__` " -"solo se muestra si :attr:`__cause__` es :const:`None` y :attr:" -"`__suppress_context__` es falso." +"La visualización por defecto de la traza de seguimiento muestra estas " +"excepciones encadenadas además de la traza de la propia excepción. Siempre " +"se muestra una excepción encadenada explícitamente en :attr:`!__cause__` " +"cuando está presente. Una excepción implícitamente encadenada en :attr:`!" +"__context__` solo se muestra si :attr:`!__cause__` es :const:`None` y :attr:" +"`!__suppress_context__` es falso." #: ../Doc/library/exceptions.rst:80 msgid "" @@ -262,10 +261,10 @@ msgstr "" "características de encadenamiento de excepciones de :pep:`3134` estuvieran " "disponibles. El siguiente ejemplo muestra cómo podemos convertir una " "instancia de ``SomeException`` en una instancia de ``OtherException`` " -"mientras se conserva el rastreo. Una vez generado, el marco actual se " -"inserta en el rastreo del ``OtherException``, como habría sucedido con el " -"rastreo del ``SomeException`` original si hubiéramos permitido que se " -"propagara al llamador. ::" +"mientras se conserva el rastreo. Una vez lanzada, el marco actual se inserta " +"en el rastreo del ``OtherException``, como habría sucedido con el rastreo " +"del ``SomeException`` original si hubiéramos permitido que se propagara al " +"llamador. ::" #: ../Doc/library/exceptions.rst:135 msgid "" @@ -275,12 +274,20 @@ msgid "" " tb = sys.exception().__traceback__\n" " raise OtherException(...).with_traceback(tb)" msgstr "" +"try:\n" +" ...\n" +"except SomeException:\n" +" tb = sys.exception().__traceback__\n" +" raise OtherException(...).with_traceback(tb)" #: ../Doc/library/exceptions.rst:143 msgid "" "A writable field that holds the :ref:`traceback object ` " "associated with this exception. See also: :ref:`raise`." msgstr "" +"Un campo escribible que mantenga los :ref:`objetos de seguimiento de pila " +"(traceback) ` asociados con esta excepción. Consulte :ref:" +"`raise` para más información." #: ../Doc/library/exceptions.rst:149 msgid "" @@ -316,7 +323,7 @@ msgid "" "arithmetic errors: :exc:`OverflowError`, :exc:`ZeroDivisionError`, :exc:" "`FloatingPointError`." msgstr "" -"La clase base para las excepciones predefinidas que se generan para varios " +"La clase base para las excepciones predefinidas que se lanzan para varios " "errores aritméticos: :exc:`OverflowError`, :exc:`ZeroDivisionError`, :exc:" "`FloatingPointError`." @@ -325,7 +332,7 @@ msgid "" "Raised when a :ref:`buffer ` related operation cannot be " "performed." msgstr "" -"Se genera cuando :ref:`buffer ` no se puede realizar una " +"Se lanza cuando :ref:`buffer ` no se puede realizar una " "operación relacionada." #: ../Doc/library/exceptions.rst:184 @@ -334,7 +341,7 @@ msgid "" "on a mapping or sequence is invalid: :exc:`IndexError`, :exc:`KeyError`. " "This can be raised directly by :func:`codecs.lookup`." msgstr "" -"La clase base para las excepciones que se generan cuando una clave o índice " +"La clase base para las excepciones que se lanzan cuando una clave o índice " "utilizado en un mapa o secuencia que no es válido: :exc:`IndexError`, :exc:" "`KeyError`. Esto se puede lanzar directamente por :func:`codecs.lookup`." @@ -345,12 +352,12 @@ msgstr "Excepciones específicas" #: ../Doc/library/exceptions.rst:192 msgid "The following exceptions are the exceptions that are usually raised." msgstr "" -"Las siguientes excepciones son las excepciones que normalmente se generan." +"Las siguientes excepciones son las excepciones que normalmente se lanzan." #: ../Doc/library/exceptions.rst:198 msgid "Raised when an :keyword:`assert` statement fails." msgstr "" -"Se genera cuando se produce un error en una instrucción :keyword:`assert`." +"Se lanza cuando se produce un error en una instrucción :keyword:`assert`." #: ../Doc/library/exceptions.rst:203 msgid "" @@ -358,9 +365,9 @@ msgid "" "assignment fails. (When an object does not support attribute references or " "attribute assignments at all, :exc:`TypeError` is raised.)" msgstr "" -"Se genera cuando se produce un error en una referencia de atributo (ver :ref:" +"Se lanza cuando se produce un error en una referencia de atributo (ver :ref:" "`attribute-references`) o la asignación falla. (Cuando un objeto no admite " -"referencias de atributos o asignaciones de atributos en absoluto, se genera :" +"referencias de atributos o asignaciones de atributos en absoluto, se lanza :" "exc:`TypeError`.)" #: ../Doc/library/exceptions.rst:207 @@ -385,7 +392,7 @@ msgid "" "without reading any data. (N.B.: the :meth:`io.IOBase.read` and :meth:`io." "IOBase.readline` methods return an empty string when they hit EOF.)" msgstr "" -"Se genera cuando la función :func:`input` alcanza una condición de fin de " +"Se lanza cuando la función :func:`input` alcanza una condición de fin de " "archivo (EOF) sin leer ningún dato. (Note que el :meth:`io. IOBase.read` y :" "meth:`io.IOBase.readline` retornan una cadena vacía cuando llegan a EOF.)" @@ -400,7 +407,7 @@ msgid "" "exc:`BaseException` instead of :exc:`Exception` since it is technically not " "an error." msgstr "" -"Se genera cuando un :term:`generator` o :term:`coroutine` está cerrado; ver :" +"Se lanza cuando un :term:`generator` o :term:`coroutine` está cerrado; ver :" "meth:`generator.close` y :meth:`coroutine.close`. Hereda directamente de :" "exc:`BaseException` en lugar de :exc:`Exception` ya que técnicamente no es " "un error." @@ -411,9 +418,9 @@ msgid "" "module. Also raised when the \"from list\" in ``from ... import`` has a " "name that cannot be found." msgstr "" -"Se genera cuando la instrucción :keyword:`import` tiene problemas al " -"intentar cargar un módulo. También se produce cuando la *from list* en " -"``from ... import`` tiene un nombre que no se puede encontrar." +"Se lanza cuando la instrucción :keyword:`import` tiene problemas al intentar " +"cargar un módulo. También se produce cuando la *from list* en ``from ... " +"import`` tiene un nombre que no se puede encontrar." #: ../Doc/library/exceptions.rst:241 msgid "" @@ -441,8 +448,8 @@ msgid "" "module could not be located. It is also raised when ``None`` is found in :" "data:`sys.modules`." msgstr "" -"Una subclase de :exc:`ImportError` que se genera mediante :keyword:`import` " -"cuando no se pudo encontrar un módulo. También se genera cuando ``None`` se " +"Una subclase de :exc:`ImportError` que se lanza mediante :keyword:`import` " +"cuando no se pudo encontrar un módulo. También se lanza cuando ``None`` se " "encuentra en :data:`sys.modules`." #: ../Doc/library/exceptions.rst:266 @@ -451,17 +458,16 @@ msgid "" "silently truncated to fall in the allowed range; if an index is not an " "integer, :exc:`TypeError` is raised.)" msgstr "" -"Se genera cuando un subíndice de secuencia está fuera del rango. (Los " -"índices de la rebanada son truncados silenciosamente para caer en el " -"intervalo permitido; si un índice no es un entero, se genera :exc:" -"`TypeError`.)" +"Se lanza cuando un subíndice de secuencia está fuera del rango. (Los índices " +"de la rebanada son truncados silenciosamente para caer en el intervalo " +"permitido; si un índice no es un entero, se lanza :exc:`TypeError`.)" #: ../Doc/library/exceptions.rst:275 msgid "" "Raised when a mapping (dictionary) key is not found in the set of existing " "keys." msgstr "" -"Se genera cuando no se encuentra una clave de asignación (diccionario) en el " +"Se lanza cuando no se encuentra una clave de asignación (diccionario) en el " "conjunto de claves existentes (mapa)." #: ../Doc/library/exceptions.rst:282 @@ -472,7 +478,7 @@ msgid "" "accidentally caught by code that catches :exc:`Exception` and thus prevent " "the interpreter from exiting." msgstr "" -"Se genera cuando el usuario pulsa la tecla de interrupción (normalmente :kbd:" +"Se lanza cuando el usuario pulsa la tecla de interrupción (normalmente :kbd:" "`Control-C` o :kbd:`Delete`). Durante la ejecución, se realiza una " "comprobación de interrupciones con regularidad. La excepción hereda de :exc:" "`BaseException` para no ser detectada de forma accidental por :exc:" @@ -503,7 +509,7 @@ msgid "" "recover from this situation; it nevertheless raises an exception so that a " "stack traceback can be printed, in case a run-away program was the cause." msgstr "" -"Se genera cuando una operación se queda sin memoria pero la situación aún " +"Se lanza cuando una operación se queda sin memoria pero la situación aún " "puede ser recuperada (eliminando algunos objetos). El valor asociado es una " "cadena que indica que tipo de operación (interna) se quedó sin memoria. " "Tenga en cuenta que debido a la arquitectura de administración de memoria " @@ -518,7 +524,7 @@ msgid "" "unqualified names. The associated value is an error message that includes " "the name that could not be found." msgstr "" -"Se genera cuando no se encuentra un nombre local o global. Esto se aplica " +"Se lanza cuando no se encuentra un nombre local o global. Esto se aplica " "solo a nombres no calificados. El valor asociado es un mensaje de error que " "incluye el nombre que no se pudo encontrar." @@ -560,21 +566,20 @@ msgstr "" "subclase, se establece en :data:`None`." #: ../Doc/library/exceptions.rst:338 -#, fuzzy msgid "" "``NotImplementedError`` and :data:`NotImplemented` are not interchangeable, " "even though they have similar names and purposes. See :data:`!" "NotImplemented` for details on when to use it." msgstr "" -"``NotImplementedError`` y ``NotImplemented`` no son intercambiables, a pesar " -"de que tienen nombres y propósitos similares. Consulte :data:" -"`NotImplemented` para obtener detalles sobre cuándo usarlo." +"``NotImplementedError`` y :data:`NotImplemented` no son intercambiables, a " +"pesar de que tienen nombres y propósitos similares. Consulte :data:`!" +"NotImplemented` para obtener detalles sobre cuándo usarlo." #: ../Doc/library/exceptions.rst:347 msgid "" "This exception is raised when a system function returns a system-related " -"error, including I/O failures such as \"file not found\" or \"disk full\" " -"(not for illegal argument types or other incidental errors)." +"error, including I/O failures such as \"file not found\" or \"disk " +"full\" (not for illegal argument types or other incidental errors)." msgstr "" "Esta excepción se produce cuando una función del sistema retorna un error " "relacionado con el sistema, que incluye fallas de E/S como ``file not " @@ -682,7 +687,6 @@ msgstr "" "atributo del constructor *filename2*." #: ../Doc/library/exceptions.rst:411 -#, fuzzy msgid "" "Raised when the result of an arithmetic operation is too large to be " "represented. This cannot occur for integers (which would rather raise :exc:" @@ -691,13 +695,13 @@ msgid "" "Because of the lack of standardization of floating-point exception handling " "in C, most floating-point operations are not checked." msgstr "" -"Se genera cuando el resultado de una operación aritmética es demasiado " -"grande para ser representado. Esto no puede ocurrir para los enteros (para " -"lo cual es mejor lanzar :exc:`MemoryError` que darse por vencido). Sin " -"embargo, por razones históricas, ``OverflowError`` a veces se genera para " -"enteros que están fuera del rango requerido. Debido a la falta de " -"estandarización del manejo de excepciones de coma flotante en C, la mayoría " -"de las operaciones de coma flotante no se verifican." +"Se lanza cuando el resultado de una operación aritmética es demasiado grande " +"para ser representado. Esto no puede ocurrir para los enteros (para lo cual " +"lanza un :exc:`MemoryError` en vez de darse por vencido). Sin embargo, por " +"razones históricas, ``OverflowError`` a veces se lanza para enteros que " +"están fuera del rango requerido. Debido a la falta de estandarización del " +"manejo de excepciones de coma flotante en C, la mayoría de las operaciones " +"de coma flotante no se verifican." #: ../Doc/library/exceptions.rst:421 msgid "" @@ -705,24 +709,29 @@ msgid "" "operation is blocked during interpreter shutdown also known as :term:`Python " "finalization `." msgstr "" +"Esta excepción es derivada de :exc:`RuntimeError`. Se lanza cuando una " +"operación es bloqueada durante el apagado del intérprete, también conocido " +"como :term:`finalización de Python `." #: ../Doc/library/exceptions.rst:425 msgid "" "Examples of operations which can be blocked with a :exc:" "`PythonFinalizationError` during the Python finalization:" msgstr "" +"Ejemplos de operaciones que pueden ser bloqueadas con un :exc:" +"`PythonFinalizationError` durante la finalización de Python:" #: ../Doc/library/exceptions.rst:428 msgid "Creating a new Python thread." -msgstr "" +msgstr "Creación de nuevos hilos de Python." #: ../Doc/library/exceptions.rst:429 msgid ":func:`os.fork`." -msgstr "" +msgstr ":func:`os.fork`." #: ../Doc/library/exceptions.rst:431 msgid "See also the :func:`sys.is_finalizing` function." -msgstr "" +msgstr "Revise también la función :func:`sys.is_finalizing`." #: ../Doc/library/exceptions.rst:433 ../Doc/library/exceptions.rst:443 msgid "Previously, a plain :exc:`RuntimeError` was raised." @@ -756,7 +765,7 @@ msgid "" "categories. The associated value is a string indicating what precisely went " "wrong." msgstr "" -"Se genera cuando se detecta un error que no corresponde a ninguna de las " +"Se lanza cuando se detecta un error que no corresponde a ninguna de las " "otras categorías. El valor asociado es una cadena que indica exactamente qué " "salió mal." @@ -766,18 +775,17 @@ msgid "" "`~iterator.__next__` method to signal that there are no further items " "produced by the iterator." msgstr "" -"Generado por la función incorporada :func:`next` y un :term:`iterator`\\'s :" +"Lanzado por la función incorporada :func:`next` y un :term:`iterator`\\'s :" "meth:`~iterator.__next__` para indicar que no hay más elementos producidos " "por el iterador." #: ../Doc/library/exceptions.rst:470 -#, fuzzy msgid "" "The exception object has a single attribute :attr:`!value`, which is given " "as an argument when constructing the exception, and defaults to :const:" "`None`." msgstr "" -"El objeto de excepción tiene un solo atributo :attr:`value`, que se " +"El objeto de excepción tiene un solo atributo :attr:`!value`, que se " "proporciona como argumento al construir la excepción, y por defecto es :" "const:`None`." @@ -788,7 +796,7 @@ msgid "" "is used as the :attr:`value` parameter to the constructor of the exception." msgstr "" "Cuando se retorna una función :term:`generator` o :term:`coroutine`, se " -"genera una nueva instancia :exc:`StopIteration`, y el valor retornado por la " +"lanza una nueva instancia :exc:`StopIteration`, y el valor retornado por la " "función se utiliza como parámetro :attr:`value` para constructor de la " "excepción." @@ -824,7 +832,7 @@ msgid "" "raised in a generator is transformed into a :exc:`RuntimeError`." msgstr "" "Habilitar :pep:`479` para todo el código por defecto: a :exc:`StopIteration` " -"generado en un generador se transforma en :exc:`RuntimeError`." +"lanzado en un generador se transforma en :exc:`RuntimeError`." #: ../Doc/library/exceptions.rst:497 msgid "" @@ -841,7 +849,7 @@ msgid "" "`compile`, :func:`exec`, or :func:`eval`, or when reading the initial script " "or standard input (also interactively)." msgstr "" -"Se genera cuando el analizador encuentra un error de sintaxis. Esto puede " +"Se lanza cuando el analizador encuentra un error de sintaxis. Esto puede " "ocurrir en una instrucción :keyword:`import`, en una llamada a las funciones " "integradas :func:`compile`, :func:`exec` o :func:`eval`, o al leer el script " "inicial o la entrada estándar (también de forma interactiva)." @@ -925,7 +933,7 @@ msgid "" "Raised when indentation contains an inconsistent use of tabs and spaces. " "This is a subclass of :exc:`IndentationError`." msgstr "" -"Se genera cuando la sangría contiene un uso inconsistente de pestañas y " +"Se lanza cuando la sangría contiene un uso inconsistente de pestañas y " "espacios. Esta es una subclase de :exc:`IndentationError`." #: ../Doc/library/exceptions.rst:563 @@ -934,7 +942,7 @@ msgid "" "not look so serious to cause it to abandon all hope. The associated value is " "a string indicating what went wrong (in low-level terms)." msgstr "" -"Se genera cuando el intérprete encuentra un error interno, pero la situación " +"Se lanza cuando el intérprete encuentra un error interno, pero la situación " "no parece tan grave como para abandonar toda esperanza. El valor asociado es " "una cadena que indica qué salió mal (a bajo nivel)." @@ -1006,7 +1014,7 @@ msgid "" "inappropriate type. The associated value is a string giving details about " "the type mismatch." msgstr "" -"Se genera cuando una operación o función se aplica a un objeto de tipo " +"Se lanza cuando una operación o función se aplica a un objeto de tipo " "inapropiado. El valor asociado es una cadena que proporciona detalles sobre " "la falta de coincidencia de tipos." @@ -1041,7 +1049,7 @@ msgid "" "but no value has been bound to that variable. This is a subclass of :exc:" "`NameError`." msgstr "" -"Se genera cuando se hace referencia a una variable local en una función o " +"Se lanza cuando se hace referencia a una variable local en una función o " "método, pero no se ha vinculado ningún valor a esa variable. Esta es una " "subclase de :exc:`NameError`." @@ -1050,7 +1058,7 @@ msgid "" "Raised when a Unicode-related encoding or decoding error occurs. It is a " "subclass of :exc:`ValueError`." msgstr "" -"Se genera cuando se produce un error de codificación o decodificación " +"Se lanza cuando se produce un error de codificación o decodificación " "relacionado con Unicode. Es una subclase de :exc:`ValueError`." #: ../Doc/library/exceptions.rst:627 @@ -1088,7 +1096,7 @@ msgid "" "Raised when a Unicode-related error occurs during encoding. It is a " "subclass of :exc:`UnicodeError`." msgstr "" -"Se genera cuando se produce un error relacionado con Unicode durante la " +"Se lanza cuando se produce un error relacionado con Unicode durante la " "codificación. Es una subclase de :exc:`UnicodeError`." #: ../Doc/library/exceptions.rst:660 @@ -1096,7 +1104,7 @@ msgid "" "Raised when a Unicode-related error occurs during decoding. It is a " "subclass of :exc:`UnicodeError`." msgstr "" -"Se genera cuando se produce un error relacionado con Unicode durante la " +"Se lanza cuando se produce un error relacionado con Unicode durante la " "codificación. Es una subclase de :exc:`UnicodeError`." #: ../Doc/library/exceptions.rst:666 @@ -1104,7 +1112,7 @@ msgid "" "Raised when a Unicode-related error occurs during translating. It is a " "subclass of :exc:`UnicodeError`." msgstr "" -"Se genera cuando se produce un error relacionado con Unicode durante la " +"Se lanza cuando se produce un error relacionado con Unicode durante la " "codificación. Es una subclase de :exc:`UnicodeError`." #: ../Doc/library/exceptions.rst:672 @@ -1113,7 +1121,7 @@ msgid "" "type but an inappropriate value, and the situation is not described by a " "more precise exception such as :exc:`IndexError`." msgstr "" -"Se genera cuando una operación o función recibe un argumento que tiene el " +"Se lanza cuando una operación o función recibe un argumento que tiene el " "tipo correcto pero un valor inapropiado, y la situación no se describe con " "una excepción más precisa como :exc:`IndexError`." @@ -1123,7 +1131,7 @@ msgid "" "The associated value is a string indicating the type of the operands and the " "operation." msgstr "" -"Se genera cuando el segundo argumento de una operación de división o módulo " +"Se lanza cuando el segundo argumento de una operación de división o módulo " "es cero. El valor asociado es una cadena que indica el tipo de operandos y " "la operación." @@ -1148,7 +1156,7 @@ msgid "" "The following exceptions are subclasses of :exc:`OSError`, they get raised " "depending on the system error code." msgstr "" -"Las siguientes excepciones son subclases de :exc:`OSError`, se generan según " +"Las siguientes excepciones son subclases de :exc:`OSError`, se lanzan según " "el código de error del sistema." #: ../Doc/library/exceptions.rst:704 @@ -1501,7 +1509,7 @@ msgstr "" "`BaseException` y puede envolver cualquier excepción, mientras que :exc:" "`ExceptionGroup` extiende a :exc:`Exception` y solo puede envolver subclases " "de :exc:`Exception`. Este diseño está pensado para que ``except Exception`` " -"capture un :exc:`ExceptionGroup` pero no :exc:`BaseExceptionGroup`" +"capture un :exc:`ExceptionGroup` pero no :exc:`BaseExceptionGroup`." #: ../Doc/library/exceptions.rst:940 msgid "" @@ -1547,9 +1555,14 @@ msgid "" "type object) that accepts an exception as its single argument and returns " "true for the exceptions that should be in the subgroup." msgstr "" +"La condición puede ser un tipo de excepción o una tupla de tipos de " +"excepción, en cuyo caso cada excepción se verifica para comprobar si " +"coincide utilizando la misma verificación que es usada en una cláusula " +"*except*. La condición también puede ser un invocable (distinto de un tipo " +"objeto) que acepte una excepción como su único argumento, y retorne *true* " +"para las excepciones que deban estar en el subgrupo." #: ../Doc/library/exceptions.rst:967 -#, fuzzy msgid "" "The nesting structure of the current exception is preserved in the result, " "as are the values of its :attr:`message`, :attr:`~BaseException." @@ -1559,8 +1572,9 @@ msgid "" msgstr "" "La estructura de anidamiento de la excepción actual se conserva en el " "resultado, así como también los valores de sus campos :attr:`message`, :attr:" -"`__traceback__`, :attr:`__cause__`, :attr:`__context__` y :attr:`__notes__`. " -"Los grupos anidados vacíos son omitidos del resultado." +"`~BaseException.__traceback__`, :attr:`~BaseException.__cause__`, :attr:" +"`~BaseException.__context__` y :attr:`~BaseException.__notes__` . Los grupos " +"anidados vacíos son omitidos del resultado." #: ../Doc/library/exceptions.rst:974 msgid "" @@ -1575,7 +1589,7 @@ msgstr "" #: ../Doc/library/exceptions.rst:978 msgid "``condition`` can be any callable which is not a type object." -msgstr "" +msgstr "``condition`` puede ser cualquier invocable que no sea un objeto tipo." #: ../Doc/library/exceptions.rst:983 msgid "" @@ -1596,19 +1610,18 @@ msgstr "" "envuelve las excepciones en ``excs``." #: ../Doc/library/exceptions.rst:992 -#, fuzzy msgid "" "This method is used by :meth:`subgroup` and :meth:`split`, which are used in " "various contexts to break up an exception group. A subclass needs to " "override it in order to make :meth:`subgroup` and :meth:`split` return " "instances of the subclass rather than :exc:`ExceptionGroup`." msgstr "" -"Este método es usado por :meth:`subgroup` y :meth:`split`. Se necesita una " +"Este método es usado por :meth:`subgroup` y :meth:`split`, los cuales se " +"usan en varios contextos para romper un grupo de excepción. Se necesita una " "subclase que lo sobrescriba para que :meth:`subgroup` y :meth:`split` " -"retornan instancias de la subclase en lugar de :exc:`ExceptionGroup`." +"retornen instancias de la subclase en lugar de :exc:`ExceptionGroup`." #: ../Doc/library/exceptions.rst:998 -#, fuzzy msgid "" ":meth:`subgroup` and :meth:`split` copy the :attr:`~BaseException." "__traceback__`, :attr:`~BaseException.__cause__`, :attr:`~BaseException." @@ -1616,10 +1629,11 @@ msgid "" "exception group to the one returned by :meth:`derive`, so these fields do " "not need to be updated by :meth:`derive`." msgstr "" -":meth:`subgroup` y :meth:`split` copian los campos :attr:`__traceback__`, :" -"attr:`__cause__`, :attr:`__context__` y :attr:`__notes__` del grupo de " -"excepción original al devuelto por :meth:`derive`, por lo que estos campos " -"no necesitan ser actualizados por :meth:`derive`. ::" +":meth:`subgroup` y :meth:`split` copian los campos :attr:`~BaseException." +"__traceback__`, :attr:`~BaseException.__cause__`, :attr:`~BaseException." +"__context__` y :attr:`~BaseException.__notes__` del grupo de excepción " +"original al retornado por :meth:`derive`, por lo que estos campos no " +"necesitan ser actualizados por :meth:`derive`." #: ../Doc/library/exceptions.rst:1005 msgid "" @@ -1649,9 +1663,33 @@ msgid "" ">>> exc.__traceback__ is match.__traceback__ is rest.__traceback__\n" "True" msgstr "" +">>> class MyGroup(ExceptionGroup):\n" +"... def derive(self, excs):\n" +"... return MyGroup(self.message, excs)\n" +"...\n" +">>> e = MyGroup(\"eg\", [ValueError(1), TypeError(2)])\n" +">>> e.add_note(\"a note\")\n" +">>> e.__context__ = Exception(\"context\")\n" +">>> e.__cause__ = Exception(\"cause\")\n" +">>> try:\n" +"... raise e\n" +"... except Exception as e:\n" +"... exc = e\n" +"...\n" +">>> match, rest = exc.split(ValueError)\n" +">>> exc, exc.__context__, exc.__cause__, exc.__notes__\n" +"(MyGroup('eg', [ValueError(1), TypeError(2)]), Exception('context'), " +"Exception('cause'), ['a note'])\n" +">>> match, match.__context__, match.__cause__, match.__notes__\n" +"(MyGroup('eg', [ValueError(1)]), Exception('context'), Exception('cause'), " +"['a note'])\n" +">>> rest, rest.__context__, rest.__cause__, rest.__notes__\n" +"(MyGroup('eg', [TypeError(2)]), Exception('context'), Exception('cause'), " +"['a note'])\n" +">>> exc.__traceback__ is match.__traceback__ is rest.__traceback__\n" +"True" #: ../Doc/library/exceptions.rst:1031 -#, fuzzy msgid "" "Note that :exc:`BaseExceptionGroup` defines :meth:`~object.__new__`, so " "subclasses that need a different constructor signature need to override that " @@ -1659,11 +1697,12 @@ msgid "" "exception group subclass which accepts an exit_code and and constructs the " "group's message from it. ::" msgstr "" -"Tenga en cuenta que :exc:`BaseExceptionGroup` define :meth:`__new__`, por lo " -"que las subclases que necesiten una firma de constructor diferente deben " -"sobrescribir ese método en lugar de :meth:`__init__`. Por ejemplo, a " -"continuación se define una subclase de grupo de excepción que acepta un " -"*exit_code* y construye el mensaje del grupo a partir del mismo. ::" +"Tenga en cuenta que :exc:`BaseExceptionGroup` define :meth:`~object." +"__new__`, por lo que las subclases que necesiten una firma de constructor " +"diferente deben sobrescribir ese método en lugar de :meth:`~object." +"__init__`. Por ejemplo, a continuación se define una subclase de grupo de " +"excepción que acepta un *exit_code* y construye el mensaje del grupo a " +"partir del mismo. ::" #: ../Doc/library/exceptions.rst:1037 msgid "" @@ -1676,6 +1715,14 @@ msgid "" " def derive(self, excs):\n" " return Errors(excs, self.exit_code)" msgstr "" +"class Errors(ExceptionGroup):\n" +" def __new__(cls, errors, exit_code):\n" +" self = super().__new__(Errors, f\"exit code: {exit_code}\", errors)\n" +" self.exit_code = exit_code\n" +" return self\n" +"\n" +" def derive(self, excs):\n" +" return Errors(excs, self.exit_code)" #: ../Doc/library/exceptions.rst:1046 msgid "" @@ -1766,6 +1813,74 @@ msgid "" " ├── UnicodeWarning\n" " └── UserWarning\n" msgstr "" +"BaseException\n" +" ├── BaseExceptionGroup\n" +" ├── GeneratorExit\n" +" ├── KeyboardInterrupt\n" +" ├── SystemExit\n" +" └── Exception\n" +" ├── ArithmeticError\n" +" │ ├── FloatingPointError\n" +" │ ├── OverflowError\n" +" │ └── ZeroDivisionError\n" +" ├── AssertionError\n" +" ├── AttributeError\n" +" ├── BufferError\n" +" ├── EOFError\n" +" ├── ExceptionGroup [BaseExceptionGroup]\n" +" ├── ImportError\n" +" │ └── ModuleNotFoundError\n" +" ├── LookupError\n" +" │ ├── IndexError\n" +" │ └── KeyError\n" +" ├── MemoryError\n" +" ├── NameError\n" +" │ └── UnboundLocalError\n" +" ├── OSError\n" +" │ ├── BlockingIOError\n" +" │ ├── ChildProcessError\n" +" │ ├── ConnectionError\n" +" │ │ ├── BrokenPipeError\n" +" │ │ ├── ConnectionAbortedError\n" +" │ │ ├── ConnectionRefusedError\n" +" │ │ └── ConnectionResetError\n" +" │ ├── FileExistsError\n" +" │ ├── FileNotFoundError\n" +" │ ├── InterruptedError\n" +" │ ├── IsADirectoryError\n" +" │ ├── NotADirectoryError\n" +" │ ├── PermissionError\n" +" │ ├── ProcessLookupError\n" +" │ └── TimeoutError\n" +" ├── ReferenceError\n" +" ├── RuntimeError\n" +" │ ├── NotImplementedError\n" +" │ ├── PythonFinalizationError\n" +" │ └── RecursionError\n" +" ├── StopAsyncIteration\n" +" ├── StopIteration\n" +" ├── SyntaxError\n" +" │ └── IndentationError\n" +" │ └── TabError\n" +" ├── SystemError\n" +" ├── TypeError\n" +" ├── ValueError\n" +" │ └── UnicodeError\n" +" │ ├── UnicodeDecodeError\n" +" │ ├── UnicodeEncodeError\n" +" │ └── UnicodeTranslateError\n" +" └── Warning\n" +" ├── BytesWarning\n" +" ├── DeprecationWarning\n" +" ├── EncodingWarning\n" +" ├── FutureWarning\n" +" ├── ImportWarning\n" +" ├── PendingDeprecationWarning\n" +" ├── ResourceWarning\n" +" ├── RuntimeWarning\n" +" ├── SyntaxWarning\n" +" ├── UnicodeWarning\n" +" └── UserWarning\n" #: ../Doc/library/exceptions.rst:6 ../Doc/library/exceptions.rst:17 #: ../Doc/library/exceptions.rst:196 @@ -1785,26 +1900,24 @@ msgid "raise" msgstr "raise" #: ../Doc/library/exceptions.rst:41 -#, fuzzy msgid "exception" -msgstr "Excepciones del sistema operativo" +msgstr "exception" #: ../Doc/library/exceptions.rst:41 -#, fuzzy msgid "chaining" -msgstr "Advertencias" +msgstr "chaining" #: ../Doc/library/exceptions.rst:41 msgid "__cause__ (exception attribute)" -msgstr "" +msgstr "__cause__ (exception attribute)" #: ../Doc/library/exceptions.rst:41 msgid "__context__ (exception attribute)" -msgstr "" +msgstr "__context__ (exception attribute)" #: ../Doc/library/exceptions.rst:41 msgid "__suppress_context__ (exception attribute)" -msgstr "" +msgstr "__suppress_context__ (exception attribute)" #: ../Doc/library/exceptions.rst:196 msgid "assert" From 2f1667c07b560ad0a21c447e54bdff007106b2b2 Mon Sep 17 00:00:00 2001 From: rtobar Date: Thu, 30 Oct 2025 13:36:06 +0800 Subject: [PATCH 02/10] =?UTF-8?q?Arregla=20ortograf=C3=ADa,=20CI=20y=20pot?= =?UTF-8?q?odo=20(#3426)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit El step de chequeo de ortografía comenzó a fallar desde que incluímos #3346. Mi intuición es que ahora que parchamos ciertos archivos .po antes de traducirlos estamos "accidentalmente" arreglando algunas entradas que antes quizás fallaban al ser parseadas, ya sea por pospell or por msgcat, y que cuya ortografía por lo tanto nunca fue chequeada. Aprovecho la oportunidad también de arreglar o mejorar un par de detalles en nuestro script de chequeo de ortografía. En el proceso también ocurrió que, por coincidencia, apareció publicada la nueva versión de potodo, la cual depreca el flag -p/--path que usábamos. Esto provocó una serie de errores que llevó a que: * Actualizara nuestra versión de potodo a la última publicada, * Removiera el flag --path * Añadiera un nuevo step en el job de CI para que la documentación construida se pueda descargar Además envié un pequeño PR a potodo: https://git.afpy.org/AFPy/potodo/pulls/30 --------- Signed-off-by: Rodrigo Tobar --- .github/workflows/main.yml | 6 ++++++ .overrides/progress.rst | 2 +- conf.py | 8 ++++++++ dictionaries/library_io.txt | 1 + dictionaries/whatsnew_2.7.txt | 1 + reference/compound_stmts.po | 2 +- requirements-own.txt | 2 +- scripts/check_spell.py | 15 ++++++++------- 8 files changed, 27 insertions(+), 10 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 18016efc2c..8b3427d1db 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -92,3 +92,9 @@ jobs: - name: Construir documentación run: | sphinx-build -j auto -W --keep-going -b html -d cpython/Doc/_build/doctree -D language=es . cpython/Doc/_build/html + + # Publica la documentación recién construida para poder descargarla de ser necesario + - uses: actions/upload-artifact@v4 + with: + path: cpython/Doc/_build/html + name: documentación-html diff --git a/.overrides/progress.rst b/.overrides/progress.rst index 7fead69417..1a6e7284cf 100644 --- a/.overrides/progress.rst +++ b/.overrides/progress.rst @@ -20,7 +20,7 @@ Muestra los porcentajes completados por directorio y solo los archivos que no es .. runblock:: console - $ potodo --path . + $ potodo . Completados diff --git a/conf.py b/conf.py index a267d02a07..59aacc661f 100644 --- a/conf.py +++ b/conf.py @@ -90,6 +90,14 @@ ] +# autorun is used, among other things, to run potodo, which generates non-ascii output +# starting with 0.30. autorun OTOH defaults to use ascii to decode console/python output. +# Let's switch to utf-8 instead. +autorun_languages = { + "console_output_encoding": "utf-8", + "pycon_output_encoding": "utf-8", +} + def setup(app): def add_contributing_banner(app, doctree): diff --git a/dictionaries/library_io.txt b/dictionaries/library_io.txt index 0a93b4a395..9da6128ac4 100644 --- a/dictionaries/library_io.txt +++ b/dictionaries/library_io.txt @@ -8,3 +8,4 @@ Reconfigura similarmente subclasifica subclasificaciones +Markdown diff --git a/dictionaries/whatsnew_2.7.txt b/dictionaries/whatsnew_2.7.txt index dab9202ed2..87a2cf05a6 100644 --- a/dictionaries/whatsnew_2.7.txt +++ b/dictionaries/whatsnew_2.7.txt @@ -103,3 +103,4 @@ values viewkeys warnings whatever +Light diff --git a/reference/compound_stmts.po b/reference/compound_stmts.po index 483661f484..5a06c0ed61 100644 --- a/reference/compound_stmts.po +++ b/reference/compound_stmts.po @@ -336,7 +336,7 @@ msgstr "" "Para una cláusula de :keyword:`!except`con una expresión, la expresión debe " "evaluar a un tipo de excepción o un tupla de tipos de excepciones. La " "excepción generada coincide con una cláusula :keyword:`!except` cuya " -"expresión evaluá a la clase o una :term:`clase base no virtual ` del objeto excepción, o una tupla que contiene dicha clase." #: ../Doc/reference/compound_stmts.rst:255 diff --git a/requirements-own.txt b/requirements-own.txt index 5f2e1c075a..cac697fa5b 100644 --- a/requirements-own.txt +++ b/requirements-own.txt @@ -2,7 +2,7 @@ pip polib pospell>=1.1 -potodo +potodo>=0.30 powrap>=1.0.2 pre-commit Pygments>=2.17.0 diff --git a/scripts/check_spell.py b/scripts/check_spell.py index d915d23849..da8738366e 100644 --- a/scripts/check_spell.py +++ b/scripts/check_spell.py @@ -4,6 +4,7 @@ """ from pathlib import Path +import shutil import sys import tempfile @@ -43,7 +44,7 @@ def check_spell(po_files=None): # Run pospell either against all files or the file given on the command line if not po_files: - po_files = Path(".").glob("*/*.po") + po_files = list(Path(".").glob("*/*.po")) # Workaround issue #3324 FIXME # It seems that all code snippets have line breaks '\n'. This causes the @@ -52,10 +53,9 @@ def check_spell(po_files=None): # Create temporary copies of the original files. po_files_tmp = [] for po_file in po_files: - with open(tempfile.mktemp(), "w") as temp_file: - # Copy content of the .po file - with open(po_file, "r", encoding="utf-8") as f: - temp_file.write(f.read()) + with open(tempfile.mktemp(), "wb") as temp_file: + with open(po_file, "rb") as original_file: + shutil.copyfileobj(original_file, temp_file) po_files_tmp.append(temp_file.name) # Don't translate probably code entries @@ -66,8 +66,9 @@ def check_spell(po_files=None): polib_temp_file.save() detected_errors = pospell.spell_check(po_files_tmp, personal_dict=output_filename, language="es_ES") - for tmp, orig in zip(po_files_tmp, po_files): - print(tmp, " == ", orig) + if detected_errors: + for tmp, orig in zip(po_files_tmp, po_files): + print(tmp, " == ", orig) return detected_errors From 2f9920ac7b8ec99105f2d06ca0b6ad3fa7dece28 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 4 Nov 2025 06:22:02 +0800 Subject: [PATCH 03/10] Bump actions/upload-artifact from 4 to 5 (#3427) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 4 to 5.
Release notes

Sourced from actions/upload-artifact's releases.

v5.0.0

What's Changed

BREAKING CHANGE: this update supports Node v24.x. This is not a breaking change per-se but we're treating it as such.

New Contributors

Full Changelog: https://github.com/actions/upload-artifact/compare/v4...v5.0.0

v4.6.2

What's Changed

New Contributors

Full Changelog: https://github.com/actions/upload-artifact/compare/v4...v4.6.2

v4.6.1

What's Changed

Full Changelog: https://github.com/actions/upload-artifact/compare/v4...v4.6.1

v4.6.0

What's Changed

Full Changelog: https://github.com/actions/upload-artifact/compare/v4...v4.6.0

v4.5.0

What's Changed

New Contributors

... (truncated)

Commits
  • 330a01c Merge pull request #734 from actions/danwkennedy/prepare-5.0.0
  • 03f2824 Update github.dep.yml
  • 905a1ec Prepare v5.0.0
  • 2d9f9cd Merge pull request #725 from patrikpolyak/patch-1
  • 9687587 Merge branch 'main' into patch-1
  • 2848b2c Merge pull request #727 from danwkennedy/patch-1
  • 9b51177 Spell out the first use of GHES
  • cd231ca Update GHES guidance to include reference to Node 20 version
  • de65e23 Merge pull request #712 from actions/nebuk89-patch-1
  • 8747d8c Update README.md
  • Additional commits viewable in compare view

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=actions/upload-artifact&package-manager=github_actions&previous-version=4&new-version=5)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 8b3427d1db..5e1d56aed3 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -94,7 +94,7 @@ jobs: sphinx-build -j auto -W --keep-going -b html -d cpython/Doc/_build/doctree -D language=es . cpython/Doc/_build/html # Publica la documentación recién construida para poder descargarla de ser necesario - - uses: actions/upload-artifact@v4 + - uses: actions/upload-artifact@v5 with: path: cpython/Doc/_build/html name: documentación-html From a0892dffdc2e985db7dfe0e87fe21e5f66a1fd03 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 25 Nov 2025 06:39:13 +0800 Subject: [PATCH 04/10] Bump actions/checkout from 5 to 6 (#3429) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bumps [actions/checkout](https://github.com/actions/checkout) from 5 to 6.
Release notes

Sourced from actions/checkout's releases.

v6.0.0

What's Changed

Full Changelog: https://github.com/actions/checkout/compare/v5.0.0...v6.0.0

v6-beta

What's Changed

Updated persist-credentials to store the credentials under $RUNNER_TEMP instead of directly in the local git config.

This requires a minimum Actions Runner version of v2.329.0 to access the persisted credentials for Docker container action scenarios.

v5.0.1

What's Changed

Full Changelog: https://github.com/actions/checkout/compare/v5...v5.0.1

Changelog

Sourced from actions/checkout's changelog.

Changelog

V6.0.0

V5.0.1

V5.0.0

V4.3.1

V4.3.0

v4.2.2

v4.2.1

v4.2.0

v4.1.7

v4.1.6

v4.1.5

... (truncated)

Commits

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=actions/checkout&package-manager=github_actions&previous-version=5&new-version=6)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/main.yml | 2 +- .github/workflows/pr-comment.yml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 5e1d56aed3..941885234a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -15,7 +15,7 @@ jobs: runs-on: ubuntu-22.04 steps: # Obtención del código - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 with: submodules: 'true' # Necesario para que tj-actions/changed-files se ejecute diff --git a/.github/workflows/pr-comment.yml b/.github/workflows/pr-comment.yml index 9e0971c7c8..5cc4c780d4 100644 --- a/.github/workflows/pr-comment.yml +++ b/.github/workflows/pr-comment.yml @@ -14,7 +14,7 @@ jobs: any_changed: ${{ steps.changed-files.outputs.any_changed }} comment: ${{ steps.create-pr-comment.outputs.comment }} steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 with: ref: ${{ github.event.pull_request.head.sha }} persist-credentials: false @@ -25,7 +25,7 @@ jobs: cache: "pip" # checkout these files from the base branch to guarantee they haven't been # modified by the PR - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 with: path: base-branch sparse-checkout-cone-mode: false From 5c8626f9686dd689051b86eef4855c892d1d78bc Mon Sep 17 00:00:00 2001 From: Melvin Pineda Miguel <156713664+TAPMelvin@users.noreply.github.com> Date: Thu, 4 Dec 2025 20:30:19 -0500 Subject: [PATCH 05/10] Translate 7 untranslated entries in c-api/arg.po (#3430) - Translate PY_SSIZE_T_CLEAN macro documentation - Translate string/buffer conversion methods introduction - Translate memory allocation note for es/es#/et/et# formats - Translate borrowed buffer explanation - Translate bf_releasebuffer requirement - Translate immutability check note - Translate removed format types (u, u#, Z, Z#) --- c-api/arg.po | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/c-api/arg.po b/c-api/arg.po index 5e3a772073..a3c968b094 100644 --- a/c-api/arg.po +++ b/c-api/arg.po @@ -85,6 +85,10 @@ msgid "" "formats (``s#``, ``y#``, etc.) explained below. This is not necessary on " "Python 3.13 and later." msgstr "" +"En Python 3.12 y versiones anteriores, la macro :c:macro:`!PY_SSIZE_T_CLEAN` " +"debe estar definida antes de incluir :file:`Python.h` para usar todas las " +"variantes ``#`` de formatos (``s#``, ``y#``, etc.) explicadas a continuación. " +"Esto no es necesario en Python 3.13 y versiones posteriores." #: ../Doc/c-api/arg.rst:42 msgid "" @@ -103,7 +107,7 @@ msgstr "" #: ../Doc/c-api/arg.rst:48 msgid "There are three ways strings and buffers can be converted to C:" -msgstr "" +msgstr "Hay tres formas en que las cadenas de caracteres y los búferes pueden convertirse a C:" #: ../Doc/c-api/arg.rst:50 #, fuzzy @@ -129,6 +133,9 @@ msgid "" "**You have to call** :c:func:`PyMem_Free` after you have finished processing " "the data (or in any early abort case)." msgstr "" +"Los formatos ``es``, ``es#``, ``et`` y ``et#`` asignan el búfer de resultado. " +"**Debe llamar** :c:func:`PyMem_Free` después de haber terminado de procesar " +"los datos (o en cualquier caso de aborto temprano)." #: ../Doc/c-api/arg.rst:63 msgid "" @@ -138,6 +145,12 @@ msgid "" "corresponding Python object, and shares the lifetime of this object. You " "won't have to release any memory yourself." msgstr "" +"Otros formatos toman un :class:`str` o un :term:`objeto de tipo bytes ` de solo lectura, como :class:`bytes`, y proporcionan un " +"puntero ``const char *`` a su búfer. En este caso el búfer es \"prestado\" " +"(*borrowed*): es gestionado por el objeto Python correspondiente y comparte " +"el tiempo de vida de este objeto. No tendrá que liberar ninguna memoria " +"usted mismo." #: ../Doc/c-api/arg.rst:70 msgid "" @@ -146,6 +159,11 @@ msgid "" "disallows common mutable objects such as :class:`bytearray`, but also some " "read-only objects such as :class:`memoryview` of :class:`bytes`." msgstr "" +"Para asegurar que el búfer subyacente pueda ser prestado de forma segura, el " +"campo :c:member:`PyBufferProcs.bf_releasebuffer` del objeto debe ser ``NULL``. " +"Esto desautoriza objetos mutables comunes como :class:`bytearray`, pero " +"también algunos objetos de solo lectura como :class:`memoryview` de :class:" +"`bytes`." #: ../Doc/c-api/arg.rst:76 msgid "" @@ -153,6 +171,9 @@ msgid "" "whether the input object is immutable (e.g. whether it would honor a request " "for a writable buffer, or whether another thread can mutate the data)." msgstr "" +"Además de este requisito de ``bf_releasebuffer``, no hay verificación para " +"comprobar si el objeto de entrada es inmutable (por ejemplo, si respetaría " +"una solicitud de un búfer escribible, o si otro hilo puede mutar los datos)." #: ../Doc/c-api/arg.rst:98 msgid "``s`` (:class:`str`) [const char \\*]" @@ -564,6 +585,8 @@ msgid "" "``u``, ``u#``, ``Z``, and ``Z#`` are removed because they used a legacy " "``Py_UNICODE*`` representation." msgstr "" +"``u``, ``u#``, ``Z`` y ``Z#`` fueron eliminados porque usaban una " +"representación heredada ``Py_UNICODE*``." #: ../Doc/c-api/arg.rst:230 msgid "Numbers" From 4c90822d82e9e57e7c86dcc7ce7c04ee58b2d276 Mon Sep 17 00:00:00 2001 From: Melvin Pineda Miguel <156713664+TAPMelvin@users.noreply.github.com> Date: Fri, 5 Dec 2025 23:10:37 -0500 Subject: [PATCH 06/10] Anadir Melvin Pineda Miguel a TRANSLATORS (#3433) Por el PR https://github.com/python/python-docs-es/pull/3430#event-21374229658 --- TRANSLATORS | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/TRANSLATORS b/TRANSLATORS index e46c181565..70c581a0bb 100644 --- a/TRANSLATORS +++ b/TRANSLATORS @@ -188,6 +188,7 @@ Mateo Cámara (@MateoCamara) Matias Bordese (@matiasb) Matthew Ellis Kane Jiménez (@M-E-K-J-2102) Melissa Escobar Gutiérrez (@MelissaEscobar) +Melvin Pineda Miguel (@TAPMelvin) Miguel Ángel Nahuel Ambrosini (@ambro17) Nahuel Espinosa (@nahueespinosa) @@ -250,4 +251,4 @@ Xavi Rambla Centellas (@xavirambla) Yennifer Paola Herrera Ariza (@Yenniferh) Yohanna Padrino (@Yo-hanaPR) zejiran -Zodac (@zodacdev) \ No newline at end of file +Zodac (@zodacdev) From cc86e77d8fbfada59a0e831f3d054c895c6658ee Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 16 Dec 2025 07:02:07 +0800 Subject: [PATCH 07/10] Bump actions/upload-artifact from 5 to 6 (#3434) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 5 to 6.
Release notes

Sourced from actions/upload-artifact's releases.

v6.0.0

v6 - What's new

[!IMPORTANT] actions/upload-artifact@v6 now runs on Node.js 24 (runs.using: node24) and requires a minimum Actions Runner version of 2.327.1. If you are using self-hosted runners, ensure they are updated before upgrading.

Node.js 24

This release updates the runtime to Node.js 24. v5 had preliminary support for Node.js 24, however this action was by default still running on Node.js 20. Now this action by default will run on Node.js 24.

What's Changed

Full Changelog: https://github.com/actions/upload-artifact/compare/v5.0.0...v6.0.0

Commits
  • b7c566a Merge pull request #745 from actions/upload-artifact-v6-release
  • e516bc8 docs: correct description of Node.js 24 support in README
  • ddc45ed docs: update README to correct action name for Node.js 24 support
  • 615b319 chore: release v6.0.0 for Node.js 24 support
  • 017748b Merge pull request #744 from actions/fix-storage-blob
  • 38d4c79 chore: rebuild dist
  • 7d27270 chore: add missing license cache files for @​actions/core, @​actions/io, and mi...
  • 5f643d3 chore: update license files for @​actions/artifact@​5.0.1 dependencies
  • 1df1684 chore: update package-lock.json with @​actions/artifact@​5.0.1
  • b5b1a91 fix: update @​actions/artifact to ^5.0.0 for Node.js 24 punycode fix
  • Additional commits viewable in compare view

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=actions/upload-artifact&package-manager=github_actions&previous-version=5&new-version=6)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 941885234a..9e34309dd9 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -94,7 +94,7 @@ jobs: sphinx-build -j auto -W --keep-going -b html -d cpython/Doc/_build/doctree -D language=es . cpython/Doc/_build/html # Publica la documentación recién construida para poder descargarla de ser necesario - - uses: actions/upload-artifact@v5 + - uses: actions/upload-artifact@v6 with: path: cpython/Doc/_build/html name: documentación-html From 805b8e139886217cf510107b2f7ca2d0e8ee636c Mon Sep 17 00:00:00 2001 From: Richard Rivero Date: Tue, 6 Jan 2026 11:35:58 -0400 Subject: [PATCH 08/10] traduccion de reference/grammar.po (#3319) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes #3290 --------- Co-authored-by: Manuel Kaufmann Co-authored-by: Cristián Maureira-Fredes Co-authored-by: Cristián Maureira-Fredes --- reference/grammar.po | 1974 +++++++++++++++++++++++++++++++++++++++--- 1 file changed, 1862 insertions(+), 112 deletions(-) diff --git a/reference/grammar.po b/reference/grammar.po index 576c444ca4..6186002af8 100644 --- a/reference/grammar.po +++ b/reference/grammar.po @@ -11,15 +11,16 @@ msgstr "" "Project-Id-Version: Python 3.8\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-11-21 16:38-0300\n" -"PO-Revision-Date: 2021-08-02 19:28+0200\n" +"PO-Revision-Date: 2026-01-06 16:26+0100\n" "Last-Translator: Cristián Maureira-Fredes \n" -"Language: es\n" "Language-Team: python-doc-es\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"Language: es\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" "Generated-By: Babel 2.16.0\n" +"X-Generator: Poedit 3.8\n" #: ../Doc/reference/grammar.rst:4 msgid "Full Grammar specification" @@ -37,7 +38,6 @@ msgstr "" "de código y la recuperación de errores." #: ../Doc/reference/grammar.rst:11 -#, fuzzy, python-format msgid "" "The notation is a mixture of `EBNF `_ and `PEG `_ y `PEG `_. En particular, ``&`` seguido de un símbolo, " -"token o grupo entre paréntesis indica una anticipación positiva (es decir, " -"se requiere que coincida pero no se consume), mientras que ``!`` Indica una " -"anticipación negativa (es decir, se requiere _no_ para coincidir). Usamos el " +"token o grupo entre paréntesis indica una anticipación positiva (es decir, se " +"requiere que coincida pero no se consume), mientras que ``!`` Indica una " +"anticipación negativa (es decir, se requiere *no* para coincidir). Usamos el " "separador ``|`` para referirnos a la \"elección ordenada\" de PEG (escrito " -"como ``/`` en las gramáticas tradicionales de PEG)." +"como ``/`` en las gramáticas tradicionales de PEG). Consulta :pep:`617` para " +"más detalles sobre la sintaxis de la gramática." +#, fuzzy #: ../Doc/reference/grammar.rst:21 -#, python-format msgid "" "# PEG grammar for Python\n" "\n" @@ -158,8 +159,7 @@ msgid "" "# ==============\n" "\n" "file[mod_ty]: a=[statements] ENDMARKER { _PyPegen_make_module(p, a) }\n" -"interactive[mod_ty]: a=statement_newline { _PyAST_Interactive(a, p-" -">arena) }\n" +"interactive[mod_ty]: a=statement_newline { _PyAST_Interactive(a, p->arena) }\n" "eval[mod_ty]: a=expressions NEWLINE* ENDMARKER { _PyAST_Expression(a, p-" ">arena) }\n" "func_type[mod_ty]: '(' a=[type_expressions] ')' '->' b=expression NEWLINE* " @@ -188,8 +188,7 @@ msgid "" "a) } # Not needed, there for speedup\n" " | a[asdl_stmt_seq*]=';'.simple_stmt+ [';'] NEWLINE { a }\n" "\n" -"# NOTE: assignment MUST precede expression, else parsing a simple " -"assignment\n" +"# NOTE: assignment MUST precede expression, else parsing a simple assignment\n" "# will throw a SyntaxError.\n" "simple_stmt[stmt_ty] (memo):\n" " | assignment\n" @@ -265,8 +264,8 @@ msgid "" " | 'return' a=[star_expressions] { _PyAST_Return(a, EXTRA) }\n" "\n" "raise_stmt[stmt_ty]:\n" -" | 'raise' a=expression b=['from' z=expression { z }] { _PyAST_Raise(a, " -"b, EXTRA) }\n" +" | 'raise' a=expression b=['from' z=expression { z }] { _PyAST_Raise(a, b, " +"EXTRA) }\n" " | 'raise' { _PyAST_Raise(NULL, NULL, EXTRA) }\n" "\n" "global_stmt[stmt_ty]: 'global' a[asdl_expr_seq*]=','.NAME+ {\n" @@ -294,13 +293,11 @@ msgid "" "# Import statements\n" "# -----------------\n" "\n" -"import_name[stmt_ty]: 'import' a=dotted_as_names { _PyAST_Import(a, " -"EXTRA) }\n" +"import_name[stmt_ty]: 'import' a=dotted_as_names { _PyAST_Import(a, EXTRA) }\n" "# note below: the ('.' | '...') is necessary because '...' is tokenized as " "ELLIPSIS\n" "import_from[stmt_ty]:\n" -" | 'from' a=('.' | '...')* b=dotted_name 'import' c=import_from_targets " -"{\n" +" | 'from' a=('.' | '...')* b=dotted_name 'import' c=import_from_targets {\n" " _PyAST_ImportFrom(b->v.Name.id, c, _PyPegen_seq_count_dots(a), " "EXTRA) }\n" " | 'from' a=('.' | '...')+ 'import' b=import_from_targets {\n" @@ -315,15 +312,15 @@ msgid "" " | a[asdl_alias_seq*]=','.import_from_as_name+ { a }\n" "import_from_as_name[alias_ty]:\n" " | a=NAME b=['as' z=NAME { z }] { _PyAST_alias(a->v.Name.id,\n" -" (b) ? ((expr_ty) b)->v.Name." -"id : NULL,\n" +" (b) ? ((expr_ty) b)-" +">v.Name.id : NULL,\n" " EXTRA) }\n" "dotted_as_names[asdl_alias_seq*]:\n" " | a[asdl_alias_seq*]=','.dotted_as_name+ { a }\n" "dotted_as_name[alias_ty]:\n" " | a=dotted_name b=['as' z=NAME { z }] { _PyAST_alias(a->v.Name.id,\n" -" (b) ? ((expr_ty) b)->v." -"Name.id : NULL,\n" +" (b) ? ((expr_ty) b)-" +">v.Name.id : NULL,\n" " EXTRA) }\n" "dotted_name[expr_ty]:\n" " | a=dotted_name '.' b=NAME { _PyPegen_join_names_with_dot(p, a, b) }\n" @@ -340,8 +337,8 @@ msgid "" " | simple_stmts\n" " | invalid_block\n" "\n" -"decorators[asdl_expr_seq*]: a[asdl_expr_seq*]=('@' f=named_expression " -"NEWLINE { f })+ { a }\n" +"decorators[asdl_expr_seq*]: a[asdl_expr_seq*]=('@' f=named_expression NEWLINE " +"{ f })+ { a }\n" "\n" "# Class definitions\n" "# -----------------\n" @@ -463,17 +460,17 @@ msgid "" "param_with_default[NameDefaultPair*]:\n" " | a=param c=default ',' tc=TYPE_COMMENT? { _PyPegen_name_default_pair(p, " "a, c, tc) }\n" -" | a=param c=default tc=TYPE_COMMENT? &')' " -"{ _PyPegen_name_default_pair(p, a, c, tc) }\n" +" | a=param c=default tc=TYPE_COMMENT? &')' { _PyPegen_name_default_pair(p, " +"a, c, tc) }\n" "param_maybe_default[NameDefaultPair*]:\n" -" | a=param c=default? ',' tc=TYPE_COMMENT? " -"{ _PyPegen_name_default_pair(p, a, c, tc) }\n" +" | a=param c=default? ',' tc=TYPE_COMMENT? { _PyPegen_name_default_pair(p, " +"a, c, tc) }\n" " | a=param c=default? tc=TYPE_COMMENT? &')' " "{ _PyPegen_name_default_pair(p, a, c, tc) }\n" "param[arg_ty]: a=NAME b=annotation? { _PyAST_arg(a->v.Name.id, b, NULL, " "EXTRA) }\n" -"param_star_annotation[arg_ty]: a=NAME b=star_annotation { _PyAST_arg(a->v." -"Name.id, b, NULL, EXTRA) }\n" +"param_star_annotation[arg_ty]: a=NAME b=star_annotation { _PyAST_arg(a-" +">v.Name.id, b, NULL, EXTRA) }\n" "annotation[expr_ty]: ':' a=expression { a }\n" "star_annotation[expr_ty]: ':' a=star_expression { a }\n" "default[expr_ty]: '=' a=expression { a } | invalid_default\n" @@ -486,8 +483,8 @@ msgid "" " | 'if' a=named_expression ':' b=block c=elif_stmt {\n" " _PyAST_If(a, b, CHECK(asdl_stmt_seq*, _PyPegen_singleton_seq(p, c)), " "EXTRA) }\n" -" | 'if' a=named_expression ':' b=block c=[else_block] { _PyAST_If(a, b, " -"c, EXTRA) }\n" +" | 'if' a=named_expression ':' b=block c=[else_block] { _PyAST_If(a, b, c, " +"EXTRA) }\n" "elif_stmt[stmt_ty]:\n" " | invalid_elif_stmt\n" " | 'elif' a=named_expression ':' b=block c=elif_stmt {\n" @@ -504,8 +501,8 @@ msgid "" "\n" "while_stmt[stmt_ty]:\n" " | invalid_while_stmt\n" -" | 'while' a=named_expression ':' b=block c=[else_block] " -"{ _PyAST_While(a, b, c, EXTRA) }\n" +" | 'while' a=named_expression ':' b=block c=[else_block] { _PyAST_While(a, " +"b, c, EXTRA) }\n" "\n" "# For statement\n" "# -------------\n" @@ -517,8 +514,8 @@ msgid "" " _PyAST_For(t, ex, b, el, NEW_TYPE_COMMENT(p, tc), EXTRA) }\n" " | 'async' 'for' t=star_targets 'in' ~ ex=star_expressions ':' " "tc=[TYPE_COMMENT] b=block el=[else_block] {\n" -" CHECK_VERSION(stmt_ty, 5, \"Async for loops are\", " -"_PyAST_AsyncFor(t, ex, b, el, NEW_TYPE_COMMENT(p, tc), EXTRA)) }\n" +" CHECK_VERSION(stmt_ty, 5, \"Async for loops are\", _PyAST_AsyncFor(t, " +"ex, b, el, NEW_TYPE_COMMENT(p, tc), EXTRA)) }\n" " | invalid_for_target\n" "\n" "# With statement\n" @@ -543,8 +540,8 @@ msgid "" " | invalid_with_stmt\n" "\n" "with_item[withitem_ty]:\n" -" | e=expression 'as' t=star_target &(',' | ')' | ':') " -"{ _PyAST_withitem(e, t, p->arena) }\n" +" | e=expression 'as' t=star_target &(',' | ')' | ':') { _PyAST_withitem(e, " +"t, p->arena) }\n" " | invalid_with_item\n" " | e=expression { _PyAST_withitem(e, NULL, p->arena) }\n" "\n" @@ -674,8 +671,8 @@ msgid "" " | imag=NUMBER { _PyPegen_ensure_imaginary(p, imag) }\n" "\n" "capture_pattern[pattern_ty]:\n" -" | target=pattern_capture_target { _PyAST_MatchAs(NULL, target->v.Name." -"id, EXTRA) }\n" +" | target=pattern_capture_target { _PyAST_MatchAs(NULL, target->v.Name.id, " +"EXTRA) }\n" "\n" "pattern_capture_target[expr_ty]:\n" " | !\"_\" name=NAME !('.' | '(' | '=') {\n" @@ -802,8 +799,8 @@ msgid "" " CHECK_VERSION(asdl_type_param_seq *, 12, \"Type parameter lists " "are\", t) }\n" "\n" -"type_param_seq[asdl_type_param_seq*]: a[asdl_type_param_seq*]=','." -"type_param+ [','] { a }\n" +"type_param_seq[asdl_type_param_seq*]: a[asdl_type_param_seq*]=','.type_param+ " +"[','] { a }\n" "\n" "type_param[type_param_ty] (memo):\n" " | a=NAME b=[type_param_bound] c=[type_param_default] { _PyAST_TypeVar(a-" @@ -813,8 +810,8 @@ msgid "" " ? \"cannot use constraints with TypeVarTuple\"\n" " : \"cannot use bound with TypeVarTuple\")\n" " }\n" -" | '*' a=NAME b=[type_param_starred_default] { _PyAST_TypeVarTuple(a->v." -"Name.id, b, EXTRA) }\n" +" | '*' a=NAME b=[type_param_starred_default] { _PyAST_TypeVarTuple(a-" +">v.Name.id, b, EXTRA) }\n" " | '**' a=NAME colon=':' e=expression {\n" " RAISE_SYNTAX_ERROR_STARTING_FROM(colon, e->kind == Tuple_kind\n" " ? \"cannot use constraints with ParamSpec\"\n" @@ -834,8 +831,8 @@ msgid "" "\n" "expressions[expr_ty]:\n" " | a=expression b=(',' c=expression { c })+ [','] {\n" -" _PyAST_Tuple(CHECK(asdl_expr_seq*, _PyPegen_seq_insert_in_front(p, " -"a, b)), Load, EXTRA) }\n" +" _PyAST_Tuple(CHECK(asdl_expr_seq*, _PyPegen_seq_insert_in_front(p, a, " +"b)), Load, EXTRA) }\n" " | a=expression ',' { _PyAST_Tuple(CHECK(asdl_expr_seq*, " "_PyPegen_singleton_seq(p, a)), Load, EXTRA) }\n" " | expression\n" @@ -854,8 +851,8 @@ msgid "" "\n" "star_expressions[expr_ty]:\n" " | a=star_expression b=(',' c=star_expression { c })+ [','] {\n" -" _PyAST_Tuple(CHECK(asdl_expr_seq*, _PyPegen_seq_insert_in_front(p, " -"a, b)), Load, EXTRA) }\n" +" _PyAST_Tuple(CHECK(asdl_expr_seq*, _PyPegen_seq_insert_in_front(p, a, " +"b)), Load, EXTRA) }\n" " | a=star_expression ',' { _PyAST_Tuple(CHECK(asdl_expr_seq*, " "_PyPegen_singleton_seq(p, a)), Load, EXTRA) }\n" " | star_expression\n" @@ -864,8 +861,8 @@ msgid "" " | '*' a=bitwise_or { _PyAST_Starred(a, Load, EXTRA) }\n" " | expression\n" "\n" -"star_named_expressions[asdl_expr_seq*]: a[asdl_expr_seq*]=','." -"star_named_expression+ [','] { a }\n" +"star_named_expressions[asdl_expr_seq*]: " +"a[asdl_expr_seq*]=','.star_named_expression+ [','] { a }\n" "\n" "star_named_expression[expr_ty]:\n" " | '*' a=bitwise_or { _PyAST_Starred(a, Load, EXTRA) }\n" @@ -931,12 +928,12 @@ msgid "" "a=bitwise_or {_PyPegen_cmpop_expr_pair(p, NotEq, a) }\n" "lte_bitwise_or[CmpopExprPair*]: '<=' a=bitwise_or " "{ _PyPegen_cmpop_expr_pair(p, LtE, a) }\n" -"lt_bitwise_or[CmpopExprPair*]: '<' a=bitwise_or " -"{ _PyPegen_cmpop_expr_pair(p, Lt, a) }\n" +"lt_bitwise_or[CmpopExprPair*]: '<' a=bitwise_or { _PyPegen_cmpop_expr_pair(p, " +"Lt, a) }\n" "gte_bitwise_or[CmpopExprPair*]: '>=' a=bitwise_or " "{ _PyPegen_cmpop_expr_pair(p, GtE, a) }\n" -"gt_bitwise_or[CmpopExprPair*]: '>' a=bitwise_or " -"{ _PyPegen_cmpop_expr_pair(p, Gt, a) }\n" +"gt_bitwise_or[CmpopExprPair*]: '>' a=bitwise_or { _PyPegen_cmpop_expr_pair(p, " +"Gt, a) }\n" "notin_bitwise_or[CmpopExprPair*]: 'not' 'in' a=bitwise_or " "{ _PyPegen_cmpop_expr_pair(p, NotIn, a) }\n" "in_bitwise_or[CmpopExprPair*]: 'in' a=bitwise_or " @@ -1114,8 +1111,7 @@ msgid "" "NULL) }\n" " | a=lambda_param c=default? &':' { _PyPegen_name_default_pair(p, a, c, " "NULL) }\n" -"lambda_param[arg_ty]: a=NAME { _PyAST_arg(a->v.Name.id, NULL, NULL, " -"EXTRA) }\n" +"lambda_param[arg_ty]: a=NAME { _PyAST_arg(a->v.Name.id, NULL, NULL, EXTRA) }\n" "\n" "# LITERALS\n" "# ========\n" @@ -1134,8 +1130,7 @@ msgid "" "conv_token, conv) }\n" "fstring_full_format_spec[ResultTokenWithMetadata*]:\n" " | colon=':' spec=fstring_format_spec* " -"{ _PyPegen_setup_full_format_spec(p, colon, (asdl_expr_seq *) spec, " -"EXTRA) }\n" +"{ _PyPegen_setup_full_format_spec(p, colon, (asdl_expr_seq *) spec, EXTRA) }\n" "fstring_format_spec[expr_ty]:\n" " | t=FSTRING_MIDDLE { _PyPegen_decoded_constant_from_token(p, t) }\n" " | fstring_replacement_field\n" @@ -1247,15 +1242,15 @@ msgid "" "kwarg_or_starred[KeywordOrStarred*]:\n" " | invalid_kwarg\n" " | a=NAME '=' b=expression {\n" -" _PyPegen_keyword_or_starred(p, CHECK(keyword_ty, _PyAST_keyword(a->v." -"Name.id, b, EXTRA)), 1) }\n" +" _PyPegen_keyword_or_starred(p, CHECK(keyword_ty, _PyAST_keyword(a-" +">v.Name.id, b, EXTRA)), 1) }\n" " | a=starred_expression { _PyPegen_keyword_or_starred(p, a, 0) }\n" "\n" "kwarg_or_double_starred[KeywordOrStarred*]:\n" " | invalid_kwarg\n" " | a=NAME '=' b=expression {\n" -" _PyPegen_keyword_or_starred(p, CHECK(keyword_ty, _PyAST_keyword(a->v." -"Name.id, b, EXTRA)), 1) }\n" +" _PyPegen_keyword_or_starred(p, CHECK(keyword_ty, _PyAST_keyword(a-" +">v.Name.id, b, EXTRA)), 1) }\n" " | '**' a=expression { _PyPegen_keyword_or_starred(p, CHECK(keyword_ty, " "_PyAST_keyword(NULL, a, EXTRA)), 1) }\n" "\n" @@ -1269,8 +1264,8 @@ msgid "" "star_targets[expr_ty]:\n" " | a=star_target !',' { a }\n" " | a=star_target b=(',' c=star_target { c })* [','] {\n" -" _PyAST_Tuple(CHECK(asdl_expr_seq*, _PyPegen_seq_insert_in_front(p, " -"a, b)), Store, EXTRA) }\n" +" _PyAST_Tuple(CHECK(asdl_expr_seq*, _PyPegen_seq_insert_in_front(p, a, " +"b)), Store, EXTRA) }\n" "\n" "star_targets_list_seq[asdl_expr_seq*]: a[asdl_expr_seq*]=','.star_target+ " "[','] { a }\n" @@ -1287,8 +1282,8 @@ msgid "" " | target_with_star_atom\n" "\n" "target_with_star_atom[expr_ty] (memo):\n" -" | a=t_primary '.' b=NAME !t_lookahead { _PyAST_Attribute(a, b->v.Name." -"id, Store, EXTRA) }\n" +" | a=t_primary '.' b=NAME !t_lookahead { _PyAST_Attribute(a, b->v.Name.id, " +"Store, EXTRA) }\n" " | a=t_primary '[' b=slices ']' !t_lookahead { _PyAST_Subscript(a, b, " "Store, EXTRA) }\n" " | star_atom\n" @@ -1306,14 +1301,14 @@ msgid "" " | '(' a=single_target ')' { a }\n" "\n" "single_subscript_attribute_target[expr_ty]:\n" -" | a=t_primary '.' b=NAME !t_lookahead { _PyAST_Attribute(a, b->v.Name." -"id, Store, EXTRA) }\n" +" | a=t_primary '.' b=NAME !t_lookahead { _PyAST_Attribute(a, b->v.Name.id, " +"Store, EXTRA) }\n" " | a=t_primary '[' b=slices ']' !t_lookahead { _PyAST_Subscript(a, b, " "Store, EXTRA) }\n" "\n" "t_primary[expr_ty]:\n" -" | a=t_primary '.' b=NAME &t_lookahead { _PyAST_Attribute(a, b->v.Name." -"id, Load, EXTRA) }\n" +" | a=t_primary '.' b=NAME &t_lookahead { _PyAST_Attribute(a, b->v.Name.id, " +"Load, EXTRA) }\n" " | a=t_primary '[' b=slices ']' &t_lookahead { _PyAST_Subscript(a, b, " "Load, EXTRA) }\n" " | a=t_primary b=genexp &t_lookahead {\n" @@ -1334,10 +1329,10 @@ msgid "" "del_targets[asdl_expr_seq*]: a[asdl_expr_seq*]=','.del_target+ [','] { a }\n" "\n" "del_target[expr_ty] (memo):\n" -" | a=t_primary '.' b=NAME !t_lookahead { _PyAST_Attribute(a, b->v.Name." -"id, Del, EXTRA) }\n" -" | a=t_primary '[' b=slices ']' !t_lookahead { _PyAST_Subscript(a, b, " +" | a=t_primary '.' b=NAME !t_lookahead { _PyAST_Attribute(a, b->v.Name.id, " "Del, EXTRA) }\n" +" | a=t_primary '[' b=slices ']' !t_lookahead { _PyAST_Subscript(a, b, Del, " +"EXTRA) }\n" " | del_t_atom\n" "\n" "del_t_atom[expr_ty]:\n" @@ -1384,15 +1379,15 @@ msgid "" "# From here on, there are rules for invalid syntax with specialised error " "messages\n" "invalid_arguments:\n" -" | ((','.(starred_expression | ( assignment_expression | expression !':" -"=') !'=')+ ',' kwargs) | kwargs) a=',' ','.(starred_expression !'=')+ {\n" +" | ((','.(starred_expression | ( assignment_expression | " +"expression !':=') !'=')+ ',' kwargs) | kwargs) a=',' ','." +"(starred_expression !'=')+ {\n" " RAISE_SYNTAX_ERROR_STARTING_FROM(a, \"iterable argument unpacking " "follows keyword argument unpacking\") }\n" -" | a=expression b=for_if_clauses ',' [args | expression for_if_clauses] " -"{\n" +" | a=expression b=for_if_clauses ',' [args | expression for_if_clauses] {\n" " RAISE_SYNTAX_ERROR_KNOWN_RANGE(a, " -"_PyPegen_get_last_comprehension_item(PyPegen_last_item(b, " -"comprehension_ty)), \"Generator expression must be parenthesized\") }\n" +"_PyPegen_get_last_comprehension_item(PyPegen_last_item(b, comprehension_ty)), " +"\"Generator expression must be parenthesized\") }\n" " | a=NAME b='=' expression for_if_clauses {\n" " RAISE_SYNTAX_ERROR_KNOWN_RANGE(a, b, \"invalid syntax. Maybe you " "meant '==' or ':=' instead of '='?\")}\n" @@ -1402,8 +1397,8 @@ msgid "" " | a=args b=for_if_clauses { _PyPegen_nonparen_genexp_in_call(p, a, b) }\n" " | args ',' a=expression b=for_if_clauses {\n" " RAISE_SYNTAX_ERROR_KNOWN_RANGE(a, " -"_PyPegen_get_last_comprehension_item(PyPegen_last_item(b, " -"comprehension_ty)), \"Generator expression must be parenthesized\") }\n" +"_PyPegen_get_last_comprehension_item(PyPegen_last_item(b, comprehension_ty)), " +"\"Generator expression must be parenthesized\") }\n" " | a=args ',' args { _PyPegen_arguments_parsing_error(p, a) }\n" "invalid_kwarg:\n" " | a[Token*]=('True'|'False'|'None') b='=' {\n" @@ -1414,14 +1409,14 @@ msgid "" "meant '==' or ':=' instead of '='?\")}\n" " | !(NAME '=') a=expression b='=' {\n" " RAISE_SYNTAX_ERROR_KNOWN_RANGE(\n" -" a, b, \"expression cannot contain assignment, perhaps you meant " -"\\\"==\\\"?\") }\n" +" a, b, \"expression cannot contain assignment, perhaps you meant \\" +"\"==\\\"?\") }\n" " | a='**' expression '=' b=expression {\n" " RAISE_SYNTAX_ERROR_KNOWN_RANGE(a, b, \"cannot assign to keyword " "argument unpacking\") }\n" "\n" -"# IMPORTANT: Note that the \"_without_invalid\" suffix causes the rule to " -"not call invalid rules under it\n" +"# IMPORTANT: Note that the \"_without_invalid\" suffix causes the rule to not " +"call invalid rules under it\n" "expression_without_invalid[expr_ty]:\n" " | a=disjunction 'if' b=disjunction 'else' c=expression { _PyAST_IfExp(b, " "a, c, EXTRA) }\n" @@ -1431,18 +1426,18 @@ msgid "" " | a=NAME !'(' b=star_expressions {\n" " _PyPegen_check_legacy_stmt(p, a) ? RAISE_SYNTAX_ERROR_KNOWN_RANGE(a, " "b,\n" -" \"Missing parentheses in call to '%U'. Did you mean %U(...)?\", " -"a->v.Name.id, a->v.Name.id) : NULL}\n" +" \"Missing parentheses in call to '%U'. Did you mean %U(...)?\", a-" +">v.Name.id, a->v.Name.id) : NULL}\n" "\n" "invalid_expression:\n" " # !(NAME STRING) is not matched so we don't show this error with some " "invalid string prefixes like: kf\"dsfsdf\"\n" " # Soft keywords need to also be ignored because they can be parsed as " "NAME NAME\n" -" | !(NAME STRING | SOFT_KEYWORD) a=disjunction " -"b=expression_without_invalid {\n" -" _PyPegen_check_legacy_stmt(p, a) ? NULL : p->tokens[p->mark-1]-" -">level == 0 ? NULL :\n" +" | !(NAME STRING | SOFT_KEYWORD) a=disjunction b=expression_without_invalid " +"{\n" +" _PyPegen_check_legacy_stmt(p, a) ? NULL : p->tokens[p->mark-1]->level " +"== 0 ? NULL :\n" " RAISE_SYNTAX_ERROR_KNOWN_RANGE(a, b, \"invalid syntax. Perhaps you " "forgot a comma?\") }\n" " | a=disjunction 'if' b=disjunction !('else'|':') " @@ -1474,8 +1469,8 @@ msgid "" " _PyPegen_get_expr_name(a)\n" " )}\n" " | a=star_named_expression ',' star_named_expressions* ':' expression {\n" -" RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"only single target (not " -"tuple) can be annotated\") }\n" +" RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"only single target (not tuple) " +"can be annotated\") }\n" " | a=expression ':' expression {\n" " RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"illegal target for " "annotation\") }\n" @@ -1542,8 +1537,8 @@ msgid "" "\"named arguments must follow bare *\") }\n" " | '*' ',' TYPE_COMMENT { RAISE_SYNTAX_ERROR(\"bare * has associated type " "comment\") }\n" -" | '*' param a='=' { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"var-" -"positional argument cannot have default value\") }\n" +" | '*' param a='=' { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"var-positional " +"argument cannot have default value\") }\n" " | '*' (param_no_default | ',') param_maybe_default* a='*' " "(param_no_default | ',') {\n" " RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"* argument may appear only " @@ -1654,14 +1649,14 @@ msgid "" " | a='try' ':' NEWLINE !INDENT {\n" " RAISE_INDENTATION_ERROR(\"expected an indented block after 'try' " "statement on line %d\", a->lineno) }\n" -" | 'try' ':' block !('except' | 'finally') " -"{ RAISE_SYNTAX_ERROR(\"expected 'except' or 'finally' block\") }\n" +" | 'try' ':' block !('except' | 'finally') { RAISE_SYNTAX_ERROR(\"expected " +"'except' or 'finally' block\") }\n" " | 'try' ':' block* except_block+ a='except' b='*' expression ['as' NAME] " "':' {\n" " RAISE_SYNTAX_ERROR_KNOWN_RANGE(a, b, \"cannot have both 'except' and " "'except*' on the same 'try'\") }\n" -" | 'try' ':' block* except_star_block+ a='except' [expression ['as' " -"NAME]] ':' {\n" +" | 'try' ':' block* except_star_block+ a='except' [expression ['as' NAME]] " +"':' {\n" " RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"cannot have both 'except' and " "'except*' on the same 'try'\") }\n" "invalid_except_stmt:\n" @@ -1700,8 +1695,8 @@ msgid "" " RAISE_INDENTATION_ERROR(\"expected an indented block after 'case' " "statement on line %d\", a->lineno) }\n" "invalid_as_pattern:\n" -" | or_pattern 'as' a=\"_\" { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, " -"\"cannot use '_' as a target\") }\n" +" | or_pattern 'as' a=\"_\" { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"cannot " +"use '_' as a target\") }\n" " | or_pattern 'as' !NAME a=expression " "{ RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"invalid pattern target\") }\n" "invalid_class_pattern:\n" @@ -1714,8 +1709,7 @@ msgid "" " | [positional_patterns ','] keyword_patterns ',' a=positional_patterns " "{ a }\n" "invalid_if_stmt:\n" -" | 'if' named_expression NEWLINE { RAISE_SYNTAX_ERROR(\"expected " -"':'\") }\n" +" | 'if' named_expression NEWLINE { RAISE_SYNTAX_ERROR(\"expected ':'\") }\n" " | a='if' a=named_expression ':' NEWLINE !INDENT {\n" " RAISE_INDENTATION_ERROR(\"expected an indented block after 'if' " "statement on line %d\", a->lineno) }\n" @@ -1743,12 +1737,12 @@ msgid "" " RAISE_INDENTATION_ERROR(\"expected an indented block after 'for' " "statement on line %d\", a->lineno) }\n" "invalid_def_raw:\n" -" | ['async'] a='def' NAME [type_params] '(' [params] ')' ['->' " -"expression] ':' NEWLINE !INDENT {\n" +" | ['async'] a='def' NAME [type_params] '(' [params] ')' ['->' expression] " +"':' NEWLINE !INDENT {\n" " RAISE_INDENTATION_ERROR(\"expected an indented block after function " "definition on line %d\", a->lineno) }\n" -" | ['async'] 'def' NAME [type_params] &&'(' [params] ')' ['->' " -"expression] &&':' [func_type_comment] block\n" +" | ['async'] 'def' NAME [type_params] &&'(' [params] ')' ['->' expression] " +"&&':' [func_type_comment] block\n" "invalid_class_def_raw:\n" " | 'class' NAME [type_params] ['(' [arguments] ')'] NEWLINE " "{ RAISE_SYNTAX_ERROR(\"expected ':'\") }\n" @@ -1805,8 +1799,8 @@ msgid "" "string: expecting '}'\") }\n" "\n" "invalid_conversion_character:\n" -" | '!' &(':' | '}') { RAISE_SYNTAX_ERROR_ON_NEXT_TOKEN(\"f-string: " -"missing conversion character\") }\n" +" | '!' &(':' | '}') { RAISE_SYNTAX_ERROR_ON_NEXT_TOKEN(\"f-string: missing " +"conversion character\") }\n" " | '!' !NAME { RAISE_SYNTAX_ERROR_ON_NEXT_TOKEN(\"f-string: invalid " "conversion character\") }\n" "\n" @@ -1824,3 +1818,1759 @@ msgid "" " token, \n" " \"Type parameter list cannot be empty\")}\n" msgstr "" +"# PEG grammar for Python\n" +"\n" +"@trailer '''\n" +"void *\n" +"_PyPegen_parse(Parser *p)\n" +"{\n" +" // Initialize keywords\n" +" p->keywords = reserved_keywords;\n" +" p->n_keyword_lists = n_keyword_lists;\n" +" p->soft_keywords = soft_keywords;\n" +"\n" +" // Run parser\n" +" void *result = NULL;\n" +" if (p->start_rule == Py_file_input) {\n" +" result = file_rule(p);\n" +" } else if (p->start_rule == Py_single_input) {\n" +" result = interactive_rule(p);\n" +" } else if (p->start_rule == Py_eval_input) {\n" +" result = eval_rule(p);\n" +" } else if (p->start_rule == Py_func_type_input) {\n" +" result = func_type_rule(p);\n" +" }\n" +"\n" +" return result;\n" +"}\n" +"'''\n" +"\n" +"# ========================= START OF THE GRAMMAR =========================\n" +"\n" +"# General grammatical elements and rules:\n" +"#\n" +"# * Strings with double quotes (\") denote SOFT KEYWORDS\n" +"# * Strings with single quotes (') denote KEYWORDS\n" +"# * Upper case names (NAME) denote tokens in the Grammar/Tokens file\n" +"# * Rule names starting with \"invalid_\" are used for specialized syntax " +"errors\n" +"# - These rules are NOT used in the first pass of the parser.\n" +"# - Only if the first pass fails to parse, a second pass including the " +"invalid\n" +"# rules will be executed.\n" +"# - If the parser fails in the second phase with a generic syntax error, " +"the\n" +"# location of the generic failure of the first pass will be used (this " +"avoids\n" +"# reporting incorrect locations due to the invalid rules).\n" +"# - The order of the alternatives involving invalid rules matter\n" +"# (like any rule in PEG).\n" +"#\n" +"# Grammar Syntax (see PEP 617 for more information):\n" +"#\n" +"# rule_name: expression\n" +"# Optionally, a type can be included right after the rule name, which\n" +"# specifies the return type of the C or Python function corresponding to " +"the\n" +"# rule:\n" +"# rule_name[return_type]: expression\n" +"# If the return type is omitted, then a void * is returned in C and an Any " +"in\n" +"# Python.\n" +"# e1 e2\n" +"# Match e1, then match e2.\n" +"# e1 | e2\n" +"# Match e1 or e2.\n" +"# The first alternative can also appear on the line after the rule name " +"for\n" +"# formatting purposes. In that case, a | must be used before the first\n" +"# alternative, like so:\n" +"# rule_name[return_type]:\n" +"# | first_alt\n" +"# | second_alt\n" +"# ( e )\n" +"# Match e (allows also to use other operators in the group like '(e)*')\n" +"# [ e ] or e?\n" +"# Optionally match e.\n" +"# e*\n" +"# Match zero or more occurrences of e.\n" +"# e+\n" +"# Match one or more occurrences of e.\n" +"# s.e+\n" +"# Match one or more occurrences of e, separated by s. The generated parse " +"tree\n" +"# does not include the separator. This is otherwise identical to (e (s " +"e)*).\n" +"# &e\n" +"# Succeed if e can be parsed, without consuming any input.\n" +"# !e\n" +"# Fail if e can be parsed, without consuming any input.\n" +"# ~\n" +"# Commit to the current alternative, even if it fails to parse.\n" +"# &&e\n" +"# Eager parse e. The parser will not backtrack and will immediately \n" +"# fail with SyntaxError if e cannot be parsed.\n" +"#\n" +"\n" +"# STARTING RULES\n" +"# ==============\n" +"\n" +"file[mod_ty]: a=[statements] ENDMARKER { _PyPegen_make_module(p, a) }\n" +"interactive[mod_ty]: a=statement_newline { _PyAST_Interactive(a, p->arena) }\n" +"eval[mod_ty]: a=expressions NEWLINE* ENDMARKER { _PyAST_Expression(a, p-" +">arena) }\n" +"func_type[mod_ty]: '(' a=[type_expressions] ')' '->' b=expression NEWLINE* " +"ENDMARKER { _PyAST_FunctionType(a, b, p->arena) }\n" +"\n" +"# GENERAL STATEMENTS\n" +"# ==================\n" +"\n" +"statements[asdl_stmt_seq*]: a=statement+ " +"{ (asdl_stmt_seq*)_PyPegen_seq_flatten(p, a) }\n" +"\n" +"statement[asdl_stmt_seq*]: a=compound_stmt " +"{ (asdl_stmt_seq*)_PyPegen_singleton_seq(p, a) } | " +"a[asdl_stmt_seq*]=simple_stmts { a }\n" +"\n" +"statement_newline[asdl_stmt_seq*]:\n" +" | a=compound_stmt NEWLINE { (asdl_stmt_seq*)_PyPegen_singleton_seq(p, " +"a) }\n" +" | simple_stmts\n" +" | NEWLINE { (asdl_stmt_seq*)_PyPegen_singleton_seq(p, CHECK(stmt_ty, " +"_PyAST_Pass(EXTRA))) }\n" +" | ENDMARKER { _PyPegen_interactive_exit(p) }\n" +"\n" +"simple_stmts[asdl_stmt_seq*]:\n" +" | a=simple_stmt !';' NEWLINE { (asdl_stmt_seq*)_PyPegen_singleton_seq(p, " +"a) } # Not needed, there for speedup\n" +" | a[asdl_stmt_seq*]=';'.simple_stmt+ [';'] NEWLINE { a }\n" +"\n" +"# NOTE: assignment MUST precede expression, else parsing a simple assignment\n" +"# will throw a SyntaxError.\n" +"simple_stmt[stmt_ty] (memo):\n" +" | assignment\n" +" | &\"type\" type_alias\n" +" | e=star_expressions { _PyAST_Expr(e, EXTRA) }\n" +" | &'return' return_stmt\n" +" | &('import' | 'from') import_stmt\n" +" | &'raise' raise_stmt\n" +" | 'pass' { _PyAST_Pass(EXTRA) }\n" +" | &'del' del_stmt\n" +" | &'yield' yield_stmt\n" +" | &'assert' assert_stmt\n" +" | 'break' { _PyAST_Break(EXTRA) }\n" +" | 'continue' { _PyAST_Continue(EXTRA) }\n" +" | &'global' global_stmt\n" +" | &'nonlocal' nonlocal_stmt\n" +"\n" +"compound_stmt[stmt_ty]:\n" +" | &('def' | '@' | 'async') function_def\n" +" | &'if' if_stmt\n" +" | &('class' | '@') class_def\n" +" | &('with' | 'async') with_stmt\n" +" | &('for' | 'async') for_stmt\n" +" | &'try' try_stmt\n" +" | &'while' while_stmt\n" +" | match_stmt\n" +"\n" +"# SIMPLE STATEMENTS\n" +"# =================\n" +"\n" +"# NOTE: annotated_rhs may start with 'yield'; yield_expr must start with " +"'yield'\n" +"assignment[stmt_ty]:\n" +" | a=NAME ':' b=expression c=['=' d=annotated_rhs { d }] {\n" +" CHECK_VERSION(\n" +" stmt_ty,\n" +" 6,\n" +" \"Variable annotation syntax is\",\n" +" _PyAST_AnnAssign(CHECK(expr_ty, _PyPegen_set_expr_context(p, a, " +"Store)), b, c, 1, EXTRA)\n" +" ) }\n" +" | a=('(' b=single_target ')' { b }\n" +" | single_subscript_attribute_target) ':' b=expression c=['=' " +"d=annotated_rhs { d }] {\n" +" CHECK_VERSION(stmt_ty, 6, \"Variable annotations syntax is\", " +"_PyAST_AnnAssign(a, b, c, 0, EXTRA)) }\n" +" | a[asdl_expr_seq*]=(z=star_targets '=' { z })+ b=(yield_expr | " +"star_expressions) !'=' tc=[TYPE_COMMENT] {\n" +" _PyAST_Assign(a, b, NEW_TYPE_COMMENT(p, tc), EXTRA) }\n" +" | a=single_target b=augassign ~ c=(yield_expr | star_expressions) {\n" +" _PyAST_AugAssign(a, b->kind, c, EXTRA) }\n" +" | invalid_assignment\n" +"\n" +"annotated_rhs[expr_ty]: yield_expr | star_expressions\n" +"\n" +"augassign[AugOperator*]:\n" +" | '+=' { _PyPegen_augoperator(p, Add) }\n" +" | '-=' { _PyPegen_augoperator(p, Sub) }\n" +" | '*=' { _PyPegen_augoperator(p, Mult) }\n" +" | '@=' { CHECK_VERSION(AugOperator*, 5, \"The '@' operator is\", " +"_PyPegen_augoperator(p, MatMult)) }\n" +" | '/=' { _PyPegen_augoperator(p, Div) }\n" +" | '%=' { _PyPegen_augoperator(p, Mod) }\n" +" | '&=' { _PyPegen_augoperator(p, BitAnd) }\n" +" | '|=' { _PyPegen_augoperator(p, BitOr) }\n" +" | '^=' { _PyPegen_augoperator(p, BitXor) }\n" +" | '<<=' { _PyPegen_augoperator(p, LShift) }\n" +" | '>>=' { _PyPegen_augoperator(p, RShift) }\n" +" | '**=' { _PyPegen_augoperator(p, Pow) }\n" +" | '//=' { _PyPegen_augoperator(p, FloorDiv) }\n" +"\n" +"return_stmt[stmt_ty]:\n" +" | 'return' a=[star_expressions] { _PyAST_Return(a, EXTRA) }\n" +"\n" +"raise_stmt[stmt_ty]:\n" +" | 'raise' a=expression b=['from' z=expression { z }] { _PyAST_Raise(a, b, " +"EXTRA) }\n" +" | 'raise' { _PyAST_Raise(NULL, NULL, EXTRA) }\n" +"\n" +"global_stmt[stmt_ty]: 'global' a[asdl_expr_seq*]=','.NAME+ {\n" +" _PyAST_Global(CHECK(asdl_identifier_seq*, _PyPegen_map_names_to_ids(p, " +"a)), EXTRA) }\n" +"\n" +"nonlocal_stmt[stmt_ty]: 'nonlocal' a[asdl_expr_seq*]=','.NAME+ {\n" +" _PyAST_Nonlocal(CHECK(asdl_identifier_seq*, _PyPegen_map_names_to_ids(p, " +"a)), EXTRA) }\n" +"\n" +"del_stmt[stmt_ty]:\n" +" | 'del' a=del_targets &(';' | NEWLINE) { _PyAST_Delete(a, EXTRA) }\n" +" | invalid_del_stmt\n" +"\n" +"yield_stmt[stmt_ty]: y=yield_expr { _PyAST_Expr(y, EXTRA) }\n" +"\n" +"assert_stmt[stmt_ty]: 'assert' a=expression b=[',' z=expression { z }] " +"{ _PyAST_Assert(a, b, EXTRA) }\n" +"\n" +"import_stmt[stmt_ty]:\n" +" | invalid_import\n" +" | import_name\n" +" | import_from\n" +"\n" +"# Import statements\n" +"# -----------------\n" +"\n" +"import_name[stmt_ty]: 'import' a=dotted_as_names { _PyAST_Import(a, EXTRA) }\n" +"# note below: the ('.' | '...') is necessary because '...' is tokenized as " +"ELLIPSIS\n" +"import_from[stmt_ty]:\n" +" | 'from' a=('.' | '...')* b=dotted_name 'import' c=import_from_targets {\n" +" _PyAST_ImportFrom(b->v.Name.id, c, _PyPegen_seq_count_dots(a), " +"EXTRA) }\n" +" | 'from' a=('.' | '...')+ 'import' b=import_from_targets {\n" +" _PyAST_ImportFrom(NULL, b, _PyPegen_seq_count_dots(a), EXTRA) }\n" +"import_from_targets[asdl_alias_seq*]:\n" +" | '(' a=import_from_as_names [','] ')' { a }\n" +" | import_from_as_names !','\n" +" | '*' { (asdl_alias_seq*)_PyPegen_singleton_seq(p, CHECK(alias_ty, " +"_PyPegen_alias_for_star(p, EXTRA))) }\n" +" | invalid_import_from_targets\n" +"import_from_as_names[asdl_alias_seq*]:\n" +" | a[asdl_alias_seq*]=','.import_from_as_name+ { a }\n" +"import_from_as_name[alias_ty]:\n" +" | a=NAME b=['as' z=NAME { z }] { _PyAST_alias(a->v.Name.id,\n" +" (b) ? ((expr_ty) b)-" +">v.Name.id : NULL,\n" +" EXTRA) }\n" +"dotted_as_names[asdl_alias_seq*]:\n" +" | a[asdl_alias_seq*]=','.dotted_as_name+ { a }\n" +"dotted_as_name[alias_ty]:\n" +" | a=dotted_name b=['as' z=NAME { z }] { _PyAST_alias(a->v.Name.id,\n" +" (b) ? ((expr_ty) b)-" +">v.Name.id : NULL,\n" +" EXTRA) }\n" +"dotted_name[expr_ty]:\n" +" | a=dotted_name '.' b=NAME { _PyPegen_join_names_with_dot(p, a, b) }\n" +" | NAME\n" +"\n" +"# COMPOUND STATEMENTS\n" +"# ===================\n" +"\n" +"# Common elements\n" +"# ---------------\n" +"\n" +"block[asdl_stmt_seq*] (memo):\n" +" | NEWLINE INDENT a=statements DEDENT { a }\n" +" | simple_stmts\n" +" | invalid_block\n" +"\n" +"decorators[asdl_expr_seq*]: a[asdl_expr_seq*]=('@' f=named_expression NEWLINE " +"{ f })+ { a }\n" +"\n" +"# Class definitions\n" +"# -----------------\n" +"\n" +"class_def[stmt_ty]:\n" +" | a=decorators b=class_def_raw { _PyPegen_class_def_decorators(p, a, " +"b) }\n" +" | class_def_raw\n" +"\n" +"class_def_raw[stmt_ty]:\n" +" | invalid_class_def_raw\n" +" | 'class' a=NAME t=[type_params] b=['(' z=[arguments] ')' { z }] ':' " +"c=block {\n" +" _PyAST_ClassDef(a->v.Name.id,\n" +" (b) ? ((expr_ty) b)->v.Call.args : NULL,\n" +" (b) ? ((expr_ty) b)->v.Call.keywords : NULL,\n" +" c, NULL, t, EXTRA) }\n" +"\n" +"# Function definitions\n" +"# --------------------\n" +"\n" +"function_def[stmt_ty]:\n" +" | d=decorators f=function_def_raw { _PyPegen_function_def_decorators(p, " +"d, f) }\n" +" | function_def_raw\n" +"\n" +"function_def_raw[stmt_ty]:\n" +" | invalid_def_raw\n" +" | 'def' n=NAME t=[type_params] '(' params=[params] ')' a=['->' " +"z=expression { z }] ':' tc=[func_type_comment] b=block {\n" +" _PyAST_FunctionDef(n->v.Name.id,\n" +" (params) ? params : CHECK(arguments_ty, " +"_PyPegen_empty_arguments(p)),\n" +" b, NULL, a, NEW_TYPE_COMMENT(p, tc), t, EXTRA) }\n" +" | 'async' 'def' n=NAME t=[type_params] '(' params=[params] ')' a=['->' " +"z=expression { z }] ':' tc=[func_type_comment] b=block {\n" +" CHECK_VERSION(\n" +" stmt_ty,\n" +" 5,\n" +" \"Async functions are\",\n" +" _PyAST_AsyncFunctionDef(n->v.Name.id,\n" +" (params) ? params : CHECK(arguments_ty, " +"_PyPegen_empty_arguments(p)),\n" +" b, NULL, a, NEW_TYPE_COMMENT(p, tc), t, EXTRA)\n" +" ) }\n" +"\n" +"# Function parameters\n" +"# -------------------\n" +"\n" +"params[arguments_ty]:\n" +" | invalid_parameters\n" +" | parameters\n" +"\n" +"parameters[arguments_ty]:\n" +" | a=slash_no_default b[asdl_arg_seq*]=param_no_default* " +"c=param_with_default* d=[star_etc] {\n" +" CHECK_VERSION(arguments_ty, 8, \"Positional-only parameters are\", " +"_PyPegen_make_arguments(p, a, NULL, b, c, d)) }\n" +" | a=slash_with_default b=param_with_default* c=[star_etc] {\n" +" CHECK_VERSION(arguments_ty, 8, \"Positional-only parameters are\", " +"_PyPegen_make_arguments(p, NULL, a, NULL, b, c)) }\n" +" | a[asdl_arg_seq*]=param_no_default+ b=param_with_default* c=[star_etc] " +"{\n" +" _PyPegen_make_arguments(p, NULL, NULL, a, b, c) }\n" +" | a=param_with_default+ b=[star_etc] { _PyPegen_make_arguments(p, NULL, " +"NULL, NULL, a, b)}\n" +" | a=star_etc { _PyPegen_make_arguments(p, NULL, NULL, NULL, NULL, a) }\n" +"\n" +"# Some duplication here because we can't write (',' | &')'),\n" +"# which is because we don't support empty alternatives (yet).\n" +"\n" +"slash_no_default[asdl_arg_seq*]:\n" +" | a[asdl_arg_seq*]=param_no_default+ '/' ',' { a }\n" +" | a[asdl_arg_seq*]=param_no_default+ '/' &')' { a }\n" +"slash_with_default[SlashWithDefault*]:\n" +" | a=param_no_default* b=param_with_default+ '/' ',' " +"{ _PyPegen_slash_with_default(p, (asdl_arg_seq *)a, b) }\n" +" | a=param_no_default* b=param_with_default+ '/' &')' " +"{ _PyPegen_slash_with_default(p, (asdl_arg_seq *)a, b) }\n" +"\n" +"star_etc[StarEtc*]:\n" +" | invalid_star_etc\n" +" | '*' a=param_no_default b=param_maybe_default* c=[kwds] {\n" +" _PyPegen_star_etc(p, a, b, c) }\n" +" | '*' a=param_no_default_star_annotation b=param_maybe_default* c=[kwds] " +"{\n" +" _PyPegen_star_etc(p, a, b, c) }\n" +" | '*' ',' b=param_maybe_default+ c=[kwds] {\n" +" _PyPegen_star_etc(p, NULL, b, c) }\n" +" | a=kwds { _PyPegen_star_etc(p, NULL, NULL, a) }\n" +"\n" +"kwds[arg_ty]:\n" +" | invalid_kwds\n" +" | '**' a=param_no_default { a }\n" +"\n" +"# One parameter. This *includes* a following comma and type comment.\n" +"#\n" +"# There are three styles:\n" +"# - No default\n" +"# - With default\n" +"# - Maybe with default\n" +"#\n" +"# There are two alternative forms of each, to deal with type comments:\n" +"# - Ends in a comma followed by an optional type comment\n" +"# - No comma, optional type comment, must be followed by close paren\n" +"# The latter form is for a final parameter without trailing comma.\n" +"#\n" +"\n" +"param_no_default[arg_ty]:\n" +" | a=param ',' tc=TYPE_COMMENT? { _PyPegen_add_type_comment_to_arg(p, a, " +"tc) }\n" +" | a=param tc=TYPE_COMMENT? &')' { _PyPegen_add_type_comment_to_arg(p, a, " +"tc) }\n" +"param_no_default_star_annotation[arg_ty]:\n" +" | a=param_star_annotation ',' tc=TYPE_COMMENT? " +"{ _PyPegen_add_type_comment_to_arg(p, a, tc) }\n" +" | a=param_star_annotation tc=TYPE_COMMENT? &')' " +"{ _PyPegen_add_type_comment_to_arg(p, a, tc) }\n" +"param_with_default[NameDefaultPair*]:\n" +" | a=param c=default ',' tc=TYPE_COMMENT? { _PyPegen_name_default_pair(p, " +"a, c, tc) }\n" +" | a=param c=default tc=TYPE_COMMENT? &')' { _PyPegen_name_default_pair(p, " +"a, c, tc) }\n" +"param_maybe_default[NameDefaultPair*]:\n" +" | a=param c=default? ',' tc=TYPE_COMMENT? { _PyPegen_name_default_pair(p, " +"a, c, tc) }\n" +" | a=param c=default? tc=TYPE_COMMENT? &')' " +"{ _PyPegen_name_default_pair(p, a, c, tc) }\n" +"param[arg_ty]: a=NAME b=annotation? { _PyAST_arg(a->v.Name.id, b, NULL, " +"EXTRA) }\n" +"param_star_annotation[arg_ty]: a=NAME b=star_annotation { _PyAST_arg(a-" +">v.Name.id, b, NULL, EXTRA) }\n" +"annotation[expr_ty]: ':' a=expression { a }\n" +"star_annotation[expr_ty]: ':' a=star_expression { a }\n" +"default[expr_ty]: '=' a=expression { a } | invalid_default\n" +"\n" +"# If statement\n" +"# ------------\n" +"\n" +"if_stmt[stmt_ty]:\n" +" | invalid_if_stmt\n" +" | 'if' a=named_expression ':' b=block c=elif_stmt {\n" +" _PyAST_If(a, b, CHECK(asdl_stmt_seq*, _PyPegen_singleton_seq(p, c)), " +"EXTRA) }\n" +" | 'if' a=named_expression ':' b=block c=[else_block] { _PyAST_If(a, b, c, " +"EXTRA) }\n" +"elif_stmt[stmt_ty]:\n" +" | invalid_elif_stmt\n" +" | 'elif' a=named_expression ':' b=block c=elif_stmt {\n" +" _PyAST_If(a, b, CHECK(asdl_stmt_seq*, _PyPegen_singleton_seq(p, c)), " +"EXTRA) }\n" +" | 'elif' a=named_expression ':' b=block c=[else_block] { _PyAST_If(a, b, " +"c, EXTRA) }\n" +"else_block[asdl_stmt_seq*]:\n" +" | invalid_else_stmt\n" +" | 'else' &&':' b=block { b }\n" +"\n" +"# While statement\n" +"# ---------------\n" +"\n" +"while_stmt[stmt_ty]:\n" +" | invalid_while_stmt\n" +" | 'while' a=named_expression ':' b=block c=[else_block] { _PyAST_While(a, " +"b, c, EXTRA) }\n" +"\n" +"# For statement\n" +"# -------------\n" +"\n" +"for_stmt[stmt_ty]:\n" +" | invalid_for_stmt\n" +" | 'for' t=star_targets 'in' ~ ex=star_expressions ':' tc=[TYPE_COMMENT] " +"b=block el=[else_block] {\n" +" _PyAST_For(t, ex, b, el, NEW_TYPE_COMMENT(p, tc), EXTRA) }\n" +" | 'async' 'for' t=star_targets 'in' ~ ex=star_expressions ':' " +"tc=[TYPE_COMMENT] b=block el=[else_block] {\n" +" CHECK_VERSION(stmt_ty, 5, \"Async for loops are\", _PyAST_AsyncFor(t, " +"ex, b, el, NEW_TYPE_COMMENT(p, tc), EXTRA)) }\n" +" | invalid_for_target\n" +"\n" +"# With statement\n" +"# --------------\n" +"\n" +"with_stmt[stmt_ty]:\n" +" | invalid_with_stmt_indent\n" +" | 'with' '(' a[asdl_withitem_seq*]=','.with_item+ ','? ')' ':' " +"tc=[TYPE_COMMENT] b=block {\n" +" _PyAST_With(a, b, NEW_TYPE_COMMENT(p, tc), EXTRA) }\n" +" | 'with' a[asdl_withitem_seq*]=','.with_item+ ':' tc=[TYPE_COMMENT] " +"b=block {\n" +" _PyAST_With(a, b, NEW_TYPE_COMMENT(p, tc), EXTRA) }\n" +" | 'async' 'with' '(' a[asdl_withitem_seq*]=','.with_item+ ','? ')' ':' " +"b=block {\n" +" CHECK_VERSION(stmt_ty, 5, \"Async with statements are\", " +"_PyAST_AsyncWith(a, b, NULL, EXTRA)) }\n" +" | 'async' 'with' a[asdl_withitem_seq*]=','.with_item+ ':' " +"tc=[TYPE_COMMENT] b=block {\n" +" CHECK_VERSION(stmt_ty, 5, \"Async with statements are\", " +"_PyAST_AsyncWith(a, b, NEW_TYPE_COMMENT(p, tc), EXTRA)) }\n" +" | invalid_with_stmt\n" +"\n" +"with_item[withitem_ty]:\n" +" | e=expression 'as' t=star_target &(',' | ')' | ':') { _PyAST_withitem(e, " +"t, p->arena) }\n" +" | invalid_with_item\n" +" | e=expression { _PyAST_withitem(e, NULL, p->arena) }\n" +"\n" +"# Try statement\n" +"# -------------\n" +"\n" +"try_stmt[stmt_ty]:\n" +" | invalid_try_stmt\n" +" | 'try' &&':' b=block f=finally_block { _PyAST_Try(b, NULL, NULL, f, " +"EXTRA) }\n" +" | 'try' &&':' b=block ex[asdl_excepthandler_seq*]=except_block+ " +"el=[else_block] f=[finally_block] { _PyAST_Try(b, ex, el, f, EXTRA) }\n" +" | 'try' &&':' b=block ex[asdl_excepthandler_seq*]=except_star_block+ " +"el=[else_block] f=[finally_block] {\n" +" CHECK_VERSION(stmt_ty, 11, \"Exception groups are\",\n" +" _PyAST_TryStar(b, ex, el, f, EXTRA)) }\n" +"\n" +"\n" +"# Except statement\n" +"# ----------------\n" +"\n" +"except_block[excepthandler_ty]:\n" +" | invalid_except_stmt_indent\n" +" | 'except' e=expression t=['as' z=NAME { z }] ':' b=block {\n" +" _PyAST_ExceptHandler(e, (t) ? ((expr_ty) t)->v.Name.id : NULL, b, " +"EXTRA) }\n" +" | 'except' ':' b=block { _PyAST_ExceptHandler(NULL, NULL, b, EXTRA) }\n" +" | invalid_except_stmt\n" +"except_star_block[excepthandler_ty]:\n" +" | invalid_except_star_stmt_indent\n" +" | 'except' '*' e=expression t=['as' z=NAME { z }] ':' b=block {\n" +" _PyAST_ExceptHandler(e, (t) ? ((expr_ty) t)->v.Name.id : NULL, b, " +"EXTRA) }\n" +" | invalid_except_stmt\n" +"finally_block[asdl_stmt_seq*]:\n" +" | invalid_finally_stmt\n" +" | 'finally' &&':' a=block { a }\n" +"\n" +"# Match statement\n" +"# ---------------\n" +"\n" +"match_stmt[stmt_ty]:\n" +" | \"match\" subject=subject_expr ':' NEWLINE INDENT " +"cases[asdl_match_case_seq*]=case_block+ DEDENT {\n" +" CHECK_VERSION(stmt_ty, 10, \"Pattern matching is\", " +"_PyAST_Match(subject, cases, EXTRA)) }\n" +" | invalid_match_stmt\n" +"\n" +"subject_expr[expr_ty]:\n" +" | value=star_named_expression ',' values=star_named_expressions? {\n" +" _PyAST_Tuple(CHECK(asdl_expr_seq*, _PyPegen_seq_insert_in_front(p, " +"value, values)), Load, EXTRA) }\n" +" | named_expression\n" +"\n" +"case_block[match_case_ty]:\n" +" | invalid_case_block\n" +" | \"case\" pattern=patterns guard=guard? ':' body=block {\n" +" _PyAST_match_case(pattern, guard, body, p->arena) }\n" +"\n" +"guard[expr_ty]: 'if' guard=named_expression { guard }\n" +"\n" +"patterns[pattern_ty]:\n" +" | patterns[asdl_pattern_seq*]=open_sequence_pattern {\n" +" _PyAST_MatchSequence(patterns, EXTRA) }\n" +" | pattern\n" +"\n" +"pattern[pattern_ty]:\n" +" | as_pattern\n" +" | or_pattern\n" +"\n" +"as_pattern[pattern_ty]:\n" +" | pattern=or_pattern 'as' target=pattern_capture_target {\n" +" _PyAST_MatchAs(pattern, target->v.Name.id, EXTRA) }\n" +" | invalid_as_pattern\n" +"\n" +"or_pattern[pattern_ty]:\n" +" | patterns[asdl_pattern_seq*]='|'.closed_pattern+ {\n" +" asdl_seq_LEN(patterns) == 1 ? asdl_seq_GET(patterns, 0) : " +"_PyAST_MatchOr(patterns, EXTRA) }\n" +"\n" +"closed_pattern[pattern_ty] (memo):\n" +" | literal_pattern\n" +" | capture_pattern\n" +" | wildcard_pattern\n" +" | value_pattern\n" +" | group_pattern\n" +" | sequence_pattern\n" +" | mapping_pattern\n" +" | class_pattern\n" +"\n" +"# Literal patterns are used for equality and identity constraints\n" +"literal_pattern[pattern_ty]:\n" +" | value=signed_number !('+' | '-') { _PyAST_MatchValue(value, EXTRA) }\n" +" | value=complex_number { _PyAST_MatchValue(value, EXTRA) }\n" +" | value=strings { _PyAST_MatchValue(value, EXTRA) }\n" +" | 'None' { _PyAST_MatchSingleton(Py_None, EXTRA) }\n" +" | 'True' { _PyAST_MatchSingleton(Py_True, EXTRA) }\n" +" | 'False' { _PyAST_MatchSingleton(Py_False, EXTRA) }\n" +"\n" +"# Literal expressions are used to restrict permitted mapping pattern keys\n" +"literal_expr[expr_ty]:\n" +" | signed_number !('+' | '-')\n" +" | complex_number\n" +" | strings\n" +" | 'None' { _PyAST_Constant(Py_None, NULL, EXTRA) }\n" +" | 'True' { _PyAST_Constant(Py_True, NULL, EXTRA) }\n" +" | 'False' { _PyAST_Constant(Py_False, NULL, EXTRA) }\n" +"\n" +"complex_number[expr_ty]:\n" +" | real=signed_real_number '+' imag=imaginary_number {\n" +" _PyAST_BinOp(real, Add, imag, EXTRA) }\n" +" | real=signed_real_number '-' imag=imaginary_number {\n" +" _PyAST_BinOp(real, Sub, imag, EXTRA) }\n" +"\n" +"signed_number[expr_ty]:\n" +" | NUMBER\n" +" | '-' number=NUMBER { _PyAST_UnaryOp(USub, number, EXTRA) }\n" +"\n" +"signed_real_number[expr_ty]:\n" +" | real_number\n" +" | '-' real=real_number { _PyAST_UnaryOp(USub, real, EXTRA) }\n" +"\n" +"real_number[expr_ty]:\n" +" | real=NUMBER { _PyPegen_ensure_real(p, real) }\n" +"\n" +"imaginary_number[expr_ty]:\n" +" | imag=NUMBER { _PyPegen_ensure_imaginary(p, imag) }\n" +"\n" +"capture_pattern[pattern_ty]:\n" +" | target=pattern_capture_target { _PyAST_MatchAs(NULL, target->v.Name.id, " +"EXTRA) }\n" +"\n" +"pattern_capture_target[expr_ty]:\n" +" | !\"_\" name=NAME !('.' | '(' | '=') {\n" +" _PyPegen_set_expr_context(p, name, Store) }\n" +"\n" +"wildcard_pattern[pattern_ty]:\n" +" | \"_\" { _PyAST_MatchAs(NULL, NULL, EXTRA) }\n" +"\n" +"value_pattern[pattern_ty]:\n" +" | attr=attr !('.' | '(' | '=') { _PyAST_MatchValue(attr, EXTRA) }\n" +"\n" +"attr[expr_ty]:\n" +" | value=name_or_attr '.' attr=NAME {\n" +" _PyAST_Attribute(value, attr->v.Name.id, Load, EXTRA) }\n" +"\n" +"name_or_attr[expr_ty]:\n" +" | attr\n" +" | NAME\n" +"\n" +"group_pattern[pattern_ty]:\n" +" | '(' pattern=pattern ')' { pattern }\n" +"\n" +"sequence_pattern[pattern_ty]:\n" +" | '[' patterns=maybe_sequence_pattern? ']' " +"{ _PyAST_MatchSequence(patterns, EXTRA) }\n" +" | '(' patterns=open_sequence_pattern? ')' " +"{ _PyAST_MatchSequence(patterns, EXTRA) }\n" +"\n" +"open_sequence_pattern[asdl_seq*]:\n" +" | pattern=maybe_star_pattern ',' patterns=maybe_sequence_pattern? {\n" +" _PyPegen_seq_insert_in_front(p, pattern, patterns) }\n" +"\n" +"maybe_sequence_pattern[asdl_seq*]:\n" +" | patterns=','.maybe_star_pattern+ ','? { patterns }\n" +"\n" +"maybe_star_pattern[pattern_ty]:\n" +" | star_pattern\n" +" | pattern\n" +"\n" +"star_pattern[pattern_ty] (memo):\n" +" | '*' target=pattern_capture_target {\n" +" _PyAST_MatchStar(target->v.Name.id, EXTRA) }\n" +" | '*' wildcard_pattern {\n" +" _PyAST_MatchStar(NULL, EXTRA) }\n" +"\n" +"mapping_pattern[pattern_ty]:\n" +" | '{' '}' {\n" +" _PyAST_MatchMapping(NULL, NULL, NULL, EXTRA) }\n" +" | '{' rest=double_star_pattern ','? '}' {\n" +" _PyAST_MatchMapping(NULL, NULL, rest->v.Name.id, EXTRA) }\n" +" | '{' items=items_pattern ',' rest=double_star_pattern ','? '}' {\n" +" _PyAST_MatchMapping(\n" +" CHECK(asdl_expr_seq*, _PyPegen_get_pattern_keys(p, items)),\n" +" CHECK(asdl_pattern_seq*, _PyPegen_get_patterns(p, items)),\n" +" rest->v.Name.id,\n" +" EXTRA) }\n" +" | '{' items=items_pattern ','? '}' {\n" +" _PyAST_MatchMapping(\n" +" CHECK(asdl_expr_seq*, _PyPegen_get_pattern_keys(p, items)),\n" +" CHECK(asdl_pattern_seq*, _PyPegen_get_patterns(p, items)),\n" +" NULL,\n" +" EXTRA) }\n" +"\n" +"items_pattern[asdl_seq*]:\n" +" | ','.key_value_pattern+\n" +"\n" +"key_value_pattern[KeyPatternPair*]:\n" +" | key=(literal_expr | attr) ':' pattern=pattern {\n" +" _PyPegen_key_pattern_pair(p, key, pattern) }\n" +"\n" +"double_star_pattern[expr_ty]:\n" +" | '**' target=pattern_capture_target { target }\n" +"\n" +"class_pattern[pattern_ty]:\n" +" | cls=name_or_attr '(' ')' {\n" +" _PyAST_MatchClass(cls, NULL, NULL, NULL, EXTRA) }\n" +" | cls=name_or_attr '(' patterns=positional_patterns ','? ')' {\n" +" _PyAST_MatchClass(cls, patterns, NULL, NULL, EXTRA) }\n" +" | cls=name_or_attr '(' keywords=keyword_patterns ','? ')' {\n" +" _PyAST_MatchClass(\n" +" cls, NULL,\n" +" CHECK(asdl_identifier_seq*, _PyPegen_map_names_to_ids(p,\n" +" CHECK(asdl_expr_seq*, _PyPegen_get_pattern_keys(p, " +"keywords)))),\n" +" CHECK(asdl_pattern_seq*, _PyPegen_get_patterns(p, keywords)),\n" +" EXTRA) }\n" +" | cls=name_or_attr '(' patterns=positional_patterns ',' " +"keywords=keyword_patterns ','? ')' {\n" +" _PyAST_MatchClass(\n" +" cls,\n" +" patterns,\n" +" CHECK(asdl_identifier_seq*, _PyPegen_map_names_to_ids(p,\n" +" CHECK(asdl_expr_seq*, _PyPegen_get_pattern_keys(p, " +"keywords)))),\n" +" CHECK(asdl_pattern_seq*, _PyPegen_get_patterns(p, keywords)),\n" +" EXTRA) }\n" +" | invalid_class_pattern\n" +"\n" +"positional_patterns[asdl_pattern_seq*]:\n" +" | args[asdl_pattern_seq*]=','.pattern+ { args }\n" +"\n" +"keyword_patterns[asdl_seq*]:\n" +" | ','.keyword_pattern+\n" +"\n" +"keyword_pattern[KeyPatternPair*]:\n" +" | arg=NAME '=' value=pattern { _PyPegen_key_pattern_pair(p, arg, " +"value) }\n" +"\n" +"# Type statement\n" +"# ---------------\n" +"\n" +"type_alias[stmt_ty]:\n" +" | \"type\" n=NAME t=[type_params] '=' b=expression {\n" +" CHECK_VERSION(stmt_ty, 12, \"Type statement is\",\n" +" _PyAST_TypeAlias(CHECK(expr_ty, _PyPegen_set_expr_context(p, n, " +"Store)), t, b, EXTRA)) }\n" +"\n" +"# Type parameter declaration\n" +"# --------------------------\n" +"\n" +"type_params[asdl_type_param_seq*]: \n" +" | invalid_type_params\n" +" | '[' t=type_param_seq ']' {\n" +" CHECK_VERSION(asdl_type_param_seq *, 12, \"Type parameter lists " +"are\", t) }\n" +"\n" +"type_param_seq[asdl_type_param_seq*]: a[asdl_type_param_seq*]=','.type_param+ " +"[','] { a }\n" +"\n" +"type_param[type_param_ty] (memo):\n" +" | a=NAME b=[type_param_bound] c=[type_param_default] { _PyAST_TypeVar(a-" +">v.Name.id, b, c, EXTRA) }\n" +" | '*' a=NAME colon=':' e=expression {\n" +" RAISE_SYNTAX_ERROR_STARTING_FROM(colon, e->kind == Tuple_kind\n" +" ? \"cannot use constraints with TypeVarTuple\"\n" +" : \"cannot use bound with TypeVarTuple\")\n" +" }\n" +" | '*' a=NAME b=[type_param_starred_default] { _PyAST_TypeVarTuple(a-" +">v.Name.id, b, EXTRA) }\n" +" | '**' a=NAME colon=':' e=expression {\n" +" RAISE_SYNTAX_ERROR_STARTING_FROM(colon, e->kind == Tuple_kind\n" +" ? \"cannot use constraints with ParamSpec\"\n" +" : \"cannot use bound with ParamSpec\")\n" +" }\n" +" | '**' a=NAME b=[type_param_default] { _PyAST_ParamSpec(a->v.Name.id, b, " +"EXTRA) }\n" +"\n" +"type_param_bound[expr_ty]: ':' e=expression { e }\n" +"type_param_default[expr_ty]: '=' e=expression {\n" +" CHECK_VERSION(expr_ty, 13, \"Type parameter defaults are\", e) }\n" +"type_param_starred_default[expr_ty]: '=' e=star_expression {\n" +" CHECK_VERSION(expr_ty, 13, \"Type parameter defaults are\", e) }\n" +"\n" +"# EXPRESSIONS\n" +"# -----------\n" +"\n" +"expressions[expr_ty]:\n" +" | a=expression b=(',' c=expression { c })+ [','] {\n" +" _PyAST_Tuple(CHECK(asdl_expr_seq*, _PyPegen_seq_insert_in_front(p, a, " +"b)), Load, EXTRA) }\n" +" | a=expression ',' { _PyAST_Tuple(CHECK(asdl_expr_seq*, " +"_PyPegen_singleton_seq(p, a)), Load, EXTRA) }\n" +" | expression\n" +"\n" +"expression[expr_ty] (memo):\n" +" | invalid_expression\n" +" | invalid_legacy_expression\n" +" | a=disjunction 'if' b=disjunction 'else' c=expression { _PyAST_IfExp(b, " +"a, c, EXTRA) }\n" +" | disjunction\n" +" | lambdef\n" +"\n" +"yield_expr[expr_ty]:\n" +" | 'yield' 'from' a=expression { _PyAST_YieldFrom(a, EXTRA) }\n" +" | 'yield' a=[star_expressions] { _PyAST_Yield(a, EXTRA) }\n" +"\n" +"star_expressions[expr_ty]:\n" +" | a=star_expression b=(',' c=star_expression { c })+ [','] {\n" +" _PyAST_Tuple(CHECK(asdl_expr_seq*, _PyPegen_seq_insert_in_front(p, a, " +"b)), Load, EXTRA) }\n" +" | a=star_expression ',' { _PyAST_Tuple(CHECK(asdl_expr_seq*, " +"_PyPegen_singleton_seq(p, a)), Load, EXTRA) }\n" +" | star_expression\n" +"\n" +"star_expression[expr_ty] (memo):\n" +" | '*' a=bitwise_or { _PyAST_Starred(a, Load, EXTRA) }\n" +" | expression\n" +"\n" +"star_named_expressions[asdl_expr_seq*]: " +"a[asdl_expr_seq*]=','.star_named_expression+ [','] { a }\n" +"\n" +"star_named_expression[expr_ty]:\n" +" | '*' a=bitwise_or { _PyAST_Starred(a, Load, EXTRA) }\n" +" | named_expression\n" +"\n" +"assignment_expression[expr_ty]:\n" +" | a=NAME ':=' ~ b=expression {\n" +" CHECK_VERSION(expr_ty, 8, \"Assignment expressions are\",\n" +" _PyAST_NamedExpr(CHECK(expr_ty, _PyPegen_set_expr_context(p, a, " +"Store)), b, EXTRA)) }\n" +"\n" +"named_expression[expr_ty]:\n" +" | assignment_expression\n" +" | invalid_named_expression\n" +" | expression !':='\n" +"\n" +"disjunction[expr_ty] (memo):\n" +" | a=conjunction b=('or' c=conjunction { c })+ { _PyAST_BoolOp(\n" +" Or,\n" +" CHECK(asdl_expr_seq*, _PyPegen_seq_insert_in_front(p, a, b)),\n" +" EXTRA) }\n" +" | conjunction\n" +"\n" +"conjunction[expr_ty] (memo):\n" +" | a=inversion b=('and' c=inversion { c })+ { _PyAST_BoolOp(\n" +" And,\n" +" CHECK(asdl_expr_seq*, _PyPegen_seq_insert_in_front(p, a, b)),\n" +" EXTRA) }\n" +" | inversion\n" +"\n" +"inversion[expr_ty] (memo):\n" +" | 'not' a=inversion { _PyAST_UnaryOp(Not, a, EXTRA) }\n" +" | comparison\n" +"\n" +"# Comparison operators\n" +"# --------------------\n" +"\n" +"comparison[expr_ty]:\n" +" | a=bitwise_or b=compare_op_bitwise_or_pair+ {\n" +" _PyAST_Compare(\n" +" a,\n" +" CHECK(asdl_int_seq*, _PyPegen_get_cmpops(p, b)),\n" +" CHECK(asdl_expr_seq*, _PyPegen_get_exprs(p, b)),\n" +" EXTRA) }\n" +" | bitwise_or\n" +"\n" +"compare_op_bitwise_or_pair[CmpopExprPair*]:\n" +" | eq_bitwise_or\n" +" | noteq_bitwise_or\n" +" | lte_bitwise_or\n" +" | lt_bitwise_or\n" +" | gte_bitwise_or\n" +" | gt_bitwise_or\n" +" | notin_bitwise_or\n" +" | in_bitwise_or\n" +" | isnot_bitwise_or\n" +" | is_bitwise_or\n" +"\n" +"eq_bitwise_or[CmpopExprPair*]: '==' a=bitwise_or " +"{ _PyPegen_cmpop_expr_pair(p, Eq, a) }\n" +"noteq_bitwise_or[CmpopExprPair*]:\n" +" | (tok='!=' { _PyPegen_check_barry_as_flufl(p, tok) ? NULL : tok}) " +"a=bitwise_or {_PyPegen_cmpop_expr_pair(p, NotEq, a) }\n" +"lte_bitwise_or[CmpopExprPair*]: '<=' a=bitwise_or " +"{ _PyPegen_cmpop_expr_pair(p, LtE, a) }\n" +"lt_bitwise_or[CmpopExprPair*]: '<' a=bitwise_or { _PyPegen_cmpop_expr_pair(p, " +"Lt, a) }\n" +"gte_bitwise_or[CmpopExprPair*]: '>=' a=bitwise_or " +"{ _PyPegen_cmpop_expr_pair(p, GtE, a) }\n" +"gt_bitwise_or[CmpopExprPair*]: '>' a=bitwise_or { _PyPegen_cmpop_expr_pair(p, " +"Gt, a) }\n" +"notin_bitwise_or[CmpopExprPair*]: 'not' 'in' a=bitwise_or " +"{ _PyPegen_cmpop_expr_pair(p, NotIn, a) }\n" +"in_bitwise_or[CmpopExprPair*]: 'in' a=bitwise_or " +"{ _PyPegen_cmpop_expr_pair(p, In, a) }\n" +"isnot_bitwise_or[CmpopExprPair*]: 'is' 'not' a=bitwise_or " +"{ _PyPegen_cmpop_expr_pair(p, IsNot, a) }\n" +"is_bitwise_or[CmpopExprPair*]: 'is' a=bitwise_or " +"{ _PyPegen_cmpop_expr_pair(p, Is, a) }\n" +"\n" +"# Bitwise operators\n" +"# -----------------\n" +"\n" +"bitwise_or[expr_ty]:\n" +" | a=bitwise_or '|' b=bitwise_xor { _PyAST_BinOp(a, BitOr, b, EXTRA) }\n" +" | bitwise_xor\n" +"\n" +"bitwise_xor[expr_ty]:\n" +" | a=bitwise_xor '^' b=bitwise_and { _PyAST_BinOp(a, BitXor, b, EXTRA) }\n" +" | bitwise_and\n" +"\n" +"bitwise_and[expr_ty]:\n" +" | a=bitwise_and '&' b=shift_expr { _PyAST_BinOp(a, BitAnd, b, EXTRA) }\n" +" | shift_expr\n" +"\n" +"shift_expr[expr_ty]:\n" +" | a=shift_expr '<<' b=sum { _PyAST_BinOp(a, LShift, b, EXTRA) }\n" +" | a=shift_expr '>>' b=sum { _PyAST_BinOp(a, RShift, b, EXTRA) }\n" +" | invalid_arithmetic\n" +" | sum\n" +"\n" +"# Arithmetic operators\n" +"# --------------------\n" +"\n" +"sum[expr_ty]:\n" +" | a=sum '+' b=term { _PyAST_BinOp(a, Add, b, EXTRA) }\n" +" | a=sum '-' b=term { _PyAST_BinOp(a, Sub, b, EXTRA) }\n" +" | term\n" +"\n" +"term[expr_ty]:\n" +" | a=term '*' b=factor { _PyAST_BinOp(a, Mult, b, EXTRA) }\n" +" | a=term '/' b=factor { _PyAST_BinOp(a, Div, b, EXTRA) }\n" +" | a=term '//' b=factor { _PyAST_BinOp(a, FloorDiv, b, EXTRA) }\n" +" | a=term '%' b=factor { _PyAST_BinOp(a, Mod, b, EXTRA) }\n" +" | a=term '@' b=factor { CHECK_VERSION(expr_ty, 5, \"The '@' operator " +"is\", _PyAST_BinOp(a, MatMult, b, EXTRA)) }\n" +" | invalid_factor\n" +" | factor\n" +"\n" +"factor[expr_ty] (memo):\n" +" | '+' a=factor { _PyAST_UnaryOp(UAdd, a, EXTRA) }\n" +" | '-' a=factor { _PyAST_UnaryOp(USub, a, EXTRA) }\n" +" | '~' a=factor { _PyAST_UnaryOp(Invert, a, EXTRA) }\n" +" | power\n" +"\n" +"power[expr_ty]:\n" +" | a=await_primary '**' b=factor { _PyAST_BinOp(a, Pow, b, EXTRA) }\n" +" | await_primary\n" +"\n" +"# Primary elements\n" +"# ----------------\n" +"\n" +"# Primary elements are things like \"obj.something.something\", " +"\"obj[something]\", \"obj(something)\", \"obj\" ...\n" +"\n" +"await_primary[expr_ty] (memo):\n" +" | 'await' a=primary { CHECK_VERSION(expr_ty, 5, \"Await expressions " +"are\", _PyAST_Await(a, EXTRA)) }\n" +" | primary\n" +"\n" +"primary[expr_ty]:\n" +" | a=primary '.' b=NAME { _PyAST_Attribute(a, b->v.Name.id, Load, " +"EXTRA) }\n" +" | a=primary b=genexp { _PyAST_Call(a, CHECK(asdl_expr_seq*, " +"(asdl_expr_seq*)_PyPegen_singleton_seq(p, b)), NULL, EXTRA) }\n" +" | a=primary '(' b=[arguments] ')' {\n" +" _PyAST_Call(a,\n" +" (b) ? ((expr_ty) b)->v.Call.args : NULL,\n" +" (b) ? ((expr_ty) b)->v.Call.keywords : NULL,\n" +" EXTRA) }\n" +" | a=primary '[' b=slices ']' { _PyAST_Subscript(a, b, Load, EXTRA) }\n" +" | atom\n" +"\n" +"slices[expr_ty]:\n" +" | a=slice !',' { a }\n" +" | a[asdl_expr_seq*]=','.(slice | starred_expression)+ [','] " +"{ _PyAST_Tuple(a, Load, EXTRA) }\n" +"\n" +"slice[expr_ty]:\n" +" | a=[expression] ':' b=[expression] c=[':' d=[expression] { d }] " +"{ _PyAST_Slice(a, b, c, EXTRA) }\n" +" | a=named_expression { a }\n" +"\n" +"atom[expr_ty]:\n" +" | NAME\n" +" | 'True' { _PyAST_Constant(Py_True, NULL, EXTRA) }\n" +" | 'False' { _PyAST_Constant(Py_False, NULL, EXTRA) }\n" +" | 'None' { _PyAST_Constant(Py_None, NULL, EXTRA) }\n" +" | &(STRING|FSTRING_START) strings\n" +" | NUMBER\n" +" | &'(' (tuple | group | genexp)\n" +" | &'[' (list | listcomp)\n" +" | &'{' (dict | set | dictcomp | setcomp)\n" +" | '...' { _PyAST_Constant(Py_Ellipsis, NULL, EXTRA) }\n" +"\n" +"group[expr_ty]:\n" +" | '(' a=(yield_expr | named_expression) ')' { a }\n" +" | invalid_group\n" +"\n" +"# Lambda functions\n" +"# ----------------\n" +"\n" +"lambdef[expr_ty]:\n" +" | 'lambda' a=[lambda_params] ':' b=expression {\n" +" _PyAST_Lambda((a) ? a : CHECK(arguments_ty, " +"_PyPegen_empty_arguments(p)), b, EXTRA) }\n" +"\n" +"lambda_params[arguments_ty]:\n" +" | invalid_lambda_parameters\n" +" | lambda_parameters\n" +"\n" +"# lambda_parameters etc. duplicates parameters but without annotations\n" +"# or type comments, and if there's no comma after a parameter, we expect\n" +"# a colon, not a close parenthesis. (For more, see parameters above.)\n" +"#\n" +"lambda_parameters[arguments_ty]:\n" +" | a=lambda_slash_no_default b[asdl_arg_seq*]=lambda_param_no_default* " +"c=lambda_param_with_default* d=[lambda_star_etc] {\n" +" CHECK_VERSION(arguments_ty, 8, \"Positional-only parameters are\", " +"_PyPegen_make_arguments(p, a, NULL, b, c, d)) }\n" +" | a=lambda_slash_with_default b=lambda_param_with_default* " +"c=[lambda_star_etc] {\n" +" CHECK_VERSION(arguments_ty, 8, \"Positional-only parameters are\", " +"_PyPegen_make_arguments(p, NULL, a, NULL, b, c)) }\n" +" | a[asdl_arg_seq*]=lambda_param_no_default+ b=lambda_param_with_default* " +"c=[lambda_star_etc] {\n" +" _PyPegen_make_arguments(p, NULL, NULL, a, b, c) }\n" +" | a=lambda_param_with_default+ b=[lambda_star_etc] " +"{ _PyPegen_make_arguments(p, NULL, NULL, NULL, a, b)}\n" +" | a=lambda_star_etc { _PyPegen_make_arguments(p, NULL, NULL, NULL, NULL, " +"a) }\n" +"\n" +"lambda_slash_no_default[asdl_arg_seq*]:\n" +" | a[asdl_arg_seq*]=lambda_param_no_default+ '/' ',' { a }\n" +" | a[asdl_arg_seq*]=lambda_param_no_default+ '/' &':' { a }\n" +"\n" +"lambda_slash_with_default[SlashWithDefault*]:\n" +" | a=lambda_param_no_default* b=lambda_param_with_default+ '/' ',' " +"{ _PyPegen_slash_with_default(p, (asdl_arg_seq *)a, b) }\n" +" | a=lambda_param_no_default* b=lambda_param_with_default+ '/' &':' " +"{ _PyPegen_slash_with_default(p, (asdl_arg_seq *)a, b) }\n" +"\n" +"lambda_star_etc[StarEtc*]:\n" +" | invalid_lambda_star_etc\n" +" | '*' a=lambda_param_no_default b=lambda_param_maybe_default* " +"c=[lambda_kwds] {\n" +" _PyPegen_star_etc(p, a, b, c) }\n" +" | '*' ',' b=lambda_param_maybe_default+ c=[lambda_kwds] {\n" +" _PyPegen_star_etc(p, NULL, b, c) }\n" +" | a=lambda_kwds { _PyPegen_star_etc(p, NULL, NULL, a) }\n" +"\n" +"lambda_kwds[arg_ty]:\n" +" | invalid_lambda_kwds\n" +" | '**' a=lambda_param_no_default { a }\n" +"\n" +"lambda_param_no_default[arg_ty]:\n" +" | a=lambda_param ',' { a }\n" +" | a=lambda_param &':' { a }\n" +"lambda_param_with_default[NameDefaultPair*]:\n" +" | a=lambda_param c=default ',' { _PyPegen_name_default_pair(p, a, c, " +"NULL) }\n" +" | a=lambda_param c=default &':' { _PyPegen_name_default_pair(p, a, c, " +"NULL) }\n" +"lambda_param_maybe_default[NameDefaultPair*]:\n" +" | a=lambda_param c=default? ',' { _PyPegen_name_default_pair(p, a, c, " +"NULL) }\n" +" | a=lambda_param c=default? &':' { _PyPegen_name_default_pair(p, a, c, " +"NULL) }\n" +"lambda_param[arg_ty]: a=NAME { _PyAST_arg(a->v.Name.id, NULL, NULL, EXTRA) }\n" +"\n" +"# LITERALS\n" +"# ========\n" +"\n" +"fstring_middle[expr_ty]:\n" +" | fstring_replacement_field\n" +" | t=FSTRING_MIDDLE { _PyPegen_constant_from_token(p, t) }\n" +"fstring_replacement_field[expr_ty]:\n" +" | '{' a=annotated_rhs debug_expr='='? conversion=[fstring_conversion] " +"format=[fstring_full_format_spec] rbrace='}' {\n" +" _PyPegen_formatted_value(p, a, debug_expr, conversion, format, " +"rbrace, EXTRA) }\n" +" | invalid_replacement_field\n" +"fstring_conversion[ResultTokenWithMetadata*]:\n" +" | conv_token=\"!\" conv=NAME { _PyPegen_check_fstring_conversion(p, " +"conv_token, conv) }\n" +"fstring_full_format_spec[ResultTokenWithMetadata*]:\n" +" | colon=':' spec=fstring_format_spec* " +"{ _PyPegen_setup_full_format_spec(p, colon, (asdl_expr_seq *) spec, EXTRA) }\n" +"fstring_format_spec[expr_ty]:\n" +" | t=FSTRING_MIDDLE { _PyPegen_decoded_constant_from_token(p, t) }\n" +" | fstring_replacement_field\n" +"fstring[expr_ty]:\n" +" | a=FSTRING_START b=fstring_middle* c=FSTRING_END " +"{ _PyPegen_joined_str(p, a, (asdl_expr_seq*)b, c) }\n" +"\n" +"string[expr_ty]: s[Token*]=STRING { _PyPegen_constant_from_string(p, s) }\n" +"strings[expr_ty] (memo): a[asdl_expr_seq*]=(fstring|string)+ " +"{ _PyPegen_concatenate_strings(p, a, EXTRA) }\n" +"\n" +"list[expr_ty]:\n" +" | '[' a=[star_named_expressions] ']' { _PyAST_List(a, Load, EXTRA) }\n" +"\n" +"tuple[expr_ty]:\n" +" | '(' a=[y=star_named_expression ',' z=[star_named_expressions] " +"{ _PyPegen_seq_insert_in_front(p, y, z) } ] ')' {\n" +" _PyAST_Tuple(a, Load, EXTRA) }\n" +"\n" +"set[expr_ty]: '{' a=star_named_expressions '}' { _PyAST_Set(a, EXTRA) }\n" +"\n" +"# Dicts\n" +"# -----\n" +"\n" +"dict[expr_ty]:\n" +" | '{' a=[double_starred_kvpairs] '}' {\n" +" _PyAST_Dict(\n" +" CHECK(asdl_expr_seq*, _PyPegen_get_keys(p, a)),\n" +" CHECK(asdl_expr_seq*, _PyPegen_get_values(p, a)),\n" +" EXTRA) }\n" +" | '{' invalid_double_starred_kvpairs '}'\n" +"\n" +"double_starred_kvpairs[asdl_seq*]: a=','.double_starred_kvpair+ [','] { a }\n" +"\n" +"double_starred_kvpair[KeyValuePair*]:\n" +" | '**' a=bitwise_or { _PyPegen_key_value_pair(p, NULL, a) }\n" +" | kvpair\n" +"\n" +"kvpair[KeyValuePair*]: a=expression ':' b=expression " +"{ _PyPegen_key_value_pair(p, a, b) }\n" +"\n" +"# Comprehensions & Generators\n" +"# ---------------------------\n" +"\n" +"for_if_clauses[asdl_comprehension_seq*]:\n" +" | a[asdl_comprehension_seq*]=for_if_clause+ { a }\n" +"\n" +"for_if_clause[comprehension_ty]:\n" +" | 'async' 'for' a=star_targets 'in' ~ b=disjunction " +"c[asdl_expr_seq*]=('if' z=disjunction { z })* {\n" +" CHECK_VERSION(comprehension_ty, 6, \"Async comprehensions are\", " +"_PyAST_comprehension(a, b, c, 1, p->arena)) }\n" +" | 'for' a=star_targets 'in' ~ b=disjunction c[asdl_expr_seq*]=('if' " +"z=disjunction { z })* {\n" +" _PyAST_comprehension(a, b, c, 0, p->arena) }\n" +" | 'async'? 'for' (bitwise_or (',' bitwise_or)* [',']) !'in' {\n" +" RAISE_SYNTAX_ERROR(\"'in' expected after for-loop variables\") }\n" +" | invalid_for_target\n" +"\n" +"listcomp[expr_ty]:\n" +" | '[' a=named_expression b=for_if_clauses ']' { _PyAST_ListComp(a, b, " +"EXTRA) }\n" +" | invalid_comprehension\n" +"\n" +"setcomp[expr_ty]:\n" +" | '{' a=named_expression b=for_if_clauses '}' { _PyAST_SetComp(a, b, " +"EXTRA) }\n" +" | invalid_comprehension\n" +"\n" +"genexp[expr_ty]:\n" +" | '(' a=( assignment_expression | expression !':=') b=for_if_clauses ')' " +"{ _PyAST_GeneratorExp(a, b, EXTRA) }\n" +" | invalid_comprehension\n" +"\n" +"dictcomp[expr_ty]:\n" +" | '{' a=kvpair b=for_if_clauses '}' { _PyAST_DictComp(a->key, a->value, " +"b, EXTRA) }\n" +" | invalid_dict_comprehension\n" +"\n" +"# FUNCTION CALL ARGUMENTS\n" +"# =======================\n" +"\n" +"arguments[expr_ty] (memo):\n" +" | a=args [','] &')' { a }\n" +" | invalid_arguments\n" +"\n" +"args[expr_ty]:\n" +" | a[asdl_expr_seq*]=','.(starred_expression | ( assignment_expression | " +"expression !':=') !'=')+ b=[',' k=kwargs {k}] {\n" +" _PyPegen_collect_call_seqs(p, a, b, EXTRA) }\n" +" | a=kwargs { _PyAST_Call(_PyPegen_dummy_name(p),\n" +" CHECK_NULL_ALLOWED(asdl_expr_seq*, " +"_PyPegen_seq_extract_starred_exprs(p, a)),\n" +" CHECK_NULL_ALLOWED(asdl_keyword_seq*, " +"_PyPegen_seq_delete_starred_exprs(p, a)),\n" +" EXTRA) }\n" +"\n" +"kwargs[asdl_seq*]:\n" +" | a=','.kwarg_or_starred+ ',' b=','.kwarg_or_double_starred+ " +"{ _PyPegen_join_sequences(p, a, b) }\n" +" | ','.kwarg_or_starred+\n" +" | ','.kwarg_or_double_starred+\n" +"\n" +"starred_expression[expr_ty]:\n" +" | invalid_starred_expression\n" +" | '*' a=expression { _PyAST_Starred(a, Load, EXTRA) }\n" +" | '*' { RAISE_SYNTAX_ERROR(\"Invalid star expression\") }\n" +"\n" +"kwarg_or_starred[KeywordOrStarred*]:\n" +" | invalid_kwarg\n" +" | a=NAME '=' b=expression {\n" +" _PyPegen_keyword_or_starred(p, CHECK(keyword_ty, _PyAST_keyword(a-" +">v.Name.id, b, EXTRA)), 1) }\n" +" | a=starred_expression { _PyPegen_keyword_or_starred(p, a, 0) }\n" +"\n" +"kwarg_or_double_starred[KeywordOrStarred*]:\n" +" | invalid_kwarg\n" +" | a=NAME '=' b=expression {\n" +" _PyPegen_keyword_or_starred(p, CHECK(keyword_ty, _PyAST_keyword(a-" +">v.Name.id, b, EXTRA)), 1) }\n" +" | '**' a=expression { _PyPegen_keyword_or_starred(p, CHECK(keyword_ty, " +"_PyAST_keyword(NULL, a, EXTRA)), 1) }\n" +"\n" +"# ASSIGNMENT TARGETS\n" +"# ==================\n" +"\n" +"# Generic targets\n" +"# ---------------\n" +"\n" +"# NOTE: star_targets may contain *bitwise_or, targets may not.\n" +"star_targets[expr_ty]:\n" +" | a=star_target !',' { a }\n" +" | a=star_target b=(',' c=star_target { c })* [','] {\n" +" _PyAST_Tuple(CHECK(asdl_expr_seq*, _PyPegen_seq_insert_in_front(p, a, " +"b)), Store, EXTRA) }\n" +"\n" +"star_targets_list_seq[asdl_expr_seq*]: a[asdl_expr_seq*]=','.star_target+ " +"[','] { a }\n" +"\n" +"star_targets_tuple_seq[asdl_expr_seq*]:\n" +" | a=star_target b=(',' c=star_target { c })+ [','] { (asdl_expr_seq*) " +"_PyPegen_seq_insert_in_front(p, a, b) }\n" +" | a=star_target ',' { (asdl_expr_seq*) _PyPegen_singleton_seq(p, a) }\n" +"\n" +"star_target[expr_ty] (memo):\n" +" | '*' a=(!'*' star_target) {\n" +" _PyAST_Starred(CHECK(expr_ty, _PyPegen_set_expr_context(p, a, " +"Store)), Store, EXTRA) }\n" +" | target_with_star_atom\n" +"\n" +"target_with_star_atom[expr_ty] (memo):\n" +" | a=t_primary '.' b=NAME !t_lookahead { _PyAST_Attribute(a, b->v.Name.id, " +"Store, EXTRA) }\n" +" | a=t_primary '[' b=slices ']' !t_lookahead { _PyAST_Subscript(a, b, " +"Store, EXTRA) }\n" +" | star_atom\n" +"\n" +"star_atom[expr_ty]:\n" +" | a=NAME { _PyPegen_set_expr_context(p, a, Store) }\n" +" | '(' a=target_with_star_atom ')' { _PyPegen_set_expr_context(p, a, " +"Store) }\n" +" | '(' a=[star_targets_tuple_seq] ')' { _PyAST_Tuple(a, Store, EXTRA) }\n" +" | '[' a=[star_targets_list_seq] ']' { _PyAST_List(a, Store, EXTRA) }\n" +"\n" +"single_target[expr_ty]:\n" +" | single_subscript_attribute_target\n" +" | a=NAME { _PyPegen_set_expr_context(p, a, Store) }\n" +" | '(' a=single_target ')' { a }\n" +"\n" +"single_subscript_attribute_target[expr_ty]:\n" +" | a=t_primary '.' b=NAME !t_lookahead { _PyAST_Attribute(a, b->v.Name.id, " +"Store, EXTRA) }\n" +" | a=t_primary '[' b=slices ']' !t_lookahead { _PyAST_Subscript(a, b, " +"Store, EXTRA) }\n" +"\n" +"t_primary[expr_ty]:\n" +" | a=t_primary '.' b=NAME &t_lookahead { _PyAST_Attribute(a, b->v.Name.id, " +"Load, EXTRA) }\n" +" | a=t_primary '[' b=slices ']' &t_lookahead { _PyAST_Subscript(a, b, " +"Load, EXTRA) }\n" +" | a=t_primary b=genexp &t_lookahead {\n" +" _PyAST_Call(a, CHECK(asdl_expr_seq*, " +"(asdl_expr_seq*)_PyPegen_singleton_seq(p, b)), NULL, EXTRA) }\n" +" | a=t_primary '(' b=[arguments] ')' &t_lookahead {\n" +" _PyAST_Call(a,\n" +" (b) ? ((expr_ty) b)->v.Call.args : NULL,\n" +" (b) ? ((expr_ty) b)->v.Call.keywords : NULL,\n" +" EXTRA) }\n" +" | a=atom &t_lookahead { a }\n" +"\n" +"t_lookahead: '(' | '[' | '.'\n" +"\n" +"# Targets for del statements\n" +"# --------------------------\n" +"\n" +"del_targets[asdl_expr_seq*]: a[asdl_expr_seq*]=','.del_target+ [','] { a }\n" +"\n" +"del_target[expr_ty] (memo):\n" +" | a=t_primary '.' b=NAME !t_lookahead { _PyAST_Attribute(a, b->v.Name.id, " +"Del, EXTRA) }\n" +" | a=t_primary '[' b=slices ']' !t_lookahead { _PyAST_Subscript(a, b, Del, " +"EXTRA) }\n" +" | del_t_atom\n" +"\n" +"del_t_atom[expr_ty]:\n" +" | a=NAME { _PyPegen_set_expr_context(p, a, Del) }\n" +" | '(' a=del_target ')' { _PyPegen_set_expr_context(p, a, Del) }\n" +" | '(' a=[del_targets] ')' { _PyAST_Tuple(a, Del, EXTRA) }\n" +" | '[' a=[del_targets] ']' { _PyAST_List(a, Del, EXTRA) }\n" +"\n" +"# TYPING ELEMENTS\n" +"# ---------------\n" +"\n" +"# type_expressions allow */** but ignore them\n" +"type_expressions[asdl_expr_seq*]:\n" +" | a=','.expression+ ',' '*' b=expression ',' '**' c=expression {\n" +" (asdl_expr_seq*)_PyPegen_seq_append_to_end(\n" +" p,\n" +" CHECK(asdl_seq*, _PyPegen_seq_append_to_end(p, a, b)),\n" +" c) }\n" +" | a=','.expression+ ',' '*' b=expression " +"{ (asdl_expr_seq*)_PyPegen_seq_append_to_end(p, a, b) }\n" +" | a=','.expression+ ',' '**' b=expression " +"{ (asdl_expr_seq*)_PyPegen_seq_append_to_end(p, a, b) }\n" +" | '*' a=expression ',' '**' b=expression {\n" +" (asdl_expr_seq*)_PyPegen_seq_append_to_end(\n" +" p,\n" +" CHECK(asdl_seq*, _PyPegen_singleton_seq(p, a)),\n" +" b) }\n" +" | '*' a=expression { (asdl_expr_seq*)_PyPegen_singleton_seq(p, a) }\n" +" | '**' a=expression { (asdl_expr_seq*)_PyPegen_singleton_seq(p, a) }\n" +" | a[asdl_expr_seq*]=','.expression+ {a}\n" +"\n" +"func_type_comment[Token*]:\n" +" | NEWLINE t=TYPE_COMMENT &(NEWLINE INDENT) { t } # Must be followed by " +"indented block\n" +" | invalid_double_type_comments\n" +" | TYPE_COMMENT\n" +"\n" +"# ========================= END OF THE GRAMMAR ===========================\n" +"\n" +"\n" +"\n" +"# ========================= START OF INVALID RULES =======================\n" +"\n" +"# From here on, there are rules for invalid syntax with specialised error " +"messages\n" +"invalid_arguments:\n" +" | ((','.(starred_expression | ( assignment_expression | " +"expression !':=') !'=')+ ',' kwargs) | kwargs) a=',' ','." +"(starred_expression !'=')+ {\n" +" RAISE_SYNTAX_ERROR_STARTING_FROM(a, \"iterable argument unpacking " +"follows keyword argument unpacking\") }\n" +" | a=expression b=for_if_clauses ',' [args | expression for_if_clauses] {\n" +" RAISE_SYNTAX_ERROR_KNOWN_RANGE(a, " +"_PyPegen_get_last_comprehension_item(PyPegen_last_item(b, comprehension_ty)), " +"\"Generator expression must be parenthesized\") }\n" +" | a=NAME b='=' expression for_if_clauses {\n" +" RAISE_SYNTAX_ERROR_KNOWN_RANGE(a, b, \"invalid syntax. Maybe you " +"meant '==' or ':=' instead of '='?\")}\n" +" | (args ',')? a=NAME b='=' &(',' | ')') {\n" +" RAISE_SYNTAX_ERROR_KNOWN_RANGE(a, b, \"expected argument value " +"expression\")}\n" +" | a=args b=for_if_clauses { _PyPegen_nonparen_genexp_in_call(p, a, b) }\n" +" | args ',' a=expression b=for_if_clauses {\n" +" RAISE_SYNTAX_ERROR_KNOWN_RANGE(a, " +"_PyPegen_get_last_comprehension_item(PyPegen_last_item(b, comprehension_ty)), " +"\"Generator expression must be parenthesized\") }\n" +" | a=args ',' args { _PyPegen_arguments_parsing_error(p, a) }\n" +"invalid_kwarg:\n" +" | a[Token*]=('True'|'False'|'None') b='=' {\n" +" RAISE_SYNTAX_ERROR_KNOWN_RANGE(a, b, \"cannot assign to %s\", " +"PyBytes_AS_STRING(a->bytes)) }\n" +" | a=NAME b='=' expression for_if_clauses {\n" +" RAISE_SYNTAX_ERROR_KNOWN_RANGE(a, b, \"invalid syntax. Maybe you " +"meant '==' or ':=' instead of '='?\")}\n" +" | !(NAME '=') a=expression b='=' {\n" +" RAISE_SYNTAX_ERROR_KNOWN_RANGE(\n" +" a, b, \"expression cannot contain assignment, perhaps you meant \\" +"\"==\\\"?\") }\n" +" | a='**' expression '=' b=expression {\n" +" RAISE_SYNTAX_ERROR_KNOWN_RANGE(a, b, \"cannot assign to keyword " +"argument unpacking\") }\n" +"\n" +"# IMPORTANT: Note that the \"_without_invalid\" suffix causes the rule to not " +"call invalid rules under it\n" +"expression_without_invalid[expr_ty]:\n" +" | a=disjunction 'if' b=disjunction 'else' c=expression { _PyAST_IfExp(b, " +"a, c, EXTRA) }\n" +" | disjunction\n" +" | lambdef\n" +"invalid_legacy_expression:\n" +" | a=NAME !'(' b=star_expressions {\n" +" _PyPegen_check_legacy_stmt(p, a) ? RAISE_SYNTAX_ERROR_KNOWN_RANGE(a, " +"b,\n" +" \"Missing parentheses in call to '%U'. Did you mean %U(...)?\", a-" +">v.Name.id, a->v.Name.id) : NULL}\n" +"\n" +"invalid_expression:\n" +" # !(NAME STRING) is not matched so we don't show this error with some " +"invalid string prefixes like: kf\"dsfsdf\"\n" +" # Soft keywords need to also be ignored because they can be parsed as " +"NAME NAME\n" +" | !(NAME STRING | SOFT_KEYWORD) a=disjunction b=expression_without_invalid " +"{\n" +" _PyPegen_check_legacy_stmt(p, a) ? NULL : p->tokens[p->mark-1]->level " +"== 0 ? NULL :\n" +" RAISE_SYNTAX_ERROR_KNOWN_RANGE(a, b, \"invalid syntax. Perhaps you " +"forgot a comma?\") }\n" +" | a=disjunction 'if' b=disjunction !('else'|':') " +"{ RAISE_SYNTAX_ERROR_KNOWN_RANGE(a, b, \"expected 'else' after 'if' " +"expression\") }\n" +" | a='lambda' [lambda_params] b=':' &FSTRING_MIDDLE {\n" +" RAISE_SYNTAX_ERROR_KNOWN_RANGE(a, b, \"f-string: lambda expressions " +"are not allowed without parentheses\") }\n" +"\n" +"invalid_named_expression(memo):\n" +" | a=expression ':=' expression {\n" +" RAISE_SYNTAX_ERROR_KNOWN_LOCATION(\n" +" a, \"cannot use assignment expressions with %s\", " +"_PyPegen_get_expr_name(a)) }\n" +" | a=NAME '=' b=bitwise_or !('='|':=') {\n" +" RAISE_SYNTAX_ERROR_KNOWN_RANGE(a, b, \"invalid syntax. Maybe you " +"meant '==' or ':=' instead of '='?\") }\n" +" | !(list|tuple|genexp|'True'|'None'|'False') a=bitwise_or b='=' " +"bitwise_or !('='|':=') {\n" +" RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"cannot assign to %s here. " +"Maybe you meant '==' instead of '='?\",\n" +" _PyPegen_get_expr_name(a)) }\n" +"\n" +"invalid_assignment:\n" +" | a=invalid_ann_assign_target ':' expression {\n" +" RAISE_SYNTAX_ERROR_KNOWN_LOCATION(\n" +" a,\n" +" \"only single target (not %s) can be annotated\",\n" +" _PyPegen_get_expr_name(a)\n" +" )}\n" +" | a=star_named_expression ',' star_named_expressions* ':' expression {\n" +" RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"only single target (not tuple) " +"can be annotated\") }\n" +" | a=expression ':' expression {\n" +" RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"illegal target for " +"annotation\") }\n" +" | (star_targets '=')* a=star_expressions '=' {\n" +" RAISE_SYNTAX_ERROR_INVALID_TARGET(STAR_TARGETS, a) }\n" +" | (star_targets '=')* a=yield_expr '=' " +"{ RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"assignment to yield expression not " +"possible\") }\n" +" | a=star_expressions augassign annotated_rhs {\n" +" RAISE_SYNTAX_ERROR_KNOWN_LOCATION(\n" +" a,\n" +" \"'%s' is an illegal expression for augmented assignment\",\n" +" _PyPegen_get_expr_name(a)\n" +" )}\n" +"invalid_ann_assign_target[expr_ty]:\n" +" | list\n" +" | tuple\n" +" | '(' a=invalid_ann_assign_target ')' { a }\n" +"invalid_del_stmt:\n" +" | 'del' a=star_expressions {\n" +" RAISE_SYNTAX_ERROR_INVALID_TARGET(DEL_TARGETS, a) }\n" +"invalid_block:\n" +" | NEWLINE !INDENT { RAISE_INDENTATION_ERROR(\"expected an indented " +"block\") }\n" +"invalid_comprehension:\n" +" | ('[' | '(' | '{') a=starred_expression for_if_clauses {\n" +" RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"iterable unpacking cannot be " +"used in comprehension\") }\n" +" | ('[' | '{') a=star_named_expression ',' b=star_named_expressions " +"for_if_clauses {\n" +" RAISE_SYNTAX_ERROR_KNOWN_RANGE(a, PyPegen_last_item(b, expr_ty),\n" +" \"did you forget parentheses around the comprehension target?\") }\n" +" | ('[' | '{') a=star_named_expression b=',' for_if_clauses {\n" +" RAISE_SYNTAX_ERROR_KNOWN_RANGE(a, b, \"did you forget parentheses " +"around the comprehension target?\") }\n" +"invalid_dict_comprehension:\n" +" | '{' a='**' bitwise_or for_if_clauses '}' {\n" +" RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"dict unpacking cannot be used " +"in dict comprehension\") }\n" +"invalid_parameters:\n" +" | a=\"/\" ',' {\n" +" RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"at least one argument must " +"precede /\") }\n" +" | (slash_no_default | slash_with_default) param_maybe_default* a='/' {\n" +" RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"/ may appear only once\") }\n" +" | slash_no_default? param_no_default* invalid_parameters_helper " +"a=param_no_default {\n" +" RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"parameter without a default " +"follows parameter with a default\") }\n" +" | param_no_default* a='(' param_no_default+ ','? b=')' {\n" +" RAISE_SYNTAX_ERROR_KNOWN_RANGE(a, b, \"Function parameters cannot be " +"parenthesized\") }\n" +" | (slash_no_default | slash_with_default)? param_maybe_default* '*' (',' " +"| param_no_default) param_maybe_default* a='/' {\n" +" RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"/ must be ahead of *\") }\n" +" | param_maybe_default+ '/' a='*' {\n" +" RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"expected comma between / and " +"*\") }\n" +"invalid_default:\n" +" | a='=' &(')'|',') { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"expected " +"default value expression\") }\n" +"invalid_star_etc:\n" +" | a='*' (')' | ',' (')' | '**')) { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, " +"\"named arguments must follow bare *\") }\n" +" | '*' ',' TYPE_COMMENT { RAISE_SYNTAX_ERROR(\"bare * has associated type " +"comment\") }\n" +" | '*' param a='=' { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"var-positional " +"argument cannot have default value\") }\n" +" | '*' (param_no_default | ',') param_maybe_default* a='*' " +"(param_no_default | ',') {\n" +" RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"* argument may appear only " +"once\") }\n" +"invalid_kwds:\n" +" | '**' param a='=' { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"var-keyword " +"argument cannot have default value\") }\n" +" | '**' param ',' a=param { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, " +"\"arguments cannot follow var-keyword argument\") }\n" +" | '**' param ',' a[Token*]=('*'|'**'|'/') " +"{ RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"arguments cannot follow var-keyword " +"argument\") }\n" +"invalid_parameters_helper: # This is only there to avoid type errors\n" +" | a=slash_with_default { _PyPegen_singleton_seq(p, a) }\n" +" | param_with_default+\n" +"invalid_lambda_parameters:\n" +" | a=\"/\" ',' {\n" +" RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"at least one argument must " +"precede /\") }\n" +" | (lambda_slash_no_default | lambda_slash_with_default) " +"lambda_param_maybe_default* a='/' {\n" +" RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"/ may appear only once\") }\n" +" | lambda_slash_no_default? lambda_param_no_default* " +"invalid_lambda_parameters_helper a=lambda_param_no_default {\n" +" RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"parameter without a default " +"follows parameter with a default\") }\n" +" | lambda_param_no_default* a='(' ','.lambda_param+ ','? b=')' {\n" +" RAISE_SYNTAX_ERROR_KNOWN_RANGE(a, b, \"Lambda expression parameters " +"cannot be parenthesized\") }\n" +" | (lambda_slash_no_default | lambda_slash_with_default)? " +"lambda_param_maybe_default* '*' (',' | lambda_param_no_default) " +"lambda_param_maybe_default* a='/' {\n" +" RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"/ must be ahead of *\") }\n" +" | lambda_param_maybe_default+ '/' a='*' {\n" +" RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"expected comma between / and " +"*\") }\n" +"invalid_lambda_parameters_helper:\n" +" | a=lambda_slash_with_default { _PyPegen_singleton_seq(p, a) }\n" +" | lambda_param_with_default+\n" +"invalid_lambda_star_etc:\n" +" | '*' (':' | ',' (':' | '**')) { RAISE_SYNTAX_ERROR(\"named arguments " +"must follow bare *\") }\n" +" | '*' lambda_param a='=' { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"var-" +"positional argument cannot have default value\") }\n" +" | '*' (lambda_param_no_default | ',') lambda_param_maybe_default* a='*' " +"(lambda_param_no_default | ',') {\n" +" RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"* argument may appear only " +"once\") }\n" +"invalid_lambda_kwds:\n" +" | '**' lambda_param a='=' { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"var-" +"keyword argument cannot have default value\") }\n" +" | '**' lambda_param ',' a=lambda_param " +"{ RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"arguments cannot follow var-keyword " +"argument\") }\n" +" | '**' lambda_param ',' a[Token*]=('*'|'**'|'/') " +"{ RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"arguments cannot follow var-keyword " +"argument\") }\n" +"invalid_double_type_comments:\n" +" | TYPE_COMMENT NEWLINE TYPE_COMMENT NEWLINE INDENT {\n" +" RAISE_SYNTAX_ERROR(\"Cannot have two type comments on def\") }\n" +"invalid_with_item:\n" +" | expression 'as' a=expression &(',' | ')' | ':') {\n" +" RAISE_SYNTAX_ERROR_INVALID_TARGET(STAR_TARGETS, a) }\n" +"\n" +"invalid_for_target:\n" +" | 'async'? 'for' a=star_expressions {\n" +" RAISE_SYNTAX_ERROR_INVALID_TARGET(FOR_TARGETS, a) }\n" +"\n" +"invalid_group:\n" +" | '(' a=starred_expression ')' {\n" +" RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"cannot use starred expression " +"here\") }\n" +" | '(' a='**' expression ')' {\n" +" RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"cannot use double starred " +"expression here\") }\n" +"invalid_import:\n" +" | a='import' ','.dotted_name+ 'from' dotted_name {\n" +" RAISE_SYNTAX_ERROR_STARTING_FROM(a, \"Did you mean to use 'from ... " +"import ...' instead?\") }\n" +" | 'import' token=NEWLINE { \n" +" RAISE_SYNTAX_ERROR_STARTING_FROM(token, \"Expected one or more names " +"after 'import'\") }\n" +"\n" +"invalid_import_from_targets:\n" +" | import_from_as_names ',' NEWLINE {\n" +" RAISE_SYNTAX_ERROR(\"trailing comma not allowed without surrounding " +"parentheses\") }\n" +" | token=NEWLINE { \n" +" RAISE_SYNTAX_ERROR_STARTING_FROM(token, \"Expected one or more names " +"after 'import'\") }\n" +"\n" +"invalid_with_stmt:\n" +" | ['async'] 'with' ','.(expression ['as' star_target])+ NEWLINE " +"{ RAISE_SYNTAX_ERROR(\"expected ':'\") }\n" +" | ['async'] 'with' '(' ','.(expressions ['as' star_target])+ ','? ')' " +"NEWLINE { RAISE_SYNTAX_ERROR(\"expected ':'\") }\n" +"invalid_with_stmt_indent:\n" +" | ['async'] a='with' ','.(expression ['as' star_target])+ ':' NEWLINE !" +"INDENT {\n" +" RAISE_INDENTATION_ERROR(\"expected an indented block after 'with' " +"statement on line %d\", a->lineno) }\n" +" | ['async'] a='with' '(' ','.(expressions ['as' star_target])+ ','? ')' " +"':' NEWLINE !INDENT {\n" +" RAISE_INDENTATION_ERROR(\"expected an indented block after 'with' " +"statement on line %d\", a->lineno) }\n" +"\n" +"invalid_try_stmt:\n" +" | a='try' ':' NEWLINE !INDENT {\n" +" RAISE_INDENTATION_ERROR(\"expected an indented block after 'try' " +"statement on line %d\", a->lineno) }\n" +" | 'try' ':' block !('except' | 'finally') { RAISE_SYNTAX_ERROR(\"expected " +"'except' or 'finally' block\") }\n" +" | 'try' ':' block* except_block+ a='except' b='*' expression ['as' NAME] " +"':' {\n" +" RAISE_SYNTAX_ERROR_KNOWN_RANGE(a, b, \"cannot have both 'except' and " +"'except*' on the same 'try'\") }\n" +" | 'try' ':' block* except_star_block+ a='except' [expression ['as' NAME]] " +"':' {\n" +" RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"cannot have both 'except' and " +"'except*' on the same 'try'\") }\n" +"invalid_except_stmt:\n" +" | 'except' '*'? a=expression ',' expressions ['as' NAME ] ':' {\n" +" RAISE_SYNTAX_ERROR_STARTING_FROM(a, \"multiple exception types must " +"be parenthesized\") }\n" +" | a='except' '*'? expression ['as' NAME ] NEWLINE " +"{ RAISE_SYNTAX_ERROR(\"expected ':'\") }\n" +" | a='except' NEWLINE { RAISE_SYNTAX_ERROR(\"expected ':'\") }\n" +" | a='except' '*' (NEWLINE | ':') { RAISE_SYNTAX_ERROR(\"expected one or " +"more exception types\") }\n" +"invalid_finally_stmt:\n" +" | a='finally' ':' NEWLINE !INDENT {\n" +" RAISE_INDENTATION_ERROR(\"expected an indented block after 'finally' " +"statement on line %d\", a->lineno) }\n" +"invalid_except_stmt_indent:\n" +" | a='except' expression ['as' NAME ] ':' NEWLINE !INDENT {\n" +" RAISE_INDENTATION_ERROR(\"expected an indented block after 'except' " +"statement on line %d\", a->lineno) }\n" +" | a='except' ':' NEWLINE !INDENT { RAISE_INDENTATION_ERROR(\"expected an " +"indented block after 'except' statement on line %d\", a->lineno) }\n" +"invalid_except_star_stmt_indent:\n" +" | a='except' '*' expression ['as' NAME ] ':' NEWLINE !INDENT {\n" +" RAISE_INDENTATION_ERROR(\"expected an indented block after 'except*' " +"statement on line %d\", a->lineno) }\n" +"invalid_match_stmt:\n" +" | \"match\" subject_expr NEWLINE { CHECK_VERSION(void*, 10, \"Pattern " +"matching is\", RAISE_SYNTAX_ERROR(\"expected ':'\") ) }\n" +" | a=\"match\" subject=subject_expr ':' NEWLINE !INDENT {\n" +" RAISE_INDENTATION_ERROR(\"expected an indented block after 'match' " +"statement on line %d\", a->lineno) }\n" +"invalid_case_block:\n" +" | \"case\" patterns guard? NEWLINE { RAISE_SYNTAX_ERROR(\"expected " +"':'\") }\n" +" | a=\"case\" patterns guard? ':' NEWLINE !INDENT {\n" +" RAISE_INDENTATION_ERROR(\"expected an indented block after 'case' " +"statement on line %d\", a->lineno) }\n" +"invalid_as_pattern:\n" +" | or_pattern 'as' a=\"_\" { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"cannot " +"use '_' as a target\") }\n" +" | or_pattern 'as' !NAME a=expression " +"{ RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"invalid pattern target\") }\n" +"invalid_class_pattern:\n" +" | name_or_attr '(' a=invalid_class_argument_pattern " +"{ RAISE_SYNTAX_ERROR_KNOWN_RANGE(\n" +" PyPegen_first_item(a, pattern_ty),\n" +" PyPegen_last_item(a, pattern_ty),\n" +" \"positional patterns follow keyword patterns\") }\n" +"invalid_class_argument_pattern[asdl_pattern_seq*]:\n" +" | [positional_patterns ','] keyword_patterns ',' a=positional_patterns " +"{ a }\n" +"invalid_if_stmt:\n" +" | 'if' named_expression NEWLINE { RAISE_SYNTAX_ERROR(\"expected ':'\") }\n" +" | a='if' a=named_expression ':' NEWLINE !INDENT {\n" +" RAISE_INDENTATION_ERROR(\"expected an indented block after 'if' " +"statement on line %d\", a->lineno) }\n" +"invalid_elif_stmt:\n" +" | 'elif' named_expression NEWLINE { RAISE_SYNTAX_ERROR(\"expected " +"':'\") }\n" +" | a='elif' named_expression ':' NEWLINE !INDENT {\n" +" RAISE_INDENTATION_ERROR(\"expected an indented block after 'elif' " +"statement on line %d\", a->lineno) }\n" +"invalid_else_stmt:\n" +" | a='else' ':' NEWLINE !INDENT {\n" +" RAISE_INDENTATION_ERROR(\"expected an indented block after 'else' " +"statement on line %d\", a->lineno) }\n" +"invalid_while_stmt:\n" +" | 'while' named_expression NEWLINE { RAISE_SYNTAX_ERROR(\"expected " +"':'\") }\n" +" | a='while' named_expression ':' NEWLINE !INDENT {\n" +" RAISE_INDENTATION_ERROR(\"expected an indented block after 'while' " +"statement on line %d\", a->lineno) }\n" +"invalid_for_stmt:\n" +" | ['async'] 'for' star_targets 'in' star_expressions NEWLINE " +"{ RAISE_SYNTAX_ERROR(\"expected ':'\") }\n" +" | ['async'] a='for' star_targets 'in' star_expressions ':' NEWLINE !" +"INDENT {\n" +" RAISE_INDENTATION_ERROR(\"expected an indented block after 'for' " +"statement on line %d\", a->lineno) }\n" +"invalid_def_raw:\n" +" | ['async'] a='def' NAME [type_params] '(' [params] ')' ['->' expression] " +"':' NEWLINE !INDENT {\n" +" RAISE_INDENTATION_ERROR(\"expected an indented block after function " +"definition on line %d\", a->lineno) }\n" +" | ['async'] 'def' NAME [type_params] &&'(' [params] ')' ['->' expression] " +"&&':' [func_type_comment] block\n" +"invalid_class_def_raw:\n" +" | 'class' NAME [type_params] ['(' [arguments] ')'] NEWLINE " +"{ RAISE_SYNTAX_ERROR(\"expected ':'\") }\n" +" | a='class' NAME [type_params] ['(' [arguments] ')'] ':' NEWLINE !INDENT " +"{\n" +" RAISE_INDENTATION_ERROR(\"expected an indented block after class " +"definition on line %d\", a->lineno) }\n" +"\n" +"invalid_double_starred_kvpairs:\n" +" | ','.double_starred_kvpair+ ',' invalid_kvpair\n" +" | expression ':' a='*' bitwise_or { RAISE_SYNTAX_ERROR_STARTING_FROM(a, " +"\"cannot use a starred expression in a dictionary value\") }\n" +" | expression a=':' &('}'|',') { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, " +"\"expression expected after dictionary key and ':'\") }\n" +"invalid_kvpair:\n" +" | a=expression !(':') {\n" +" RAISE_ERROR_KNOWN_LOCATION(p, PyExc_SyntaxError, a->lineno, a-" +">end_col_offset - 1, a->end_lineno, -1, \"':' expected after dictionary " +"key\") }\n" +" | expression ':' a='*' bitwise_or { RAISE_SYNTAX_ERROR_STARTING_FROM(a, " +"\"cannot use a starred expression in a dictionary value\") }\n" +" | expression a=':' &('}'|',') {RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, " +"\"expression expected after dictionary key and ':'\") }\n" +"invalid_starred_expression:\n" +" | a='*' expression '=' b=expression { RAISE_SYNTAX_ERROR_KNOWN_RANGE(a, " +"b, \"cannot assign to iterable argument unpacking\") }\n" +"\n" +"invalid_replacement_field:\n" +" | '{' a='=' { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"f-string: valid " +"expression required before '='\") }\n" +" | '{' a='!' { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"f-string: valid " +"expression required before '!'\") }\n" +" | '{' a=':' { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"f-string: valid " +"expression required before ':'\") }\n" +" | '{' a='}' { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"f-string: valid " +"expression required before '}'\") }\n" +" | '{' !annotated_rhs { RAISE_SYNTAX_ERROR_ON_NEXT_TOKEN(\"f-string: " +"expecting a valid expression after '{'\")}\n" +" | '{' annotated_rhs !('=' | '!' | ':' | '}') {\n" +" PyErr_Occurred() ? NULL : RAISE_SYNTAX_ERROR_ON_NEXT_TOKEN(\"f-" +"string: expecting '=', or '!', or ':', or '}'\") }\n" +" | '{' annotated_rhs '=' !('!' | ':' | '}') {\n" +" PyErr_Occurred() ? NULL : RAISE_SYNTAX_ERROR_ON_NEXT_TOKEN(\"f-" +"string: expecting '!', or ':', or '}'\") }\n" +" | '{' annotated_rhs '='? invalid_conversion_character\n" +" | '{' annotated_rhs '='? ['!' NAME] !(':' | '}') {\n" +" PyErr_Occurred() ? NULL : RAISE_SYNTAX_ERROR_ON_NEXT_TOKEN(\"f-" +"string: expecting ':' or '}'\") }\n" +" | '{' annotated_rhs '='? ['!' NAME] ':' fstring_format_spec* !'}' {\n" +" PyErr_Occurred() ? NULL : RAISE_SYNTAX_ERROR_ON_NEXT_TOKEN(\"f-" +"string: expecting '}', or format specs\") }\n" +" | '{' annotated_rhs '='? ['!' NAME] !'}' {\n" +" PyErr_Occurred() ? NULL : RAISE_SYNTAX_ERROR_ON_NEXT_TOKEN(\"f-" +"string: expecting '}'\") }\n" +"\n" +"invalid_conversion_character:\n" +" | '!' &(':' | '}') { RAISE_SYNTAX_ERROR_ON_NEXT_TOKEN(\"f-string: missing " +"conversion character\") }\n" +" | '!' !NAME { RAISE_SYNTAX_ERROR_ON_NEXT_TOKEN(\"f-string: invalid " +"conversion character\") }\n" +"\n" +"invalid_arithmetic:\n" +" | sum ('+'|'-'|'*'|'/'|'%'|'//'|'@') a='not' b=inversion " +"{ RAISE_SYNTAX_ERROR_KNOWN_RANGE(a, b, \"'not' after an operator must be " +"parenthesized\") }\n" +"invalid_factor:\n" +" | ('+' | '-' | '~') a='not' b=factor { RAISE_SYNTAX_ERROR_KNOWN_RANGE(a, " +"b, \"'not' after an operator must be parenthesized\") }\n" +"\n" +"invalid_type_params:\n" +" | '[' token=']' {\n" +" RAISE_SYNTAX_ERROR_STARTING_FROM(\n" +" token, \n" +" \"Type parameter list cannot be empty\")}\n" From 0b1a073819dfc3fd9166741b28757e6edcd1f2f5 Mon Sep 17 00:00:00 2001 From: Carlos Mena <50986837+carlosm00@users.noreply.github.com> Date: Tue, 6 Jan 2026 16:43:40 +0100 Subject: [PATCH 09/10] =?UTF-8?q?Traducci=C3=B3n=20reference/expressions.p?= =?UTF-8?q?o=20(#3419)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes #3287 --- dictionaries/_base.txt | 1 + reference/expressions.po | 581 +++++++++++++++++++++------------------ 2 files changed, 321 insertions(+), 261 deletions(-) diff --git a/dictionaries/_base.txt b/dictionaries/_base.txt index b60c7f9046..dd8c582056 100644 --- a/dictionaries/_base.txt +++ b/dictionaries/_base.txt @@ -6,6 +6,7 @@ Adam Addison Adler Adviértase +agen Ahlstrom aleatoriamente aleatorizar diff --git a/reference/expressions.po b/reference/expressions.po index f760b2a0bc..894a740223 100644 --- a/reference/expressions.po +++ b/reference/expressions.po @@ -11,15 +11,16 @@ msgstr "" "Project-Id-Version: Python 3.8\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-11-21 16:38-0300\n" -"PO-Revision-Date: 2024-01-21 17:49+0100\n" -"Last-Translator: Cristián Maureira-Fredes \n" -"Language: es\n" +"PO-Revision-Date: 2025-10-24 18:37+0200\n" +"Last-Translator: Carlos Mena Pérez <@carlosm00>\n" "Language-Team: python-doc-es\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"Language: es\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" "Generated-By: Babel 2.16.0\n" +"X-Generator: Poedit 3.7\n" #: ../Doc/reference/expressions.rst:6 msgid "Expressions" @@ -73,12 +74,11 @@ msgstr "" "a complejo;" #: ../Doc/reference/expressions.rst:36 -#, fuzzy msgid "" "otherwise, if either argument is a floating-point number, the other is " "converted to floating point;" msgstr "" -"de otra forma, si cualquier de los argumentos es un número de punto " +"de otra forma, si cualquiera de los argumentos es un número de punto " "flotante, el otro es convertido a punto flotante;" #: ../Doc/reference/expressions.rst:39 @@ -130,13 +130,13 @@ msgid "" "object. When a name is not bound, an attempt to evaluate it raises a :exc:" "`NameError` exception." msgstr "" -"Cuando el nombre es vinculado a un objeto, la evaluación del átomo yields " +"Cuando el nombre es vinculado a un objeto, la evaluación del átomo genera " "ese objeto. Cuando un nombre no es vinculado, un intento de evaluarlo genera " "una excepción :exc:`NameError`." #: ../Doc/reference/expressions.rst:87 msgid "Private name mangling" -msgstr "" +msgstr "Alteración de nombre privado" #: ../Doc/reference/expressions.rst:89 msgid "" @@ -144,10 +144,13 @@ msgid "" "two or more underscore characters and does not end in two or more " "underscores, it is considered a :dfn:`private name` of that class." msgstr "" +"Cuando un identificador que ocurre textualmente en una definición de clase " +"comienza con dos o más caracteres de guión bajo y no termina en dos o más " +"guiones bajos, es considerado un :dfn:`private name` de esa clase." #: ../Doc/reference/expressions.rst:95 msgid "The :ref:`class specifications `." -msgstr "" +msgstr "La :ref:`class specifications `." #: ../Doc/reference/expressions.rst:97 msgid "" @@ -155,24 +158,35 @@ msgid "" "is generated for them. If the transformed name is longer than 255 " "characters, implementation-defined truncation may happen." msgstr "" +"Más concretamente, los nombres privados son transformados a una forma más " +"larga antes de que se genere código para ellos. Si el nombre transformado " +"tiene más de 255 caracteres, puede producirse un truncamiento definido por " +"la implementación." #: ../Doc/reference/expressions.rst:101 msgid "" "The transformation is independent of the syntactical context in which the " "identifier is used but only the following private identifiers are mangled:" msgstr "" +"La transformación es independiente del contexto sintáctico en el que se " +"utilice el identificador, pero sólo se alteran los siguientes " +"identificadores privados:" #: ../Doc/reference/expressions.rst:104 msgid "" "Any name used as the name of a variable that is assigned or read or any name " "of an attribute being accessed." msgstr "" +"Cualquier nombre utilizado como nombre de una variable que se asigna o se " +"lee o cualquier nombre de un atributo al que se accede." #: ../Doc/reference/expressions.rst:107 msgid "" "The :attr:`~definition.__name__` attribute of nested functions, classes, and " "type aliases is however not mangled." msgstr "" +"Sin embargo, el atributo :attr:`~definition.__name__` de funciones " +"anidadas, clases y alias de tipo no son alterados." #: ../Doc/reference/expressions.rst:110 msgid "" @@ -180,15 +194,21 @@ msgid "" "module is part of a package (i.e., its name contains a dot), the name is " "*not* mangled, e.g., the ``__foo`` in ``import __foo.bar`` is not mangled." msgstr "" +"El nombre de módulos importados, por ejemplo ``__spam`` en ``import " +"__spam``. Si el módulo es parte de un paquete (por ejemplo, si su nombre " +"contiene un punto), el nombre *no* es alterado. Por ejemplo, ``__foo`` en " +"``import __foo.bar`` no es alterado." #: ../Doc/reference/expressions.rst:115 msgid "" "The name of an imported member, e.g., ``__f`` in ``from spam import __f``." msgstr "" +"El nombre de un miembro importado, por ejemplo ``__f`` en ``from spam import " +"__f``." #: ../Doc/reference/expressions.rst:117 msgid "The transformation rule is defined as follows:" -msgstr "" +msgstr "La norma de transformación se define de la siguiente forma:" #: ../Doc/reference/expressions.rst:119 msgid "" @@ -197,6 +217,10 @@ msgid "" "identifier ``__spam`` occurring in a class named ``Foo``, ``_Foo`` or " "``__Foo`` is transformed to ``_Foo__spam``." msgstr "" +"El nombre de la clase, con los caracteres de guión bajo iniciales eliminados " +"y un único caracter de guión bajo inicial insertado, se inserta delante del " +"identificador. Por ejemplo, el identificador ``__spam`` que aparece en la " +"clase llamada ``Foo``, ``_Foo`` o ``__Foo`` se transforma en ``_Foo__spam``." #: ../Doc/reference/expressions.rst:124 msgid "" @@ -204,6 +228,9 @@ msgid "" "identity, e.g., the identifier ``__spam`` occurring in a class named ``_`` " "or ``__`` is left as is." msgstr "" +"Si el nombre de la clase consiste únicamente en caracteres de guión bajo, la " +"transformación es la identidad. Por ejemplo, el identificador ``__spam`` que " +"aparece en una clase llamada ``_`` o ``__`` permanece igual." #: ../Doc/reference/expressions.rst:131 msgid "Literals" @@ -216,7 +243,6 @@ msgstr "" "numéricos:" #: ../Doc/reference/expressions.rst:141 -#, fuzzy msgid "" "Evaluation of a literal yields an object of the given type (string, bytes, " "integer, floating-point number, complex number) with the given value. The " @@ -260,9 +286,9 @@ msgid "" "if the list contains at least one comma, it yields a tuple; otherwise, it " "yields the single expression that makes up the expression list." msgstr "" -"Una expresión entre paréntesis yields lo que la lista de expresión yields: " +"Una expresión entre paréntesis produce lo que la lista de expresión *yield*: " "si la lista contiene al menos una coma, produce una tupla; en caso " -"contrario, yields la única expresión que que forma la lista de expresiones." +"contrario, produce la única expresión que que forma la lista de expresiones." #: ../Doc/reference/expressions.rst:177 msgid "" @@ -270,9 +296,9 @@ msgid "" "immutable, the same rules as for literals apply (i.e., two occurrences of " "the empty tuple may or may not yield the same object)." msgstr "" -"Un par de paréntesis vacío yields un objeto de tupla vacío. Debido a que las " -"tuplas son inmutables, se aplican las mismas reglas que aplican para " -"literales (ej., dos ocurrencias de una tupla vacía puede o no yields el " +"Un par de paréntesis vacío produce un objeto de tupla vacío. Debido a que " +"las tuplas son inmutables, se aplican las mismas reglas que aplican para " +"literales (ej., dos ocurrencias de una tupla vacía puede o no produce el " "mismo objeto)." #: ../Doc/reference/expressions.rst:185 @@ -374,7 +400,6 @@ msgstr "" "alcance implícitamente anidado." #: ../Doc/reference/expressions.rst:244 -#, fuzzy msgid "" "Since Python 3.6, in an :keyword:`async def` function, an :keyword:`!async " "for` clause may be used to iterate over a :term:`asynchronous iterator`. A " @@ -387,13 +412,8 @@ msgstr "" "cláusula :keyword:`!async for` para iterar sobre un :term:`asynchronous " "iterator`. Una comprensión en una función :keyword:`!async def` puede " "consistir en una cláusula :keyword:`!for` o :keyword:`!async for` después de " -"la expresión inicial, puede contener cláusulas :keyword:`!for` o :keyword:`!" -"async for` adicionales y también puede usar expresiones :keyword:`await`. Si " -"una comprensión contiene cláusulas :keyword:`!async for` o expresiones :" -"keyword:`!await` u otras comprensiones asíncronas, se denomina :dfn:" -"`comprensión asíncrona`. Una comprensión asíncrona puede suspender la " -"ejecución de la función de rutina en la que aparece. Véase también :pep:" -"`530`." +"la expresión inicial, puede contener cláusulas adicionales :keyword:`!for` " +"o :keyword:`!async for` y también puede usar expresiones :keyword:`await`." #: ../Doc/reference/expressions.rst:251 msgid "" @@ -404,6 +424,12 @@ msgid "" "comprehension may suspend the execution of the coroutine function in which " "it appears. See also :pep:`530`." msgstr "" +"Si una comprensión contiene cláusulas :keyword:`!async for` or si contiene " +"expresiones :keyword:`!await` u otra comprensión asíncrona en cualquier " +"sitio excepto la expresión iterable en la cláusula :keyword:`!for` más a la " +"izquierda, se le llama una :dfn:`asynchronous comprehension`. Una " +"comprensión asíncrona podría suspender la ejecución de la función de " +"corutina en la que aparece. Consulte también :pep:`530`." #: ../Doc/reference/expressions.rst:258 msgid "Asynchronous comprehensions were introduced." @@ -671,7 +697,7 @@ msgstr "" #: ../Doc/reference/expressions.rst:446 msgid "Yield expressions" -msgstr "Expresiones yield" +msgstr "Expresiones *yield*" #: ../Doc/reference/expressions.rst:459 msgid "" @@ -682,12 +708,12 @@ msgid "" "keyword:`async def` function's body causes that coroutine function to be an " "asynchronous generator function. For example::" msgstr "" -"La expresión yield se usa al definir una función :term:`generator` o una " +"La expresión *yield* se usa al definir una función :term:`generator` o una " "función :term:`asynchronous generator` y, por lo tanto, solo se puede usar " -"en el cuerpo de una definición de función. El uso de una expresión yield en " -"el cuerpo de una función hace que esa función sea una función generadora, y " -"su uso en el cuerpo de una función :keyword:`async def` hace que la función " -"corrutina sea una función generadora asíncrona. Por ejemplo::" +"en el cuerpo de una definición de función. El uso de una expresión *yield* " +"en el cuerpo de una función hace que esa función sea una función generadora, " +"y su uso en el cuerpo de una función :keyword:`async def` hace que la " +"función corrutina sea una función generadora asíncrona. Por ejemplo::" #: ../Doc/reference/expressions.rst:466 msgid "" @@ -697,6 +723,10 @@ msgid "" "async def agen(): # defines an asynchronous generator function\n" " yield 123" msgstr "" +"def gen(): # define una función generadora\n" +" yield 123\n" +"\n" +"async def agen(): # define una función generadora asíncrona" #: ../Doc/reference/expressions.rst:472 msgid "" @@ -714,7 +744,7 @@ msgid "" "Yield expressions prohibited in the implicitly nested scopes used to " "implement comprehensions and generator expressions." msgstr "" -"Expresiones yield prohibidas en los ámbitos anidados implícitamente " +"Expresiones *yield* prohibidas en los ámbitos anidados implícitamente " "utilizados para implementar comprensiones y expresiones de generador." #: ../Doc/reference/expressions.rst:480 @@ -728,7 +758,6 @@ msgstr "" "sección :ref:`asynchronous-generator-functions`." #: ../Doc/reference/expressions.rst:484 -#, fuzzy msgid "" "When a generator function is called, it returns an iterator known as a " "generator. That generator then controls the execution of the generator " @@ -748,24 +777,24 @@ msgid "" "`None`. Otherwise, if :meth:`~generator.send` is used, then the result will " "be the value passed in to that method." msgstr "" -"Cuando se llama a una función generadora, devuelve un iterador conocido como " +"Cuando se llama a una función generadora, retorna un iterador conocido como " "generador. Ese generador luego controla la ejecución de la función del " "generador. La ejecución comienza cuando se llama a uno de los métodos del " -"generador. En ese momento, la ejecución continúa con la primera expresión de " -"rendimiento, donde se suspende nuevamente, devolviendo el valor de :token:" -"`~python-grammar:expression_list` al llamador del generador, o ``None`` si :" -"token:`~python-grammar:expression_list` se omite. Por suspendido queremos " -"decir que se retiene todo el estado local, incluidos los enlaces actuales de " -"las variables locales, el puntero de instrucción, la pila de evaluación " -"interna y el estado de cualquier manejo de excepciones. Cuando se reanuda la " +"generador. En ese momento, la ejecución procede con la primera expresión " +"*yield*, donde se suspende nuevamente, retornando el valor de :token:" +"`~python-grammar:yield_list` a quien llame al generador, o ``None`` si :" +"token:`~python-grammar:yield_list` se omite. Por suspendido entiéndase que " +"se retiene todo el estado local, incluyendo los enlaces actuales de las " +"variables locales, el puntero de instrucción, la pila de evaluación interna " +"y el estado de cualquier manejo de excepciones. Cuando se reanuda la " "ejecución llamando a uno de los métodos del generador, la función puede " -"continuar exactamente como si la expresión de rendimiento fuera simplemente " -"otra llamada externa. El valor de la expresión de rendimiento después de la " -"reanudación depende del método que reanudó la ejecución. Si se utiliza :meth:" -"`~generator.__next__` (normalmente a través de un :keyword:`for` o el " -"integrado :func:`next`), el resultado es :const:`None`. De lo contrario, si " -"se utiliza :meth:`~generator.send`, el resultado será el valor pasado a ese " -"método." +"continuar exactamente como si la expresión *yield* fuera simplemente otra " +"llamada externa. El valor de la expresión *yield* después de la reanudación " +"depende del método que reanudó la ejecución. Si se utiliza :meth:`~generator." +"__next__` (normalmente a través de un :keyword:`for` o la función " +"incorporada :func:`next`), el resultado es :const:`None`. De lo contrario, " +"si se utiliza :meth:`~generator.send`, el resultado será el valor pasado a " +"ese método." #: ../Doc/reference/expressions.rst:504 msgid "" @@ -775,11 +804,11 @@ msgid "" "function cannot control where the execution should continue after it yields; " "the control is always transferred to the generator's caller." msgstr "" -"Todo este hace a las funciones generadores similar a las corrutinas; yield " -"múltiples veces, tienen más de un punto de entrada y su ejecución puede ser " -"suspendida. La única diferencia es que una función generadora no puede " -"controlar si la ejecución debe continuar después de yield; el control " -"siempre es transferido al invocador del generador." +"Todo este hace a las funciones generadores similar a las corrutinas; " +"producen múltiples veces, tienen más de un punto de entrada y su ejecución " +"puede ser suspendida. La única diferencia es que una función generadora no " +"puede controlar si la ejecución debe continuar después de que ceda; el " +"control siempre es transferido al invocador del generador." #: ../Doc/reference/expressions.rst:510 msgid "" @@ -789,11 +818,11 @@ msgid "" "meth:`~generator.close` method will be called, allowing any pending :keyword:" "`finally` clauses to execute." msgstr "" -"Las expresiones yield están permitidas en cualquier lugar en un constructo :" -"keyword:`try`. Si el generador no es reanudado antes de finalizar " -"(alcanzando un recuento de referencia cero o colectando basura), el método " -"generador-iterador :meth:`~generator.close` será invocado, permitiendo la " -"ejecución de cualquier cláusula :keyword:`finally` pendiente." +"Las expresiones *yield* están permitidas en cualquier lugar en un " +"constructo :keyword:`try`. Si el generador no es reanudado antes de " +"finalizar (alcanzando un recuento de referencia cero o colectando basura), " +"el método generador-iterador :meth:`~generator.close` será invocado, " +"permitiendo la ejecución de cualquier cláusula :keyword:`finally` pendiente." #: ../Doc/reference/expressions.rst:519 msgid "" @@ -825,7 +854,7 @@ msgid "" msgstr "" "Cuando el iterador subyacente está completo, el atributo :attr:" "`~StopIteration.value` de la instancia :exc:`StopIteration` generada se " -"convierte en el valor de la expresión yield. Puede ser establecido " +"convierte en el valor de la expresión *yield*. Puede ser establecido " "explícitamente al generar :exc:`StopIteration` o automáticamente cuando el " "subiterador es un generador (retornando un valor del subgenerador)." @@ -840,7 +869,7 @@ msgid "" "The parentheses may be omitted when the yield expression is the sole " "expression on the right hand side of an assignment statement." msgstr "" -"Los paréntesis pueden ser omitidos cuando la expresión yield es la única " +"Los paréntesis pueden ser omitidos cuando la expresión *yield* es la única " "expresión en el lado derecho de una sentencia de asignación." #: ../Doc/reference/expressions.rst:543 @@ -913,7 +942,6 @@ msgstr "" "excepción :exc:`ValueError`." #: ../Doc/reference/expressions.rst:574 -#, fuzzy msgid "" "Starts the execution of a generator function or resumes it at the last " "executed yield expression. When a generator function is resumed with a :" @@ -926,12 +954,12 @@ msgid "" msgstr "" "Inicia la ejecución de una función generadora o la reanuda en la última " "expresión de rendimiento ejecutada. Cuando se reanuda una función de " -"generador con un método :meth:`~generator.__next__`, la expresión de " -"rendimiento actual siempre se evalúa como :const:`None`. Luego, la ejecución " -"continúa con la siguiente expresión de rendimiento, donde el generador se " -"suspende nuevamente y el valor de :token:`~python-grammar:expression_list` " -"se devuelve a la persona que llama de :meth:`__next__`. Si el generador sale " -"sin generar otro valor, se genera una excepción :exc:`StopIteration`." +"generador con un método :meth:`~generator.send`, la expresión de rendimiento " +"actual siempre se evalúa como :const:`None`. Luego, la ejecución continúa " +"con la siguiente expresión de rendimiento, donde el generador se suspende " +"nuevamente y el valor de :token:`~python-grammar:yield_list` se retorna a la " +"aquello que llame :meth:`__next__`. Si el generador sale sin generar otro " +"valor, se lanza una excepción :exc:`StopIteration`." #: ../Doc/reference/expressions.rst:583 msgid "" @@ -952,7 +980,7 @@ msgid "" "expression that could receive the value." msgstr "" "Reanuda la ejecución y \"envía\" un valor dentro de la función generadora. " -"El argumento *value* se convierte en el resultado de la expresión yield " +"El argumento *value* se convierte en el resultado de la expresión *yield* " "actual. El método :meth:`send` retorna el siguiente valor producido por el " "generador o genera :exc:`StopIteration` si el generador termina sin producir " "otro valor. Cuando se ejecuta :meth:`send` para comenzar el generador, debe " @@ -967,7 +995,7 @@ msgid "" "If the generator function does not catch the passed-in exception, or raises " "a different exception, then that exception propagates to the caller." msgstr "" -"Genera una excepción en el punto donde se pausó el generador y devuelve el " +"Genera una excepción en el punto donde se pausó el generador y retorna el " "siguiente valor generado por la función del generador. Si el generador sale " "sin generar otro valor, se genera una excepción :exc:`StopIteration`. Si la " "función generadora no detecta la excepción pasada o genera una excepción " @@ -1009,7 +1037,6 @@ msgstr "" "puede eliminarse en una versión futura de Python." #: ../Doc/reference/expressions.rst:629 -#, fuzzy msgid "" "Raises a :exc:`GeneratorExit` at the point where the generator function was " "paused. If the generator function catches the exception and returns a " @@ -1021,19 +1048,23 @@ msgid "" "exited due to an exception or normal exit, :meth:`close` returns :const:" "`None` and has no other effect." msgstr "" -"Genera :exc:`GeneratorExit` en el punto donde la función generadora fue " -"pausada. Si la función generadora termina sin errores, está ya cerrada o " -"genera :exc:`GeneratorExit` (sin cazar la excepción), close retorna a su " -"invocador. Si el generador produce un valor, se genera un :exc:" -"`RuntimeError`. Si el generador genera cualquier otra excepción, es " -"propagado al invocador. :meth:`close` no hace nada si el generador ya fue " -"terminado debido a una excepción o una salida normal." +"Lanza la excepción :exc:`GeneratorExit` en el punto donde la función " +"generadora fue pausada. Si la función generadora atrapa la excepción y " +"retorna un valor, este valor se retorna de :meth:`close`. Si la función " +"generadora ya está ya cerrada o lanza :exc:`GeneratorExit` (sin atrapar la " +"excepción), :meth:`close` retorna :const:`None`. Si el generador produce un " +"valor, se lanza un :exc:`RuntimeError`. Si el generador lanza cualquier otra " +"excepción, es propagado al invocador. Si el generador ya fue terminado " +"debido a una excepción o una salida normal, :meth:`close` retorna :const:" +"`None` y no tiene otro efecto." #: ../Doc/reference/expressions.rst:641 msgid "" "If a generator returns a value upon being closed, the value is returned by :" "meth:`close`." msgstr "" +"Si un generador retorna un valor al cerrarse, el valor es retornado por :" +"meth:`close`." #: ../Doc/reference/expressions.rst:647 msgid "Examples" @@ -1074,6 +1105,30 @@ msgid "" ">>> generator.close()\n" "Don't forget to clean up when 'close()' is called." msgstr "" +">>> def echo(value=None):\n" +"... print(\"Execution starts when 'next()' is called for the first time." +"\")\n" +"... try:\n" +"... while True:\n" +"... try:\n" +"... value = (yield value)\n" +"... except Exception as e:\n" +"... value = e\n" +"... finally:\n" +"... print(\"Don't forget to clean up when 'close()' is called.\")\n" +"...\n" +">>> generator = echo(1)\n" +">>> print(next(generator))\n" +"Execution starts when 'next()' is called for the first time.\n" +"1\n" +">>> print(next(generator))\n" +"None\n" +">>> print(generator.send(2))\n" +"2\n" +">>> generator.throw(TypeError, \"spam\")\n" +"TypeError('spam',)\n" +">>> generator.close()\n" +"Don't forget to clean up when 'close()' is called." #: ../Doc/reference/expressions.rst:676 msgid "" @@ -1093,9 +1148,9 @@ msgid "" "keyword:`async def` further defines the function as an :term:`asynchronous " "generator` function." msgstr "" -"La presencia de una expresión yield en una función o método definido usando :" -"keyword:`async def` adicionalmente define la función como una función :term:" -"`asynchronous generator`." +"La presencia de una expresión *yield* en una función o método definido " +"usando :keyword:`async def` adicionalmente define la función como una " +"función :term:`asynchronous generator`." #: ../Doc/reference/expressions.rst:688 msgid "" @@ -1114,7 +1169,6 @@ msgstr "" "sentencia :keyword:`for`." #: ../Doc/reference/expressions.rst:695 -#, fuzzy msgid "" "Calling one of the asynchronous generator's methods returns an :term:" "`awaitable` object, and the execution starts when this object is awaited on. " @@ -1131,21 +1185,21 @@ msgid "" "then the result is :const:`None`. Otherwise, if :meth:`~agen.asend` is used, " "then the result will be the value passed in to that method." msgstr "" -"Llamar a uno de los métodos del generador asíncrono devuelve un objeto :term:" +"Llamar a uno de los métodos del generador asíncrono retorna un objeto :term:" "`awaitable` y la ejecución comienza cuando se espera este objeto. En ese " -"momento, la ejecución procede a la primera expresión yield, donde se " -"suspende nuevamente, devolviendo el valor de :token:`~python-grammar:" -"expression_list` a la rutina en espera. Al igual que con un generador, la " +"momento, la ejecución procede a la primera expresión *yield*, donde se " +"suspende nuevamente, retornando el valor de :token:`~python-grammar:" +"yield_list` a la corutina en espera. Al igual que con un generador, la " "suspensión significa que se retiene todo el estado local, incluidos los " "enlaces actuales de las variables locales, el puntero de instrucción, la " "pila de evaluación interna y el estado de cualquier manejo de excepción. " -"Cuando se reanuda la ejecución esperando el siguiente objeto devuelto por " +"Cuando se reanuda la ejecución esperando el siguiente objeto retornado por " "los métodos del generador asíncrono, la función puede proceder exactamente " -"como si la expresión yield fuera simplemente otra llamada externa. El valor " -"de la expresión yield después de reanudar depende del método que reanudó la " -"ejecución. Si se utiliza :meth:`~agen.__anext__`, el resultado es :const:" -"`None`. De lo contrario, si se usa :meth:`~agen.asend`, el resultado será el " -"valor pasado a ese método." +"como si la expresión *yield* fuera simplemente otra llamada externa. El " +"valor de la expresión *yield* después de reanudar depende del método que " +"reanudó la ejecución. Si se utiliza :meth:`~agen.__anext__`, el resultado " +"es :const:`None`. De lo contrario, si se usa :meth:`~agen.asend`, el " +"resultado será el valor pasado a ese método." #: ../Doc/reference/expressions.rst:710 msgid "" @@ -1182,11 +1236,11 @@ msgid "" "the resulting coroutine object, thus allowing any pending :keyword:`!" "finally` clauses to execute." msgstr "" -"En una función generadora asincrónica, las expresiones yield están " +"En una función generadora asincrónica, las expresiones *yield* están " "permitidas en cualquier lugar de un constructo :keyword:`try`. Sin embargo, " "si un generador asincrónico no es reanudado antes de finalizar (alcanzando " "un contador de referencia cero o recogiendo basura), entonces una expresión " -"yield dentro de un constructo :keyword:`!try` podría fallar al ejecutar " +"*yield* dentro de un constructo :keyword:`!try` podría fallar al ejecutar " "cláusulas :keyword:`finally` pendientes. En este caso, es responsabilidad " "del bucle de eventos o del planificador ejecutando el generador asincrónico " "invocar el método :meth:`~agen.aclose` del generador-iterador asincrónico y " @@ -1236,7 +1290,6 @@ msgstr "" "los cuales son usados para controlar la ejecución de una función generadora." #: ../Doc/reference/expressions.rst:757 -#, fuzzy msgid "" "Returns an awaitable which when run starts to execute the asynchronous " "generator or resumes it at the last executed yield expression. When an " @@ -1250,17 +1303,17 @@ msgid "" "`StopAsyncIteration` exception, signalling that the asynchronous iteration " "has completed." msgstr "" -"Devuelve un valor en espera que, cuando se ejecuta, comienza a ejecutar el " -"generador asíncrono o lo reanuda en la última expresión de rendimiento " -"ejecutada. Cuando se reanuda una función de generador asíncrono con un " -"método :meth:`~agen.__anext__`, la expresión de rendimiento actual siempre " -"se evalúa como :const:`None` en el valor awaitable devuelto, que cuando se " -"ejecute continuará con la siguiente expresión de rendimiento. El valor de :" -"token:`~python-grammar:expression_list` de la expresión de rendimiento es el " -"valor de la excepción :exc:`StopIteration` generada por la rutina de " -"finalización. Si el generador asincrónico sale sin generar otro valor, " -"awaitable genera una excepción :exc:`StopAsyncIteration`, lo que indica que " -"la iteración asincrónica se ha completado." +"Retorna un aguardable que, cuando se ejecuta, comienza a ejecutar el " +"generador asíncrono o lo reanuda en la última expresión *yield* ejecutada. " +"Cuando se reanuda una función de generador asíncrono con un método :meth:" +"`~agen.__anext__`, la expresión *yield* actual siempre se evalúa como :const:" +"`None` en el aguardable retornado, que cuando se ejecute continuará con la " +"siguiente expresión *yield*. El valor de :token:`~python-grammar:yield_list` " +"de la expresión *yield* es el valor de la excepción :exc:`StopIteration` " +"generada por la corutina de finalización. Si el generador asincrónico " +"finaliza sin generar otro valor, el aguardable genera una excepción :exc:" +"`StopAsyncIteration`, lo que indica que la iteración asincrónica se ha " +"completado." #: ../Doc/reference/expressions.rst:769 msgid "" @@ -1270,7 +1323,6 @@ msgstr "" "`async for`." #: ../Doc/reference/expressions.rst:774 -#, fuzzy msgid "" "Returns an awaitable which when run resumes the execution of the " "asynchronous generator. As with the :meth:`~generator.send` method for a " @@ -1284,16 +1336,16 @@ msgid "" "`None` as the argument, because there is no yield expression that could " "receive the value." msgstr "" -"Retorna un esperable el cual cuando corre reanuda la ejecución del generador " -"asincrónico. Como el método :meth:`~generator.send()` para un generador, " -"este \"envía\" un valor a la función generadora asincrónica y el argumento " -"*value* se convierte en el resultado de la expresión yield actual. El " -"esperable retornado por el método :meth:`asend` retornará el siguiente valor " -"producido por el generador como el valor de la :exc:`StopIteration` generada " -"o genera :exc:`StopAsyncIteration` si el generador asincrónico termina sin " -"yield otro valor. Cuando se invoca :meth:`asend` para empezar el generador " -"asincrónico, debe ser invocado con :const:`None` como argumento, porque no " -"hay expresión yield que pueda recibir el valor." +"Retorna un aguardable el cual ejecuta cuando se reanude la ejecución del " +"generador asincrónico. Como el método :meth:`~generator.send` para un " +"generador, este \"envía\" un valor a la función generadora asincrónica y el " +"argumento *value* se convierte en el resultado de la expresión *yield* " +"actual. El aguardable retornado por el método :meth:`asend` retornará el " +"siguiente valor producido por el generador como el valor de la :exc:" +"`StopIteration` generada o genera :exc:`StopAsyncIteration` si el generador " +"asincrónico termina sin generar otro valor. Cuando se invoca :meth:`asend` " +"para empezar el generador asincrónico, debe ser invocado con :const:`None` " +"como argumento, porque no hay expresión *yield* que pueda recibir el valor." #: ../Doc/reference/expressions.rst:790 msgid "" @@ -1306,14 +1358,14 @@ msgid "" "exception, or raises a different exception, then when the awaitable is run " "that exception propagates to the caller of the awaitable." msgstr "" -"Retorna un esperable que genera una excepción de tipo ``type`` en el punto " +"Retorna un aguardable que genera una excepción de tipo ``type`` en el punto " "donde el generador asincrónico fue pausado y retorna el siguiente valor " -"yield por la función generadora como el valor de la excepción :exc:" -"`StopIteration` generada. Si el generador asincrónico termina sin yield otro " -"valor, el esperable genera una excepción :exc:`StopAsyncIteration`. Si la " -"función generadora no caza la excepción pasada o genera una excepción " -"diferente, entonces cuando se ejecuta el esperable esa excepción se propaga " -"al invocador del esperable." +"producido por la función generadora como el valor de la excepción :exc:" +"`StopIteration` generada. Si el generador asincrónico termina sin producir " +"otro valor, el aguardable genera una excepción :exc:`StopAsyncIteration`. Si " +"la función generadora no caza la excepción pasada o genera una excepción " +"diferente, entonces cuando se ejecuta el aguardable esa excepción se propaga " +"al invocador del aguardable." #: ../Doc/reference/expressions.rst:810 msgid "" @@ -1330,18 +1382,18 @@ msgid "" "due to an exception or normal exit, then further calls to :meth:`aclose` " "will return an awaitable that does nothing." msgstr "" -"Retorna un esperable que cuando corre lanza un :exc:`GeneratorExit` a la " +"Retorna un aguardable que cuando corre lanza un :exc:`GeneratorExit` a la " "función generadora asincrónica en el punto donde fue pausada. Si la función " -"generadora asincrónica termina exitosamente, ya está cerrada o genera :exc:" -"`GeneratorExit` (sin cazar la excepción), el esperable retornado lanzará una " -"excepción :exc:`StopIteration`. Otros esperables retornados por subsecuentes " -"invocaciones al generador asincrónico lanzarán una excepción :exc:" -"`StopAsyncIteration`. Si el generador asincrónico yield un valor, el " -"esperable genera un :exc:`RuntimeError`. Si el generador asincrónico genera " -"cualquier otra excepción, esta es propagada al invocador del esperable. Si " +"generadora asincrónica termina exitosamente, ya está cerrada o genera :exc:" +"`GeneratorExit` (sin cazar la excepción), el aguardable retornado lanzará " +"una excepción :exc:`StopIteration`. Otros aguardables retornados por " +"subsecuentes invocaciones al generador asincrónico lanzarán una excepción :" +"exc:`StopAsyncIteration`. Si el generador asincrónico produce un valor, el " +"aguardable genera un :exc:`RuntimeError`. Si el generador asincrónico genera " +"cualquier otra excepción, esta es propagada al invocador del aguardable. Si " "el generador asincrónico ha terminado debido a una excepción o una " "terminación normal, entonces futuras invocaciones a :meth:`aclose` " -"retornarán un esperable que no hace nada." +"retornarán un aguardable que no hace nada." #: ../Doc/reference/expressions.rst:826 msgid "Primaries" @@ -1365,7 +1417,6 @@ msgstr "" "Una referencia de atributo es un primario seguido de un punto y un nombre:" #: ../Doc/reference/expressions.rst:856 -#, fuzzy msgid "" "The primary must evaluate to an object of a type that supports attribute " "references, which most objects do. This object is then asked to produce the " @@ -1375,12 +1426,10 @@ msgid "" msgstr "" "El primario debe evaluar a un objeto de un tipo que soporte referencias de " "atributos, lo cual la mayoría de los objetos soportan. Luego se le pide a " -"este objeto que produzca el atributo cuyo nombre es el identificador. Esta " -"producción puede ser personalizada sobrescribiendo el método :meth:" -"`__getattr__`. Si este atributo no es esperable, se genera la excepción :exc:" -"`AtributeError`. De otra forma, el tipo y el valor del objeto producido es " -"determinado por el objeto. Múltiples evaluaciones la misma referencia de " -"atributo pueden yield diferentes objetos." +"este objeto que produzca el atributo cuyo nombre es el identificador. Este " +"tipo y valor producidos son determinados por el objeto. Múltiples " +"evaluaciones sobre la misma referencia de atributo pueden producir objetos " +"diferentes." #: ../Doc/reference/expressions.rst:862 msgid "" @@ -1389,12 +1438,18 @@ msgid "" "meth:`!__getattribute__` method is called first and either returns a value " "or raises :exc:`AttributeError` if the attribute is not available." msgstr "" +"Esta producción puede ser personalizada al sobreescribir el método :meth:" +"`~object.__getattribute__` o :meth:`~object.__getattr__`. El método :meth:`!" +"__getattribute__` es llamado primero y retorna un valor o se genera la " +"excepción :exc:`AttributeError` si el atributo no está disponible." #: ../Doc/reference/expressions.rst:868 msgid "" "If an :exc:`AttributeError` is raised and the object has a :meth:`!" "__getattr__` method, that method is called as a fallback." msgstr "" +"Si se genera una excepción :exc:`AttributeError` y el objeto tiene un " +"método :meth:`!__getattr__`, dicho método es llamado como respaldo." #: ../Doc/reference/expressions.rst:874 msgid "Subscriptions" @@ -1409,7 +1464,7 @@ msgid "" msgstr "" "La suscripción de una instancia de un :ref:`container class ` generalmente seleccionará un elemento del contenedor. La suscripción " -"de un :term:`generic class ` generalmente devolverá un objeto :" +"de un :term:`generic class ` generalmente retornará un objeto :" "ref:`GenericAlias `." #: ../Doc/reference/expressions.rst:897 @@ -1438,14 +1493,14 @@ msgstr "" "`classgetitem-versus-getitem`." #: ../Doc/reference/expressions.rst:907 -#, fuzzy msgid "" "If the expression list contains at least one comma, or if any of the " "expressions are starred, the expression list will evaluate to a :class:" "`tuple` containing the items of the expression list. Otherwise, the " "expression list will evaluate to the value of the list's sole member." msgstr "" -"Si la lista de expresiones contiene al menos una coma, se evaluará como un :" +"Si la lista de expresiones contiene al menos una coma o si alguna de las " +"expresiones está destacada, la lista de expresiones se evaluará como un :" "class:`tuple` que contiene los elementos de la lista de expresiones. De lo " "contrario, la lista de expresiones evaluará el valor del único miembro de la " "lista." @@ -1453,6 +1508,8 @@ msgstr "" #: ../Doc/reference/expressions.rst:912 msgid "Expressions in an expression list may be starred. See :pep:`646`." msgstr "" +"Las expresiones en una lista de expresiones pueden ser destacadas. See :pep:" +"`646`." #: ../Doc/reference/expressions.rst:915 msgid "" @@ -1488,7 +1545,6 @@ msgstr "" "incluyen las clases :class:`str`, :class:`list` y :class:`tuple`." #: ../Doc/reference/expressions.rst:927 -#, fuzzy msgid "" "The formal syntax makes no special provision for negative indices in :term:" "`sequences `. However, built-in sequences all provide a :meth:" @@ -1509,9 +1565,9 @@ msgstr "" "resultante debe ser un número entero no negativo menor que el número de " "elementos de la secuencia, y la suscripción selecciona el elemento cuyo " "índice es ese valor (contando desde cero). Dado que la compatibilidad con " -"los índices negativos y el corte se produce en el método :meth:`__getitem__` " -"del objeto, las subclases que sobrescriban este método deberán agregar " -"explícitamente esa compatibilidad." +"los índices negativos y la segmentación se produce en el método :meth:" +"`~object.__getitem__` del objeto, las subclases que sobrescriban este método " +"deberán agregar explícitamente esa compatibilidad." #: ../Doc/reference/expressions.rst:941 msgid "" @@ -1556,7 +1612,6 @@ msgstr "" "segmento adecuado)." #: ../Doc/reference/expressions.rst:988 -#, fuzzy msgid "" "The semantics for a slicing are as follows. The primary is indexed (using " "the same :meth:`~object.__getitem__` method as normal subscription) with a " @@ -1571,17 +1626,17 @@ msgid "" "missing expressions." msgstr "" "Las semánticas para un segmento son las siguientes. El primario es indexado " -"(usando el mismo método :meth:`__getitem__` de una subscripción normal) con " -"una clave que se construye del segmento de lista, tal como sigue. Si el " -"segmento de lista contiene al menos una coma, la clave es una tupla que " -"contiene la conversión de los elementos del segmento; de otra forma, la " -"conversión del segmento de lista solitario es la clave. La conversión de un " -"elemento de segmento que es una expresión es esa expresión. La conversión de " -"un segmento apropiado es un objeto segmento (ver sección :ref:`types`) cuyos " -"atributos :attr:`~slice.start`, :attr:`~slice.stop` y :attr:`~slice.step` " -"son los valores de las expresiones dadas como límite inferior, límite " -"superior y paso, respectivamente, substituyendo ``None`` para las " -"expresiones faltantes." +"(usando el mismo método :meth:`~object.__getitem__` de una subscripción " +"normal) con una clave que se construye del segmento de lista, tal como " +"sigue. Si el segmento de lista contiene al menos una coma, la clave es una " +"tupla que contiene la conversión de los elementos del segmento; en caso " +"contrario, la conversión del segmento de lista solitario es la clave. La " +"conversión de un elemento de segmento que es una expresión es esa expresión. " +"La conversión de un segmento apropiado es un objeto segmento (ver sección :" +"ref:`types`) cuyos atributos :attr:`~slice.start`, :attr:`~slice.stop` y :" +"attr:`~slice.step` son los valores de las expresiones dadas como límite " +"inferior, límite superior y paso, respectivamente, substituyendo ``None`` " +"para las expresiones faltantes." #: ../Doc/reference/expressions.rst:1012 msgid "Calls" @@ -1604,7 +1659,6 @@ msgstr "" "posicionales y de palabra clave pero no afecta a las semánticas." #: ../Doc/reference/expressions.rst:1037 -#, fuzzy msgid "" "The primary must evaluate to a callable object (user-defined functions, " "built-in functions, methods of built-in objects, class objects, methods of " @@ -1616,10 +1670,10 @@ msgstr "" "La clave primaria debe evaluar a un objeto invocable (funciones definidas " "por el usuario, funciones incorporadas, métodos de objetos incorporados, " "métodos de instancias de clases y todos los objetos que tienen un método :" -"meth:`__call__` son invocables). Todas las expresiones de argumento son " -"evaluadas antes de que la invocación sea intentada. Por favor, refiera a la " -"sección :ref:`function` para la sintaxis formal de listas de :term:" -"`parameter`." +"meth:`~object.__call__` son invocables). Todas las expresiones de argumento " +"son evaluadas antes de que la invocación sea intentada. Por favor, consulte " +"la sección :ref:`function` para saber más sobre la sintaxis de listas :term:" +"`parameter` formales." #: ../Doc/reference/expressions.rst:1045 msgid "" @@ -1748,6 +1802,10 @@ msgid "" ">>> f(1, *(2,))\n" "1 2" msgstr "" +">>> def f(a, b):\n" +"... print(a, b)\n" +"...\n" +">>> f(b=1, *(2,))" #: ../Doc/reference/expressions.rst:1111 msgid "" @@ -1885,13 +1943,12 @@ msgid "a class instance:" msgstr "una instancia de clase:" #: ../Doc/reference/expressions.rst:1197 -#, fuzzy msgid "" "The class must define a :meth:`~object.__call__` method; the effect is then " "the same as if that method was called." msgstr "" -"La clase debe definir un método :meth:`__call__`; el efecto es entonces el " -"mismo que si ese método fuera invocado." +"La clase debe definir un método :meth:`~object.__call__` ; el efecto es " +"entonces el mismo que si ese método fuera invocado." #: ../Doc/reference/expressions.rst:1205 ../Doc/reference/expressions.rst:2004 msgid "Await expression" @@ -1937,7 +1994,7 @@ msgid "" "converted to a common type, and the result is of that type." msgstr "" "El operador de potencia tiene las mismas semánticas que la función " -"incorporada :func:`pow` cuando se invoca con dos argumentos: este yield su " +"incorporada :func:`pow` cuando se invoca con dos argumentos: este produce su " "argumento de la izquierda elevado a la potencia de su argumento de la " "derecha. Los argumentos numéricos se convierten primero en un tipo común y " "el resultado es de ese tipo." @@ -1966,13 +2023,12 @@ msgstr "" "un :exc:`ValueError`.)" #: ../Doc/reference/expressions.rst:1249 -#, fuzzy msgid "" "This operation can be customized using the special :meth:`~object.__pow__` " "and :meth:`~object.__rpow__` methods." msgstr "" "Esta operación se puede personalizar utilizando los métodos especiales :meth:" -"`__mul__` y :meth:`__rmul__`." +"`~object.__pow__` y :meth:`~object.__rpow__`." #: ../Doc/reference/expressions.rst:1255 msgid "Unary arithmetic and bitwise operations" @@ -1985,36 +2041,35 @@ msgstr "" "prioridad:" #: ../Doc/reference/expressions.rst:1272 -#, fuzzy msgid "" "The unary ``-`` (minus) operator yields the negation of its numeric " "argument; the operation can be overridden with the :meth:`~object.__neg__` " "special method." msgstr "" -"El operador unario ``-`` (menos) yield la negación de su argumento numérico; " -"la operación se puede anular con el método especial :meth:`__neg__`." +"El operador unario ``-`` (menos) genera la negación de su argumento " +"numérico; la operación se puede sobreescribir con el método especial :meth:" +"`~object.__neg__`." #: ../Doc/reference/expressions.rst:1280 -#, fuzzy msgid "" "The unary ``+`` (plus) operator yields its numeric argument unchanged; the " "operation can be overridden with the :meth:`~object.__pos__` special method." msgstr "" -"El operador unario ``+`` (más) yield su argumento numérico sin cambios; la " -"operación se puede anular con el método especial :meth:`__pos__`." +"El operador unario ``+`` (más) genera su argumento numérico sin cambios; la " +"operación se puede sobreescribir con el método especial :meth:`~object." +"__pos__`." #: ../Doc/reference/expressions.rst:1287 -#, fuzzy msgid "" "The unary ``~`` (invert) operator yields the bitwise inversion of its " "integer argument. The bitwise inversion of ``x`` is defined as ``-(x+1)``. " "It only applies to integral numbers or to custom objects that override the :" "meth:`~object.__invert__` special method." msgstr "" -"El operador unario ``~`` (invertir) yield la inversión bit a bit de su " +"El operador unario ``~`` (invertir) genera la inversión bit a bit de su " "argumento entero. La inversión bit a bit de ``x`` se define como ``-(x+1)``. " "Solo se aplica a números enteros o a objetos personalizados que anulan el " -"método especial :meth:`__invert__`." +"método especial :meth:`~object.__invert__`." #: ../Doc/reference/expressions.rst:1296 msgid "" @@ -2049,21 +2104,20 @@ msgid "" "case, sequence repetition is performed; a negative repetition factor yields " "an empty sequence." msgstr "" -"El operador ``*`` (multiplicación) yield el producto de sus argumentos. Los " +"El operador ``*`` (multiplicación) genera el producto de sus argumentos. Los " "argumentos pueden ser ambos números, o un argumento debe ser un entero y el " "otro debe ser una secuencia. En el primer caso, los números se convierten a " "un tipo común y luego son multiplicados. En el segundo caso, se realiza una " -"repetición de secuencia; un factor de repetición negativo yield una " +"repetición de secuencia; un factor de repetición negativo produce una " "secuencia vacía." #: ../Doc/reference/expressions.rst:1328 -#, fuzzy msgid "" "This operation can be customized using the special :meth:`~object.__mul__` " "and :meth:`~object.__rmul__` methods." msgstr "" "Esta operación se puede personalizar utilizando los métodos especiales :meth:" -"`__mul__` y :meth:`__rmul__`." +"`~object.__mul__` y :meth:`~object.__rmul__`." #: ../Doc/reference/expressions.rst:1335 msgid "" @@ -2074,13 +2128,12 @@ msgstr "" "matrices. Ningún tipo incorporado en Python implementa este operador." #: ../Doc/reference/expressions.rst:1338 -#, fuzzy msgid "" "This operation can be customized using the special :meth:`~object." "__matmul__` and :meth:`~object.__rmatmul__` methods." msgstr "" "Esta operación se puede personalizar utilizando los métodos especiales :meth:" -"`__mul__` y :meth:`__rmul__`." +"`~object.__matmul__` y :meth:`~object.__rmatmul__`." #: ../Doc/reference/expressions.rst:1349 msgid "" @@ -2106,9 +2159,12 @@ msgid "" "operation can be customized using the special :meth:`~object.__floordiv__` " "and :meth:`~object.__rfloordiv__` methods." msgstr "" +"La operación de división se puede personalizar usando los métodos " +"especiales :meth:`~object.__truediv__` y :meth:`~object.__rtruediv__`. La " +"operación de división entera se puede personalizar usando los métodos " +"especiales :meth:`~object.__floordiv__` y :meth:`~object.__rfloordiv__`." #: ../Doc/reference/expressions.rst:1365 -#, fuzzy msgid "" "The ``%`` (modulo) operator yields the remainder from the division of the " "first argument by the second. The numeric arguments are first converted to " @@ -2119,12 +2175,12 @@ msgid "" "zero); the absolute value of the result is strictly smaller than the " "absolute value of the second operand [#]_." msgstr "" -"El operador ``%`` (módulo) yield el resto de la división del primer " +"El operador ``%`` (módulo) genera el resto de la división del primer " "argumento entre el segundo. Los argumentos numéricos son primero convertidos " -"a un tipo común. Un argumento a la derecha cero genera la excepción :exc:" +"a un tipo común. Un argumento de cero a la derecha genera la excepción :exc:" "`ZeroDivisionError`. Los argumentos pueden ser números de punto flotante, " "ej., ``3.14%0.7`` es igual a ``0.34`` (ya que ``3.14`` es igual a ``4*0.7 + " -"0.34``.) El operador módulo siempre yield un resultado con el mismo signo " +"0.34``.) El operador módulo siempre genera un resultado con el mismo signo " "que su segundo operando (o cero); el valor absoluto del resultado es " "estrictamente más pequeño que el valor absoluto del segundo operando [#]_." @@ -2155,16 +2211,14 @@ msgstr "" "Biblioteca de Python, sección :ref:`old-string-formatting`." #: ../Doc/reference/expressions.rst:1384 -#, fuzzy msgid "" "The *modulo* operation can be customized using the special :meth:`~object." "__mod__` and :meth:`~object.__rmod__` methods." msgstr "" -"Esta operación se puede personalizar utilizando los métodos especiales :meth:" -"`__mul__` y :meth:`__rmul__`." +"La operación *_modulo_* se puede personalizar utilizando los métodos " +"especiales :meth:`~object.__mod__` y :meth:`~object.__rmod__`." #: ../Doc/reference/expressions.rst:1387 -#, fuzzy msgid "" "The floor division operator, the modulo operator, and the :func:`divmod` " "function are not defined for complex numbers. Instead, convert to a " @@ -2173,7 +2227,7 @@ msgstr "" "El operador de división entera a la baja, el operador de módulo y la " "función :func:`divmod` no están definidas para números complejos. En su " "lugar, convierta a un número de punto flotante usando la función :func:`abs` " -"si es apropiado." +"si es necesario." #: ../Doc/reference/expressions.rst:1396 msgid "" @@ -2182,36 +2236,34 @@ msgid "" "type. In the former case, the numbers are converted to a common type and " "then added together. In the latter case, the sequences are concatenated." msgstr "" -"El operador ``+`` (adición) yield la suma de sus argumentos. Los argumentos " +"El operador ``+`` (adición) genera la suma de sus argumentos. Los argumentos " "deben ser ambos números o ambos secuencias del mismo tipo. En el primer " "caso, los números son convertidos a un tipo común y luego sumados. En el " "segundo caso, las secuencias son concatenadas." #: ../Doc/reference/expressions.rst:1401 -#, fuzzy msgid "" "This operation can be customized using the special :meth:`~object.__add__` " "and :meth:`~object.__radd__` methods." msgstr "" "Esta operación se puede personalizar utilizando los métodos especiales :meth:" -"`__add__` y :meth:`__radd__`." +"`~object.__add__` y :meth:`~object.__radd__`." #: ../Doc/reference/expressions.rst:1409 msgid "" "The ``-`` (subtraction) operator yields the difference of its arguments. " "The numeric arguments are first converted to a common type." msgstr "" -"El operador ``-`` (resta) yield la diferencia de sus argumentos. Los " +"El operador ``-`` (sustracción) genera la diferencia de sus argumentos. Los " "argumentos numéricos son primero convertidos a un tipo común." #: ../Doc/reference/expressions.rst:1412 -#, fuzzy msgid "" "This operation can be customized using the special :meth:`~object.__sub__` " "and :meth:`~object.__rsub__` methods." msgstr "" "Esta operación se puede personalizar utilizando los métodos especiales :meth:" -"`__mul__` y :meth:`__rmul__`." +"`~object.__sub__` y :meth:`~object.__rsub__`." #: ../Doc/reference/expressions.rst:1419 msgid "Shifting operations" @@ -2240,6 +2292,11 @@ msgid "" "operation can be customized using the special :meth:`~object.__rshift__` " "and :meth:`~object.__rrshift__` methods." msgstr "" +"Las operaciones de desplazamiento a la izquierda se pueden personalizar " +"usando los métodos especiales :meth:`~object.__lshift__` y :meth:`~object." +"__rlshift__`. Las operaciones de desplazamiento a la derecha se pueden " +"personalizar usando los métodos especiales :meth:`~object.__rshift__` y :" +"meth:`~object.__rrshift__`." #: ../Doc/reference/expressions.rst:1441 msgid "" @@ -2261,38 +2318,37 @@ msgstr "" "prioridad:" #: ../Doc/reference/expressions.rst:1463 -#, fuzzy msgid "" "The ``&`` operator yields the bitwise AND of its arguments, which must be " "integers or one of them must be a custom object overriding :meth:`~object." "__and__` or :meth:`~object.__rand__` special methods." msgstr "" -"El operador ``&`` yield el AND bit a bit de sus argumentos, que deben ser " -"números enteros o uno de ellos debe ser un objeto personalizado que anule " -"los métodos especiales :meth:`__and__` o :meth:`__rand__`." +"El operador ``&`` genera el AND bit a bit de sus argumentos, que deben ser " +"números enteros o uno de ellos debe ser un objeto personalizado que " +"sobreescriba los métodos especiales :meth:`~object.__and__` o :meth:`~object." +"__rand__`." #: ../Doc/reference/expressions.rst:1472 -#, fuzzy msgid "" "The ``^`` operator yields the bitwise XOR (exclusive OR) of its arguments, " "which must be integers or one of them must be a custom object overriding :" "meth:`~object.__xor__` or :meth:`~object.__rxor__` special methods." msgstr "" -"El operador ``^`` yield el XOR bit a bit (OR exclusivo) de sus argumentos, " +"El operador ``^`` genera el XOR bit a bit (OR exclusivo) de sus argumentos, " "que deben ser números enteros o uno de ellos debe ser un objeto " -"personalizado que anule los métodos especiales :meth:`__xor__` o :meth:" -"`__rxor__`." +"personalizado que sobreescriba los métodos especiales :meth:`~object." +"__xor__` o :meth:`~object.__rxor__`." #: ../Doc/reference/expressions.rst:1481 -#, fuzzy msgid "" "The ``|`` operator yields the bitwise (inclusive) OR of its arguments, which " "must be integers or one of them must be a custom object overriding :meth:" "`~object.__or__` or :meth:`~object.__ror__` special methods." msgstr "" -"El operador ``|`` yield el OR bit a bit (inclusive) de sus argumentos, que " +"El operador ``|`` genera el OR bit a bit (inclusive) de sus argumentos, que " "deben ser números enteros o uno de ellos debe ser un objeto personalizado " -"que anule los métodos especiales :meth:`__or__` o :meth:`__ror__`." +"que sobreescriba los métodos especiales :meth:`~object.__or__` o :meth:" +"`~object.__ror__`." #: ../Doc/reference/expressions.rst:1489 msgid "Comparisons" @@ -2316,10 +2372,10 @@ msgid "" "comparison methods` may return non-boolean values. In this case Python will " "call :func:`bool` on such value in boolean contexts." msgstr "" -"Las comparaciones yield valores booleanos: ``True`` o ``False``. " -"Personalizado: dfn: los `métodos de comparación enriquecidos` pueden " -"retornar valores no booleanos. En este caso, Python llamará a :func:`bool` " -"en dicho valor en contextos booleanos." +"Las comparaciones generan valores booleanos: ``True`` o ``False``.: dfn: los " +"`Métodos de comparación enriquecidos` personalizados pueden retornar valores " +"no booleanos. En este caso, Python llamará a :func:`bool` en dicho valor en " +"contextos booleanos." #: ../Doc/reference/expressions.rst:1517 msgid "" @@ -2389,7 +2445,6 @@ msgstr "" "de comparación." #: ../Doc/reference/expressions.rst:1547 -#, fuzzy msgid "" "Because all types are (direct or indirect) subtypes of :class:`object`, they " "inherit the default comparison behavior from :class:`object`. Types can " @@ -2399,8 +2454,8 @@ msgstr "" "Debido a que todos los tipos son subtipos (directos o indirectos) de :class:" "`object`, ellos heredan el comportamiento de comparación predeterminado " "desde :class:`object`. Los tipos pueden personalizar su comportamiento de " -"comparación implementando :dfn:`rich comparison methods` como :meth:" -"`__lt__`, descritos en :ref:`customization`." +"comparación implementando :dfn:`rich comparison methods` como :meth:`~object." +"__lt__`, descritos en :ref:`customization`." #: ../Doc/reference/expressions.rst:1553 msgid "" @@ -2485,15 +2540,14 @@ msgstr "" "Este comportamiento cumple con IEEE 754." #: ../Doc/reference/expressions.rst:1587 -#, fuzzy msgid "" "``None`` and :data:`NotImplemented` are singletons. :PEP:`8` advises that " "comparisons for singletons should always be done with ``is`` or ``is not``, " "never the equality operators." msgstr "" -"``None`` y ``NotImplemented`` son singletons. :PEP:`8` avisa que las " -"comparaciones para singletons deben ser realizadas siempre con ``is`` o ``is " -"not``, nunca los operadores de igualdad." +"``None`` y :data:`NotImplemented` son singletons. :PEP:`8` recomienda que " +"las comparaciones para singletons deben ser realizadas siempre con ``is`` o " +"``is not``, nunca los operadores de igualdad." #: ../Doc/reference/expressions.rst:1591 msgid "" @@ -2781,18 +2835,16 @@ msgstr "" "\"abc\"`` retornará ``True``." #: ../Doc/reference/expressions.rst:1714 -#, fuzzy msgid "" "For user-defined classes which define the :meth:`~object.__contains__` " "method, ``x in y`` returns ``True`` if ``y.__contains__(x)`` returns a true " "value, and ``False`` otherwise." msgstr "" "Para clases definidas por el usuario las cuales definen el método :meth:" -"`__contains__`, ``x in y`` retorna ``True`` si ``y.__contains__(x)`` retorna " -"un valor verdadero y ``False`` si no." +"`~object.__contains__`, ``x in y`` retorna ``True`` si ``y.__contains__(x)`` " +"retorna un valor verdadero y ``False`` en caso contrario." #: ../Doc/reference/expressions.rst:1718 -#, fuzzy msgid "" "For user-defined classes which do not define :meth:`~object.__contains__` " "but do define :meth:`~object.__iter__`, ``x in y`` is ``True`` if some value " @@ -2800,15 +2852,14 @@ msgid "" "while iterating over ``y``. If an exception is raised during the iteration, " "it is as if :keyword:`in` raised that exception." msgstr "" -"Para clases definidas por el usuario las cuales no definen :meth:" -"`__contains__` pero definen :meth:`__iter__`, ``x in y`` es ``True`` si " -"algún valor ``z``, para el cual la expresión ``x is z or x == z`` es " -"verdadera, es producido iterando sobre ``y``. Si una excepción es generada " -"durante la iteración, es como si :keyword:`in` hubiera generado esa " +"Para clases definidas por el usuario las cuales no definen :meth:`~object." +"__contains__` pero sí definen :meth:`~object.__iter__`, ``x in y`` es " +"``True`` si algún valor ``z``, para el cual la expresión ``x is z or x == " +"z`` es verdadera, es producido iterando sobre ``y``. Si una excepción es " +"generada durante la iteración, es como si :keyword:`in` hubiera generado esa " "excepción." #: ../Doc/reference/expressions.rst:1724 -#, fuzzy msgid "" "Lastly, the old-style iteration protocol is tried: if a class defines :meth:" "`~object.__getitem__`, ``x in y`` is ``True`` if and only if there is a non-" @@ -2817,11 +2868,11 @@ msgid "" "exception is raised, it is as if :keyword:`in` raised that exception)." msgstr "" "Por último, se intenta el protocolo de iteración al estilo antiguo: si una " -"clase define :meth:`__getitem__`, ``x in y`` es ``True`` si y sólo si hay un " -"índice entero no negativo *i* tal que ``x is y[i] or x == y[i]`` y ningún " -"entero menor genera la excepción :exc:`IndexError`. (Si cualquier otra " -"excepción es generada, es como si :keyword:`in` hubiera generado esa " -"excepción)." +"clase define :meth:`~object.__getitem__`, ``x in y`` es ``True`` si y sólo " +"si hay un índice entero no negativo *i* tal que ``x is y[i] or x == y[i]`` y " +"ningún índice entero menor genera la excepción :exc:`IndexError`. (Si " +"cualquier otra excepción es generada, es como si :keyword:`in` hubiera " +"generado esa excepción)." #: ../Doc/reference/expressions.rst:1736 msgid "" @@ -2845,7 +2896,7 @@ msgstr "" "Los operadores :keyword:`is` y :keyword:`is not` comprueban la identidad de " "un objeto. ``x is y`` es verdadero si y sólo si *x* e *y* son el mismo " "objeto. La identidad de un Objeto se determina usando la función :meth:`id`. " -"``x is not y`` yield el valor de veracidad inverso. [#]_" +"``x is not y`` produce el valor de veracidad inverso. [#]_" #: ../Doc/reference/expressions.rst:1763 msgid "Boolean operations" @@ -2875,7 +2926,7 @@ msgid "" "The operator :keyword:`not` yields ``True`` if its argument is false, " "``False`` otherwise." msgstr "" -"El operador :keyword:`not` yield ``True`` si su argumento es falso, " +"El operador :keyword:`not` produce ``True`` si su argumento es falso, " "``False`` si no." #: ../Doc/reference/expressions.rst:1788 @@ -2908,7 +2959,7 @@ msgstr "" "el tipo que retornan a ``False`` y ``True``, sino retornan el último " "argumento evaluado. Esto es útil a veces, ej., si ``s`` es una cadena de " "caracteres que debe ser remplazada por un valor predeterminado si está " -"vacía, la expresión ``s or 'foo'`` yield el valor deseado. Debido a que :" +"vacía, la expresión ``s or 'foo'`` produce el valor deseado. Debido a que :" "keyword:`not` tiene que crear un nuevo valor, retorna un valor booleano " "indiferentemente del tipo de su argumento (por ejemplo, ``not 'foo'`` " "produce ``False`` en lugar de ``''``.)" @@ -2926,7 +2977,7 @@ msgid "" msgstr "" "Una expresión de asignación (a veces también llamada \"expresión con " "nombre\" o \"morsa\") asigna un :token:`~python-grammar:expression` a un :" -"token:`~python-grammar:identifier`, al mismo tiempo que devuelve el valor de " +"token:`~python-grammar:identifier`, al mismo tiempo que retorna el valor de " "el :token:`~python-grammar:expresión`." #: ../Doc/reference/expressions.rst:1823 @@ -2939,6 +2990,8 @@ msgid "" "if matching := pattern.search(data):\n" " do_something(matching)" msgstr "" +"if matching := pattern.search(data):\n" +" do_something(matching)" #: ../Doc/reference/expressions.rst:1830 msgid "Or, when processing a file stream in chunks:" @@ -2949,9 +3002,10 @@ msgid "" "while chunk := file.read(9000):\n" " process(chunk)" msgstr "" +"while chunk := file.read(9000):\n" +" process(chunk)" #: ../Doc/reference/expressions.rst:1837 -#, fuzzy msgid "" "Assignment expressions must be surrounded by parentheses when used as " "expression statements and when used as sub-expressions in slicing, " @@ -2961,10 +3015,11 @@ msgid "" "and ``while`` statements." msgstr "" "Las expresiones de asignación deben estar entre paréntesis cuando se usan " -"como subexpresiones en expresiones de división, condicional, lambda, " -"argumento de palabra clave y comprensión si y en declaraciones ``assert`` y " -"``with``. En todos los demás lugares donde se pueden usar, no se requieren " -"paréntesis, incluidas las declaraciones ``if`` y ``while``." +"como expresiones de sentencia y cuando se usan como subexpresiones en " +"expresiones de segmentación, condicional, lambda, argumento de palabra clave " +"y expresiones de comprensión-condicional y en sentencias ``assert``, " +"``with`` y ``assignment``. En todos los demás lugares donde se pueden usar, " +"no se requieren paréntesis, incluidas las sentencias ``if`` y ``while``." #: ../Doc/reference/expressions.rst:1845 msgid "See :pep:`572` for more details about assignment expressions." @@ -3009,14 +3064,16 @@ msgid "" msgstr "" "Las expresiones lambda (a veces denominadas formas lambda) son usadas para " "crear funciones anónimas. La expresión ``lambda parameters: expression`` " -"yield un objeto de función. El objeto sin nombre se comporta como un objeto " -"función con:" +"produce un objeto de función. El objeto sin nombre se comporta como un " +"objeto función con:" #: ../Doc/reference/expressions.rst:1893 msgid "" "def (parameters):\n" " return expression" msgstr "" +"def (parameters):\n" +" return expression" #: ../Doc/reference/expressions.rst:1898 msgid "" @@ -3039,7 +3096,7 @@ msgid "" "expressions in the list. The expressions are evaluated from left to right." msgstr "" "Excepto cuando son parte de un despliegue de lista o conjunto, una lista de " -"expresión conteniendo al menos una coma yield una tupla. El largo de la " +"expresión conteniendo al menos una coma produce una tupla. El largo de la " "tupla es el número de expresiones en la lista. Las expresiones son evaluadas " "de izquierda a derecha." @@ -3063,14 +3120,12 @@ msgstr "" "por :pep:`488`." #: ../Doc/reference/expressions.rst:1939 -#, fuzzy msgid "Any item in an expression list may be starred. See :pep:`646`." msgstr "" -"Desempaquetado iterable en listas de expresiones, originalmente propuesto " -"por :pep:`488`." +"Cualquier elemento en una lista de expresiones puede ser destacado. Vea :pep:" +"`646`." #: ../Doc/reference/expressions.rst:1944 -#, fuzzy msgid "" "A trailing comma is required only to create a one-item tuple, such as ``1," "``; it is optional in all other cases. A single expression without a " @@ -3078,11 +3133,10 @@ msgid "" "expression. (To create an empty tuple, use an empty pair of parentheses: " "``()``.)" msgstr "" -"La coma final sólo es requerida para crear una tupla única (también " -"denominada un *singleton*); es opcional en todos los otros casos. Una única " -"expresión sin una coma final no crea una tupla, si no yield el valor de esa " -"expresión. (Para crear una tupla vacía, usa un par de paréntesis vacío: " -"``()``.)" +"La coma final sólo es requerida para crear una tupla de un único elemento, " +"como ``1,``; es opcional en otros casos. Una única expresión sin una coma " +"final no crea una tupla, si no genera el valor de esa expresión. (Para crear " +"una tupla vacía, usa un par de paréntesis vacío: ``()``.)" #: ../Doc/reference/expressions.rst:1955 msgid "Evaluation order" @@ -3115,6 +3169,12 @@ msgid "" "expr1(expr2, expr3, *expr4, **expr5)\n" "expr3, expr4 = expr1, expr2" msgstr "" +"expr1, expr2, expr3, expr4\n" +"(expr1, expr2, expr3, expr4)\n" +"{expr1: expr2, expr3: expr4}\n" +"expr1 + expr2 * (expr3 - expr4)\n" +"expr1(expr2, expr3, *expr4, **expr5)\n" +"expr3, expr4 = expr1, expr2" #: ../Doc/reference/expressions.rst:1976 msgid "Operator precedence" @@ -3512,7 +3572,7 @@ msgstr "object" #: ../Doc/reference/expressions.rst:162 msgid "parenthesized form" -msgstr "Formas entre paréntesis" +msgstr "formas entre paréntesis" #: ../Doc/reference/expressions.rst:162 ../Doc/reference/expressions.rst:393 #: ../Doc/reference/expressions.rst:1001 @@ -3684,7 +3744,7 @@ msgstr "corutina" #: ../Doc/reference/expressions.rst:516 msgid "yield from expression" -msgstr "yield de expresión" +msgstr "yield from expression" #: ../Doc/reference/expressions.rst:569 msgid "StopIteration" @@ -3980,7 +4040,7 @@ msgstr "operador binario" #: ../Doc/reference/expressions.rst:1404 msgid "subtraction" -msgstr "Suscripciones" +msgstr "sustracción" #: ../Doc/reference/expressions.rst:1421 msgid "shifting" @@ -4132,9 +4192,8 @@ msgid "named expression" msgstr "expresión con nombre" #: ../Doc/reference/expressions.rst:1805 -#, fuzzy msgid "assignment" -msgstr "argumento" +msgstr "asignación" #: ../Doc/reference/expressions.rst:1854 msgid "conditional" From 267d9f3971dce96a546953bc37030c1503f3e72c Mon Sep 17 00:00:00 2001 From: Joseph Salgado <49181840+xooseph@users.noreply.github.com> Date: Tue, 6 Jan 2026 09:58:34 -0600 Subject: [PATCH 10/10] Traducido archivo extending/embedding (#3340) Closes #3196 --------- Co-authored-by: rtobar --- extending/embedding.po | 209 +++++++++++++++++++++++++++++++++++++---- 1 file changed, 190 insertions(+), 19 deletions(-) diff --git a/extending/embedding.po b/extending/embedding.po index d3008101d8..d60419a8dd 100644 --- a/extending/embedding.po +++ b/extending/embedding.po @@ -11,15 +11,16 @@ msgstr "" "Project-Id-Version: Python 3.8\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-11-21 16:38-0300\n" -"PO-Revision-Date: 2020-06-24 23:14+0200\n" +"PO-Revision-Date: 2024-11-30 20:35-0600\n" "Last-Translator: Cristián Maureira-Fredes \n" -"Language: es\n" "Language-Team: python-doc-es\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"Language: es\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" "Generated-By: Babel 2.16.0\n" +"X-Generator: Poedit 3.5\n" #: ../Doc/extending/embedding.rst:8 msgid "Embedding Python in Another Application" @@ -160,6 +161,40 @@ msgid "" " Py_ExitStatusException(status);\n" "}" msgstr "" +"#define PY_SSIZE_T_CLEAN\n" +"#include \n" +"\n" +"int\n" +"main(int argc, char *argv[])\n" +"{\n" +" PyStatus status;\n" +" PyConfig config;\n" +" PyConfig_InitPythonConfig(&config);\n" +"\n" +" /* optional but recommended */\n" +" status = PyConfig_SetBytesString(&config, &config.program_name, " +"argv[0]);\n" +" if (PyStatus_Exception(status)) {\n" +" goto exception;\n" +" }\n" +"\n" +" status = Py_InitializeFromConfig(&config);\n" +" if (PyStatus_Exception(status)) {\n" +" goto exception;\n" +" }\n" +" PyConfig_Clear(&config);\n" +"\n" +" PyRun_SimpleString(\"from time import time,ctime\\n\"\n" +" \"print('Today is', ctime(time()))\\n\");\n" +" if (Py_FinalizeEx() < 0) {\n" +" exit(120);\n" +" }\n" +" return 0;\n" +"\n" +" exception:\n" +" PyConfig_Clear(&config);\n" +" Py_ExitStatusException(status);\n" +"}" #: ../Doc/extending/embedding.rst:92 msgid "" @@ -168,9 +203,12 @@ msgid "" "3.13, but we keep it here for backward compatibility. See :ref:`arg-parsing-" "string-and-buffers` for a description of this macro." msgstr "" +"``#define PY_SSIZE_T_CLEAN`` se usaba para indicar que ``Py_ssize_t`` debería " +"usarse en algunas APIs en lugar de ``int``. No es necesario desde Python " +"3.13, pero lo mantenemos aquí por compatibilidad. Ver :ref:`arg-parsing-" +"string-and-buffers` para una descripción de esta macro." #: ../Doc/extending/embedding.rst:97 -#, fuzzy msgid "" "Setting :c:member:`PyConfig.program_name` should be called before :c:func:" "`Py_InitializeFromConfig` to inform the interpreter about paths to Python " @@ -184,16 +222,16 @@ msgid "" "`PyRun_SimpleFile` function, which saves you the trouble of allocating " "memory space and loading the file contents." msgstr "" -"La función :c:func:`Py_SetProgramName` debe llamarse antes de :c:func:" -"`Py_Initialize` para informar al intérprete sobre las rutas a las " -"bibliotecas de tiempo de ejecución de Python. A continuación, el intérprete " -"de Python se inicializa con :c:func:`Py_Initialize`, seguido de la ejecución " -"de un script Python codificado que imprime la fecha y la hora. Luego, la " -"llamada :c:func:`Py_FinalizeEx` cierra el intérprete, seguido por el final " -"del programa. En un programa real, es posible que desee obtener el script de " -"Python de otra fuente, tal vez una rutina de editor de texto, un archivo o " -"una base de datos. Obtener el código Python de un archivo se puede hacer " -"mejor usando la función :c:func:`PyRun_SimpleFile`, que le ahorra la " +"La configuración :c:member:`PyConfig.program_name` debe llamarse antes de :c:" +"func:`Py_InitializeFromConfig` para informar al intérprete sobre las rutas a " +"las bibliotecas de tiempo de ejecución de Python. A continuación, el " +"intérprete de Python se inicializa con :c:func:`Py_Initialize`, seguido de " +"la ejecución de un script Python codificado que imprime la fecha y la hora. " +"Luego, la llamada :c:func:`Py_FinalizeEx` cierra el intérprete, seguido por " +"el final del programa. En un programa real, es posible que desee obtener el " +"script de Python de otra fuente, tal vez una rutina de editor de texto, un " +"archivo o una base de datos. Obtener el código Python de un archivo se puede " +"hacer mejor usando la función :c:func:`PyRun_SimpleFile`, que le ahorra la " "molestia de asignar espacio de memoria y cargar el contenido del archivo." #: ../Doc/extending/embedding.rst:112 @@ -383,6 +421,78 @@ msgid "" " return 0;\n" "}\n" msgstr "" +"#define PY_SSIZE_T_CLEAN\n" +"#include \n" +"\n" +"int\n" +"main(int argc, char *argv[])\n" +"{\n" +" PyObject *pName, *pModule, *pFunc;\n" +" PyObject *pArgs, *pValue;\n" +" int i;\n" +"\n" +" if (argc < 3) {\n" +" fprintf(stderr,\"Usage: call pythonfile funcname [args]\\n\");\n" +" return 1;\n" +" }\n" +"\n" +" Py_Initialize();\n" +" pName = PyUnicode_DecodeFSDefault(argv[1]);\n" +" /* Error checking of pName left out */\n" +"\n" +" pModule = PyImport_Import(pName);\n" +" Py_DECREF(pName);\n" +"\n" +" if (pModule != NULL) {\n" +" pFunc = PyObject_GetAttrString(pModule, argv[2]);\n" +" /* pFunc is a new reference */\n" +"\n" +" if (pFunc && PyCallable_Check(pFunc)) {\n" +" pArgs = PyTuple_New(argc - 3);\n" +" for (i = 0; i < argc - 3; ++i) {\n" +" pValue = PyLong_FromLong(atoi(argv[i + 3]));\n" +" if (!pValue) {\n" +" Py_DECREF(pArgs);\n" +" Py_DECREF(pModule);\n" +" fprintf(stderr, \"Cannot convert argument\\n\");\n" +" return 1;\n" +" }\n" +" /* pValue reference stolen here: */\n" +" PyTuple_SetItem(pArgs, i, pValue);\n" +" }\n" +" pValue = PyObject_CallObject(pFunc, pArgs);\n" +" Py_DECREF(pArgs);\n" +" if (pValue != NULL) {\n" +" printf(\"Result of call: %ld\\n\", PyLong_AsLong(pValue));\n" +" Py_DECREF(pValue);\n" +" }\n" +" else {\n" +" Py_DECREF(pFunc);\n" +" Py_DECREF(pModule);\n" +" PyErr_Print();\n" +" fprintf(stderr,\"Call failed\\n\");\n" +" return 1;\n" +" }\n" +" }\n" +" else {\n" +" if (PyErr_Occurred())\n" +" PyErr_Print();\n" +" fprintf(stderr, \"Cannot find function \\\"%s\\\"\\n\", " +"argv[2]);\n" +" }\n" +" Py_XDECREF(pFunc);\n" +" Py_DECREF(pModule);\n" +" }\n" +" else {\n" +" PyErr_Print();\n" +" fprintf(stderr, \"Failed to load \\\"%s\\\"\\n\", argv[1]);\n" +" return 1;\n" +" }\n" +" if (Py_FinalizeEx() < 0) {\n" +" return 120;\n" +" }\n" +" return 0;\n" +"}\n" #: ../Doc/extending/embedding.rst:165 msgid "" @@ -407,6 +517,12 @@ msgid "" " c = c + b\n" " return c" msgstr "" +"def multiply(a,b):\n" +" print(\"Will compute\", a, \"times\", b)\n" +" c = 0\n" +" for i in range(0, a):\n" +" c = c + b\n" +" return c" #: ../Doc/extending/embedding.rst:180 msgid "then the result should be:" @@ -418,6 +534,9 @@ msgid "" "Will compute 3 times 2\n" "Result of call: 6" msgstr "" +"$ call multiply multiply 3 2\n" +"Will compute 3 times 2\n" +"Result of call: 6" #: ../Doc/extending/embedding.rst:188 msgid "" @@ -437,6 +556,10 @@ msgid "" "/* Error checking of pName left out */\n" "pModule = PyImport_Import(pName);" msgstr "" +"Py_Initialize();\n" +"pName = PyUnicode_DecodeFSDefault(argv[1]);\n" +"/* Error checking of pName left out */\n" +"pModule = PyImport_Import(pName);" #: ../Doc/extending/embedding.rst:197 msgid "" @@ -460,6 +583,13 @@ msgid "" "}\n" "Py_XDECREF(pFunc);" msgstr "" +"pFunc = PyObject_GetAttrString(pModule, argv[2]);\n" +"/* pFunc is a new reference */\n" +"\n" +"if (pFunc && PyCallable_Check(pFunc)) {\n" +" ...\n" +"}\n" +"Py_XDECREF(pFunc);" #: ../Doc/extending/embedding.rst:210 msgid "" @@ -477,7 +607,7 @@ msgstr "" #: ../Doc/extending/embedding.rst:216 msgid "pValue = PyObject_CallObject(pFunc, pArgs);" -msgstr "" +msgstr "pValue = PyObject_CallObject(pFunc, pArgs);" #: ../Doc/extending/embedding.rst:218 msgid "" @@ -544,6 +674,33 @@ msgid "" " return PyModule_Create(&EmbModule);\n" "}" msgstr "" +"static int numargs=0;\n" +"\n" +"/* Return the number of arguments of the application command line */\n" +"static PyObject*\n" +"emb_numargs(PyObject *self, PyObject *args)\n" +"{\n" +" if(!PyArg_ParseTuple(args, \":numargs\"))\n" +" return NULL;\n" +" return PyLong_FromLong(numargs);\n" +"}\n" +"\n" +"static PyMethodDef EmbMethods[] = {\n" +" {\"numargs\", emb_numargs, METH_VARARGS,\n" +" \"Return the number of arguments received by the process.\"},\n" +" {NULL, NULL, 0, NULL}\n" +"};\n" +"\n" +"static PyModuleDef EmbModule = {\n" +" PyModuleDef_HEAD_INIT, \"emb\", NULL, -1, EmbMethods,\n" +" NULL, NULL, NULL, NULL\n" +"};\n" +"\n" +"static PyObject*\n" +"PyInit_emb(void)\n" +"{\n" +" return PyModule_Create(&EmbModule);\n" +"}" #: ../Doc/extending/embedding.rst:265 msgid "" @@ -559,16 +716,17 @@ msgid "" "numargs = argc;\n" "PyImport_AppendInittab(\"emb\", &PyInit_emb);" msgstr "" +"numargs = argc;\n" +"PyImport_AppendInittab(\"emb\", &PyInit_emb);" #: ../Doc/extending/embedding.rst:271 -#, fuzzy msgid "" "These two lines initialize the ``numargs`` variable, and make the :func:`!" "emb.numargs` function accessible to the embedded Python interpreter. With " "these extensions, the Python script can do things like" msgstr "" "Estas dos líneas inicializan la variable ``numargs`` y hacen que la función :" -"func:`emb.numargs` sea accesible para el intérprete de Python incorporado. " +"func:`!emb.numargs` sea accesible para el intérprete de Python incorporado. " "Con estas extensiones, el script de Python puede hacer cosas como" #: ../Doc/extending/embedding.rst:275 @@ -576,6 +734,8 @@ msgid "" "import emb\n" "print(\"Number of arguments\", emb.numargs())" msgstr "" +"import emb\n" +"print(\"Number of arguments\", emb.numargs())" #: ../Doc/extending/embedding.rst:280 msgid "" @@ -647,14 +807,17 @@ msgid "" "-I/opt/include/python3.11 -I/opt/include/python3.11 -Wsign-compare -DNDEBUG " "-g -fwrapv -O3 -Wall" msgstr "" +"$ /opt/bin/python3.11-config --cflags\n" +"-I/opt/include/python3.11 -I/opt/include/python3.11 -Wsign-compare -DNDEBUG " +"-g -fwrapv -O3 -Wall" #: ../Doc/extending/embedding.rst:323 -#, fuzzy msgid "" "``pythonX.Y-config --ldflags --embed`` will give you the recommended flags " "when linking:" msgstr "" -"``pythonX.Y-config --ldflags`` le dará las banderas recomendadas al vincular:" +"``pythonX.Y-config --ldflags --embed`` le dará las banderas recomendadas al " +"vincular:" #: ../Doc/extending/embedding.rst:326 msgid "" @@ -662,6 +825,9 @@ msgid "" "-L/opt/lib/python3.11/config-3.11-x86_64-linux-gnu -L/opt/lib -lpython3.11 -" "lpthread -ldl -lutil -lm" msgstr "" +"$ /opt/bin/python3.11-config --ldflags --embed\n" +"-L/opt/lib/python3.11/config-3.11-x86_64-linux-gnu -L/opt/lib -lpython3.11 -" +"lpthread -ldl -lutil -lm" #: ../Doc/extending/embedding.rst:332 msgid "" @@ -703,3 +869,8 @@ msgid "" ">>> sysconfig.get_config_var('LINKFORSHARED')\n" "'-Xlinker -export-dynamic'" msgstr "" +">>> import sysconfig\n" +">>> sysconfig.get_config_var('LIBS')\n" +"'-lpthread -ldl -lutil'\n" +">>> sysconfig.get_config_var('LINKFORSHARED')\n" +"'-Xlinker -export-dynamic'"