diff --git a/TRANSLATORS b/TRANSLATORS index 3097005355..c8de775c1c 100644 --- a/TRANSLATORS +++ b/TRANSLATORS @@ -23,6 +23,7 @@ Nicolás Demarchi (@gilgamezh) Ignacio Dopazo (@ignaciodopazo) Nahuel Espinosa (@nahueespinosa) Xavi Francisco (@srxavi) +Sergio Infante (@neosergio) Martín Gaitán (@mgaitan) Manuel Kaufmann (@humitos) Pablo Lobariñas (@Qkolnek) diff --git a/dictionaries/library_ctypes.txt b/dictionaries/library_ctypes.txt new file mode 100644 index 0000000000..550be81f49 --- /dev/null +++ b/dictionaries/library_ctypes.txt @@ -0,0 +1,23 @@ +dll +dlls +ctypes +char +offset +api +posix +windows +printf +postprocesar +postprocesamiento +cdecl +instanciados +argtypes +instanciados +copiándolas +GetWindowRect +DllCanUnloadNow +DllGetClassObject +redimensiona +subclasificando +inicializadas +inicializarán diff --git a/library/ctypes.po b/library/ctypes.po index 56adbd4b3a..b0707e94cc 100644 --- a/library/ctypes.po +++ b/library/ctypes.po @@ -6,23 +6,24 @@ # Check https://github.com/PyCampES/python-docs-es/blob/3.8/TRANSLATORS to # get the list of volunteers # -#, fuzzy msgid "" msgstr "" "Project-Id-Version: Python 3.8\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-05-05 12:54+0200\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME \n" +"PO-Revision-Date: 2020-08-22 12:54+0200\n" "Language-Team: python-doc-es\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" "Generated-By: Babel 2.8.0\n" +"Last-Translator: Cristián Maureira-Fredes \n" +"X-Generator: Poedit 2.3.1\n" +"Language: es\n" #: ../Doc/library/ctypes.rst:2 msgid ":mod:`ctypes` --- A foreign function library for Python" -msgstr "" +msgstr ":mod:`ctypes` --- Una biblioteca de funciones foráneas para Python" #: ../Doc/library/ctypes.rst:11 msgid "" @@ -30,10 +31,14 @@ msgid "" "compatible data types, and allows calling functions in DLLs or shared " "libraries. It can be used to wrap these libraries in pure Python." msgstr "" +":mod:`ctypes` es una biblioteca de funciones foráneas para Python. " +"Proporciona tipos de datos compatibles con C y permite llamar a funciones en " +"archivos DLL o bibliotecas compartidas. Se puede utilizar para envolver " +"estas bibliotecas en Python puro." #: ../Doc/library/ctypes.rst:19 msgid "ctypes tutorial" -msgstr "" +msgstr "tutorial de ctypes" #: ../Doc/library/ctypes.rst:21 msgid "" @@ -41,6 +46,10 @@ msgid "" "they actually work. Since some code samples behave differently under Linux, " "Windows, or Mac OS X, they contain doctest directives in comments." msgstr "" +"Nota: Los ejemplos de código de este tutorial utilizan :mod:`doctest` para " +"asegurarse de que realmente funcionan. Dado que algunos ejemplos de código " +"se comportan de manera diferente en Linux, Windows o Mac OS X, contienen " +"directivas de prueba en los comentarios." #: ../Doc/library/ctypes.rst:25 msgid "" @@ -49,16 +58,23 @@ msgid "" "`c_long`. So, you should not be confused if :class:`c_long` is printed if " "you would expect :class:`c_int` --- they are actually the same type." msgstr "" +"Nota: Algunos ejemplos de código hacen referencia al tipo ctypes :class:" +"`c_int`. En las plataformas donde ``sizeof(long) == sizeof(int)`` es un " +"alias de :class:`c_long`. Por lo tanto, no debe confundirse si :class:" +"`c_long` se imprime si espera :class:`c_int` --- son en realidad del mismo " +"tipo." #: ../Doc/library/ctypes.rst:33 msgid "Loading dynamic link libraries" -msgstr "" +msgstr "Carga de bibliotecas de enlaces dinámicos" #: ../Doc/library/ctypes.rst:35 msgid "" ":mod:`ctypes` exports the *cdll*, and on Windows *windll* and *oledll* " "objects, for loading dynamic link libraries." msgstr "" +":mod:`ctypes` exporta los objetos *cdll* y en Windows *windll* y *oledll*, " +"para cargar bibliotecas de enlaces dinámicos." #: ../Doc/library/ctypes.rst:38 msgid "" @@ -70,12 +86,22 @@ msgid "" "error code is used to automatically raise an :class:`OSError` exception when " "the function call fails." msgstr "" +"Las bibliotecas se cargan accediendo a ellas como atributos de estos " +"objetos. *cdll* carga bibliotecas que exportan funciones utilizando la " +"convención de llamada estándar ``cdecl``, mientras que las bibliotecas " +"*windll* llaman a funciones mediante la convención de llamada ``stdcall``. " +"*oledll* también utiliza la convención de llamada ``stdcall`` y asume que " +"las funciones retornan un código de error Windows :c:type:`HRESULT`. El " +"código de error se utiliza para generar automáticamente una excepción :class:" +"`OSError` cuando se produce un error en la llamada a la función." #: ../Doc/library/ctypes.rst:46 msgid "" "Windows errors used to raise :exc:`WindowsError`, which is now an alias of :" "exc:`OSError`." msgstr "" +"Los errores de Windows solían generar :exc:`WindowsError`, que ahora es un " +"alias de :exc:`OSError`." #: ../Doc/library/ctypes.rst:51 msgid "" @@ -83,10 +109,13 @@ msgid "" "C library containing most standard C functions, and uses the cdecl calling " "convention::" msgstr "" +"Estos son algunos ejemplos para Windows. Tener en cuenta que ''msvcrt'' es " +"la biblioteca estándar de MS C que contiene la mayoría de las funciones C " +"estándar y utiliza la convención de llamada cdecl::" #: ../Doc/library/ctypes.rst:63 msgid "Windows appends the usual ``.dll`` file suffix automatically." -msgstr "" +msgstr "Windows agrega automáticamente la extensión común ``.dll``." #: ../Doc/library/ctypes.rst:66 msgid "" @@ -95,6 +124,10 @@ msgid "" "used by Python. Where possible, use native Python functionality, or else " "import and use the ``msvcrt`` module." msgstr "" +"Acceder a la biblioteca estándar de C a través de ``cdll.msvcrt`` utilizará " +"una versión obsoleta de la biblioteca que puede ser incompatible con la " +"utilizada por Python. Cuando sea posible, use la funcionalidad nativa de " +"Python, o bien importe y use el módulo ``msvcrt``." #: ../Doc/library/ctypes.rst:71 msgid "" @@ -104,14 +137,19 @@ msgid "" "you should load the library by creating an instance of CDLL by calling the " "constructor::" msgstr "" +"En Linux, se requiere especificar el nombre de archivo *incluyendo* la " +"extensión para cargar una biblioteca, por lo que no se puede utilizar el " +"acceso por atributos para cargar las bibliotecas. Se debe usar el método :" +"meth:`LoadLibrary` de los cargadores de dll, o se debe cargar la biblioteca " +"creando una instancia de CDLL llamando al constructor::" #: ../Doc/library/ctypes.rst:89 msgid "Accessing functions from loaded dlls" -msgstr "" +msgstr "Acceder a las funciones de los dll cargados" #: ../Doc/library/ctypes.rst:91 msgid "Functions are accessed as attributes of dll objects::" -msgstr "" +msgstr "Las funciones se acceden como atributos de los objetos dll::" #: ../Doc/library/ctypes.rst:106 msgid "" @@ -123,6 +161,13 @@ msgid "" "following C prototype, and a macro is used to expose one of them as " "``GetModuleHandle`` depending on whether UNICODE is defined or not::" msgstr "" +"Nótese que las dlls del sistema win32 como ``kernel32`` y ``user32`` a " +"menudo exportan versiones ANSI y UNICODE de una función. La versión UNICODE " +"se exporta con una ``W`` añadida al nombre, mientras que la versión ANSI se " +"exporta con una ``A`` añadida al nombre. La función ``GetModuleHandle`` de " +"win32, que retorna un *manejador de módulo* para un nombre de módulo dado, " +"tiene el siguiente prototipo de C, y se usa una macro para exponer uno de " +"ellos como ``GetModuleHandle`` dependiendo de si UNICODE está definido o no::" #: ../Doc/library/ctypes.rst:119 msgid "" @@ -130,6 +175,10 @@ msgid "" "version you need by specifying ``GetModuleHandleA`` or ``GetModuleHandleW`` " "explicitly, and then call it with bytes or string objects respectively." msgstr "" +"*windll* no intenta seleccionar una de ellas por arte de magia, se debe " +"acceder a la versión que se necesita especificando ``GetModuleHandleA`` o " +"``GetModuleHandleW`` explícitamente, y luego llamarlo con bytes u objetos de " +"cadena respectivamente." #: ../Doc/library/ctypes.rst:123 msgid "" @@ -137,6 +186,9 @@ msgid "" "identifiers, like ``\"??2@YAPAXI@Z\"``. In this case you have to use :func:" "`getattr` to retrieve the function::" msgstr "" +"A veces, las dlls exportan funciones con nombres que no son identificadores " +"válidos de Python, como ``\"??2@YAPAXI@Z\"``. En este caso tienes que usar :" +"func:`getattr` para recuperar la función::" #: ../Doc/library/ctypes.rst:131 msgid "" @@ -144,10 +196,13 @@ msgid "" "functions can be accessed by indexing the dll object with the ordinal " "number::" msgstr "" +"En Windows, algunas dlls exportan funciones no por nombre sino por ordinal. " +"Se pueden acceder a estas funciones indexando el objeto dll con el número " +"ordinal::" #: ../Doc/library/ctypes.rst:148 msgid "Calling functions" -msgstr "" +msgstr "Funciones de llamada" #: ../Doc/library/ctypes.rst:150 msgid "" @@ -156,24 +211,34 @@ msgid "" "Unix epoch, and the ``GetModuleHandleA()`` function, which returns a win32 " "module handle." msgstr "" +"Puedes llamar a estas funciones como cualquier otra función en Python. Este " +"ejemplo utiliza la función ``time()``, que retorna el tiempo del sistema en " +"segundos desde la época de Unix, y la función ``GetModuleHandleA()``, que " +"retorna un manejador de módulo de win32." #: ../Doc/library/ctypes.rst:155 msgid "" "This example calls both functions with a ``NULL`` pointer (``None`` should " "be used as the ``NULL`` pointer)::" msgstr "" +"Este ejemplo llama a ambas funciones con un puntero ``NULL`` (``None`` debe " +"ser usado como el puntero ``NULL``)::" #: ../Doc/library/ctypes.rst:164 msgid "" ":exc:`ValueError` is raised when you call an ``stdcall`` function with the " "``cdecl`` calling convention, or vice versa::" msgstr "" +":exc:`ValueError` es lanzado cuando se llama a una función ``stdcall`` con " +"la convención de llamada ``cdecl``, o viceversa::" #: ../Doc/library/ctypes.rst:179 msgid "" "To find out the correct calling convention you have to look into the C " "header file or the documentation for the function you want to call." msgstr "" +"Para saber la convención de llamada correcta, hay que mirar en el archivo de " +"encabezado C o en la documentación de la función que se quiere llamar." #: ../Doc/library/ctypes.rst:182 msgid "" @@ -181,6 +246,9 @@ msgid "" "prevent crashes from general protection faults when functions are called " "with invalid argument values::" msgstr "" +"En Windows, :mod:`ctypes` utiliza la gestión de excepciones estructurada de " +"win32 para evitar que se produzcan fallos de protección general cuando se " +"llaman funciones con valores de argumento inválidos::" #: ../Doc/library/ctypes.rst:192 msgid "" @@ -189,6 +257,10 @@ msgid "" "debugging crashes (e.g. from segmentation faults produced by erroneous C " "library calls)." msgstr "" +"Sin embargo, hay suficientes maneras de bloquear Python con :mod:`ctypes`, " +"así que debes tener cuidado de todos modos. El módulo :mod:`faulthandler` " +"puede ser útil para depurar bloqueos (por ejemplo, provenientes de fallos de " +"segmentación producidos por llamadas erróneas a la biblioteca C)." #: ../Doc/library/ctypes.rst:197 msgid "" @@ -200,72 +272,83 @@ msgid "" "platforms default C :c:type:`int` type, their value is masked to fit into " "the C type." msgstr "" +"Los objetos ``None``, enteros, bytes y cadenas (unicode) son los únicos " +"objetos nativos de Python que pueden ser usados directamente como parámetros " +"en estas llamadas a funciones. ``None`` se pasa como puntero de C ``NULL``, " +"los objetos bytes y las cadenas se pasan como puntero al bloque de memoria " +"que contiene sus datos (:c:type:`char *` o :c:type:`wchar_t *`). Los enteros " +"de Python se pasan como por defecto en la plataforma como tipo :c:type:`int` " +"de C, su valor se enmascara para que encuadre en el tipo C." #: ../Doc/library/ctypes.rst:204 msgid "" "Before we move on calling functions with other parameter types, we have to " "learn more about :mod:`ctypes` data types." msgstr "" +"Antes de pasar a llamar funciones con otros tipos de parámetros, tenemos que " +"aprender más sobre los tipos de datos :mod:`ctypes`." #: ../Doc/library/ctypes.rst:211 ../Doc/library/ctypes.rst:2128 msgid "Fundamental data types" -msgstr "" +msgstr "Tipos de datos fundamentales" #: ../Doc/library/ctypes.rst:213 msgid ":mod:`ctypes` defines a number of primitive C compatible data types:" msgstr "" +":mod:`ctypes` define un número de tipos de datos primitivos compatibles con " +"C:" #: ../Doc/library/ctypes.rst:216 msgid "ctypes type" -msgstr "" +msgstr "tipo ctypes" #: ../Doc/library/ctypes.rst:216 msgid "C type" -msgstr "" +msgstr "Tipo C" #: ../Doc/library/ctypes.rst:216 msgid "Python type" -msgstr "" +msgstr "Tipo Python" #: ../Doc/library/ctypes.rst:218 msgid ":class:`c_bool`" -msgstr "" +msgstr ":class:`c_bool`" #: ../Doc/library/ctypes.rst:218 msgid ":c:type:`_Bool`" -msgstr "" +msgstr ":c:type:`_Bool`" #: ../Doc/library/ctypes.rst:218 msgid "bool (1)" -msgstr "" +msgstr "bool (1)" #: ../Doc/library/ctypes.rst:220 msgid ":class:`c_char`" -msgstr "" +msgstr ":class:`c_char`" #: ../Doc/library/ctypes.rst:220 ../Doc/library/ctypes.rst:224 msgid ":c:type:`char`" -msgstr "" +msgstr ":c:type:`char`" #: ../Doc/library/ctypes.rst:220 msgid "1-character bytes object" -msgstr "" +msgstr "Un objeto bytes de 1-caracter" #: ../Doc/library/ctypes.rst:222 msgid ":class:`c_wchar`" -msgstr "" +msgstr ":class:`c_wchar`" #: ../Doc/library/ctypes.rst:222 msgid ":c:type:`wchar_t`" -msgstr "" +msgstr ":c:type:`wchar_t`" #: ../Doc/library/ctypes.rst:222 msgid "1-character string" -msgstr "" +msgstr "Una cadena de 1-caracter" #: ../Doc/library/ctypes.rst:224 msgid ":class:`c_byte`" -msgstr "" +msgstr ":class:`c_byte`" #: ../Doc/library/ctypes.rst:224 ../Doc/library/ctypes.rst:226 #: ../Doc/library/ctypes.rst:228 ../Doc/library/ctypes.rst:230 @@ -274,175 +357,179 @@ msgstr "" #: ../Doc/library/ctypes.rst:240 ../Doc/library/ctypes.rst:242 #: ../Doc/library/ctypes.rst:245 ../Doc/library/ctypes.rst:247 msgid "int" -msgstr "" +msgstr "entero" #: ../Doc/library/ctypes.rst:226 msgid ":class:`c_ubyte`" -msgstr "" +msgstr ":class:`c_ubyte`" #: ../Doc/library/ctypes.rst:226 msgid ":c:type:`unsigned char`" -msgstr "" +msgstr ":c:type:`unsigned char`" #: ../Doc/library/ctypes.rst:228 msgid ":class:`c_short`" -msgstr "" +msgstr ":class:`c_short`" #: ../Doc/library/ctypes.rst:228 msgid ":c:type:`short`" -msgstr "" +msgstr ":c:type:`short`" #: ../Doc/library/ctypes.rst:230 msgid ":class:`c_ushort`" -msgstr "" +msgstr ":class:`c_ushort`" #: ../Doc/library/ctypes.rst:230 msgid ":c:type:`unsigned short`" -msgstr "" +msgstr ":c:type:`unsigned short`" #: ../Doc/library/ctypes.rst:232 msgid ":class:`c_int`" -msgstr "" +msgstr ":class:`c_int`" #: ../Doc/library/ctypes.rst:232 msgid ":c:type:`int`" -msgstr "" +msgstr ":c:type:`int`" #: ../Doc/library/ctypes.rst:234 msgid ":class:`c_uint`" -msgstr "" +msgstr ":class:`c_uint`" #: ../Doc/library/ctypes.rst:234 msgid ":c:type:`unsigned int`" -msgstr "" +msgstr ":c:type:`unsigned int`" #: ../Doc/library/ctypes.rst:236 msgid ":class:`c_long`" -msgstr "" +msgstr ":class:`c_long`" #: ../Doc/library/ctypes.rst:236 msgid ":c:type:`long`" -msgstr "" +msgstr ":c:type:`long`" #: ../Doc/library/ctypes.rst:238 msgid ":class:`c_ulong`" -msgstr "" +msgstr ":class:`c_ulong`" #: ../Doc/library/ctypes.rst:238 msgid ":c:type:`unsigned long`" -msgstr "" +msgstr ":c:type:`unsigned long`" #: ../Doc/library/ctypes.rst:240 msgid ":class:`c_longlong`" -msgstr "" +msgstr ":class:`c_longlong`" #: ../Doc/library/ctypes.rst:240 msgid ":c:type:`__int64` or :c:type:`long long`" -msgstr "" +msgstr ":c:type:`__int64` o :c:type:`long long`" #: ../Doc/library/ctypes.rst:242 msgid ":class:`c_ulonglong`" -msgstr "" +msgstr ":class:`c_ulonglong`" #: ../Doc/library/ctypes.rst:242 msgid ":c:type:`unsigned __int64` or :c:type:`unsigned long long`" -msgstr "" +msgstr ":c:type:`unsigned __int64` o :c:type:`unsigned long long`" #: ../Doc/library/ctypes.rst:245 msgid ":class:`c_size_t`" -msgstr "" +msgstr ":class:`c_size_t`" #: ../Doc/library/ctypes.rst:245 msgid ":c:type:`size_t`" -msgstr "" +msgstr ":c:type:`size_t`" #: ../Doc/library/ctypes.rst:247 msgid ":class:`c_ssize_t`" -msgstr "" +msgstr ":class:`c_ssize_t`" #: ../Doc/library/ctypes.rst:247 msgid ":c:type:`ssize_t` or :c:type:`Py_ssize_t`" -msgstr "" +msgstr ":c:type:`ssize_t` o :c:type:`Py_ssize_t`" #: ../Doc/library/ctypes.rst:250 msgid ":class:`c_float`" -msgstr "" +msgstr ":class:`c_float`" #: ../Doc/library/ctypes.rst:250 msgid ":c:type:`float`" -msgstr "" +msgstr ":c:type:`float`" #: ../Doc/library/ctypes.rst:250 ../Doc/library/ctypes.rst:252 #: ../Doc/library/ctypes.rst:254 msgid "float" -msgstr "" +msgstr "flotante" #: ../Doc/library/ctypes.rst:252 msgid ":class:`c_double`" -msgstr "" +msgstr ":class:`c_double`" #: ../Doc/library/ctypes.rst:252 msgid ":c:type:`double`" -msgstr "" +msgstr ":c:type:`double`" #: ../Doc/library/ctypes.rst:254 msgid ":class:`c_longdouble`" -msgstr "" +msgstr ":class:`c_longdouble`" #: ../Doc/library/ctypes.rst:254 msgid ":c:type:`long double`" -msgstr "" +msgstr ":c:type:`long double`" #: ../Doc/library/ctypes.rst:256 msgid ":class:`c_char_p`" -msgstr "" +msgstr ":class:`c_char_p`" #: ../Doc/library/ctypes.rst:256 msgid ":c:type:`char *` (NUL terminated)" -msgstr "" +msgstr ":c:type:`char *` (NUL terminated)" #: ../Doc/library/ctypes.rst:256 msgid "bytes object or ``None``" -msgstr "" +msgstr "objecto de bytes o ``None``" #: ../Doc/library/ctypes.rst:258 msgid ":class:`c_wchar_p`" -msgstr "" +msgstr ":class:`c_wchar_p`" #: ../Doc/library/ctypes.rst:258 msgid ":c:type:`wchar_t *` (NUL terminated)" -msgstr "" +msgstr ":c:type:`wchar_t *` (NUL terminated)" #: ../Doc/library/ctypes.rst:258 msgid "string or ``None``" -msgstr "" +msgstr "cadena o ``None``" #: ../Doc/library/ctypes.rst:260 msgid ":class:`c_void_p`" -msgstr "" +msgstr ":class:`c_void_p`" #: ../Doc/library/ctypes.rst:260 msgid ":c:type:`void *`" -msgstr "" +msgstr ":c:type:`void *`" #: ../Doc/library/ctypes.rst:260 msgid "int or ``None``" -msgstr "" +msgstr "entero o ``None``" #: ../Doc/library/ctypes.rst:264 msgid "The constructor accepts any object with a truth value." -msgstr "" +msgstr "El constructor acepta cualquier objeto con valor verdadero." #: ../Doc/library/ctypes.rst:266 msgid "" "All these types can be created by calling them with an optional initializer " "of the correct type and value::" msgstr "" +"Todos estos tipos pueden ser creados llamándolos con un inicializador " +"opcional del tipo y valor correctos::" #: ../Doc/library/ctypes.rst:277 msgid "" "Since these types are mutable, their value can also be changed afterwards::" msgstr "" +"Dado que estos tipos son mutables, su valor también puede ser cambiado " +"después::" #: ../Doc/library/ctypes.rst:289 msgid "" @@ -451,6 +538,10 @@ msgid "" "point to, *not the contents* of the memory block (of course not, because " "Python bytes objects are immutable)::" msgstr "" +"Asignando un nuevo valor a las instancias de los tipos de punteros :class:" +"`c_char_p`, :class:`c_wchar_p`, y :class:`c_void_p` cambia el *lugar de " +"memoria* al que apuntan, *no el contenido* del bloque de memoria (por " +"supuesto que no, porque los objetos de bytes de Python son inmutables)::" #: ../Doc/library/ctypes.rst:309 msgid "" @@ -461,6 +552,12 @@ msgid "" "``raw`` property; if you want to access it as NUL terminated string, use the " "``value`` property::" msgstr "" +"Sin embargo, debe tener cuidado de no pasarlos a funciones que esperan " +"punteros a la memoria mutable. Si necesitas bloques de memoria mutables, " +"ctypes tiene una función :func:`create_string_buffer` que los crea de varias " +"maneras. El contenido actual del bloque de memoria puede ser accedido (o " +"cambiado) con la propiedad ``raw``; si quieres acceder a él como cadena " +"terminada NUL, usa la propiedad ``value``::" #: ../Doc/library/ctypes.rst:333 msgid "" @@ -470,10 +567,15 @@ msgid "" "memory block containing unicode characters of the C type :c:type:`wchar_t` " "use the :func:`create_unicode_buffer` function." msgstr "" +"La función :func:`create_string_buffer` reemplaza a la función :func:" +"`c_buffer` (que todavía está disponible como un alias), así como a la " +"función :func:`c_string` de versiones anteriores de ctypes. Para crear un " +"bloque de memoria mutable que contenga caracteres unicode del tipo C :c:type:" +"`wchar_t` utilice la función :func:`create_unicode_buffer`." #: ../Doc/library/ctypes.rst:343 msgid "Calling functions, continued" -msgstr "" +msgstr "Funciones de llamada, continuación" #: ../Doc/library/ctypes.rst:345 msgid "" @@ -481,6 +583,9 @@ msgid "" "`sys.stdout`, so these examples will only work at the console prompt, not " "from within *IDLE* or *PythonWin*::" msgstr "" +"Note que printf imprime al canal de salida estándar real, *no* a :data:`sys." +"stdout`, por lo que estos ejemplos sólo funcionarán en el prompt de la " +"consola, no desde dentro de *IDLE* o *PythonWin*::" #: ../Doc/library/ctypes.rst:365 msgid "" @@ -488,10 +593,14 @@ msgid "" "bytes objects have to be wrapped in their corresponding :mod:`ctypes` type, " "so that they can be converted to the required C data type::" msgstr "" +"Como se ha mencionado antes, todos los tipos de Python, excepto los enteros, " +"cadenas y objetos bytes, tienen que ser envueltos en su correspondiente " +"tipo :mod:`ctypes`, para que puedan ser convertidos al tipo de datos C " +"requerido::" #: ../Doc/library/ctypes.rst:378 msgid "Calling functions with your own custom data types" -msgstr "" +msgstr "Funciones de llamada con sus propios tipos de datos personalizados" #: ../Doc/library/ctypes.rst:380 msgid "" @@ -500,6 +609,11 @@ msgid "" "an :attr:`_as_parameter_` attribute and uses this as the function argument. " "Of course, it must be one of integer, string, or bytes::" msgstr "" +"También puedes personalizar la conversión de argumentos de :mod:`ctypes` " +"para permitir que las instancias de tus propias clases se usen como " +"argumentos de función. :mod:`ctypes` busca un atributo :attr:" +"`_as_parameter_` y lo usa como argumento de función. Por supuesto, debe ser " +"uno de entero, cadena o bytes::" #: ../Doc/library/ctypes.rst:395 msgid "" @@ -507,16 +621,22 @@ msgid "" "instance variable, you could define a :class:`property` which makes the " "attribute available on request." msgstr "" +"Si no quieres almacenar los datos de la instancia en la variable de " +"instancia :attr:`_as_parameter_`, puedes definir una :class:`property` que " +"haga que el atributo esté disponible a petición." #: ../Doc/library/ctypes.rst:403 msgid "Specifying the required argument types (function prototypes)" msgstr "" +"Especificar los tipos de argumentos requeridos (prototipos de funciones)" #: ../Doc/library/ctypes.rst:405 msgid "" "It is possible to specify the required argument types of functions exported " "from DLLs by setting the :attr:`argtypes` attribute." msgstr "" +"Es posible especificar los tipos de argumentos necesarios de las funciones " +"exportadas desde las DLL estableciendo el atributo :attr:`argtypes`." #: ../Doc/library/ctypes.rst:408 msgid "" @@ -525,6 +645,11 @@ msgid "" "different types of parameters depending on the format string, on the other " "hand this is quite handy to experiment with this feature)::" msgstr "" +":attr:`argtypes` debe ser una secuencia de tipos de datos de C (la función " +"``printf`` probablemente no es un buen ejemplo aquí, porque toma un número " +"variable y diferentes tipos de parámetros dependiendo del formato de la " +"cadena, por otro lado esto es bastante útil para experimentar con esta " +"característica)::" #: ../Doc/library/ctypes.rst:419 msgid "" @@ -532,6 +657,9 @@ msgid "" "prototype for a C function), and tries to convert the arguments to valid " "types::" msgstr "" +"La especificación de un formato protege contra los tipos de argumentos " +"incompatibles (al igual que un prototipo para una función C), e intenta " +"convertir los argumentos en tipos válidos::" #: ../Doc/library/ctypes.rst:431 msgid "" @@ -545,10 +673,20 @@ msgid "" "the result should be an integer, string, bytes, a :mod:`ctypes` instance, or " "an object with an :attr:`_as_parameter_` attribute." msgstr "" +"Si has definido tus propias clases las cuales pasas a las llamadas a " +"funciones, tienes que implementar un método de clase :meth:`from_param` para " +"que puedan ser usadas en la secuencia :attr:`argtypes`. El método de clase :" +"meth:`from_param` recibe el objeto Python que se le pasa a la llamada a " +"función, debería hacer una comprobación de tipo o lo que sea necesario para " +"asegurarse de que este objeto es aceptable, y luego retornar el objeto en " +"sí, su atributo :attr:`_as_parameter_`, o lo que se quiera pasar como " +"argumento de la función C en este caso. De nuevo, el resultado debe ser un " +"entero, una cadena, unos bytes, una instancia :mod:`ctypes`, o un objeto con " +"el atributo :attr:`_as_parameter_`." #: ../Doc/library/ctypes.rst:445 msgid "Return types" -msgstr "" +msgstr "Tipos de retorno" #: ../Doc/library/ctypes.rst:447 msgid "" @@ -556,12 +694,17 @@ msgid "" "return types can be specified by setting the :attr:`restype` attribute of " "the function object." msgstr "" +"Por defecto, se supone que las funciones retornan el tipo C :c:type:`int`. " +"Se pueden especificar otros tipos de retorno estableciendo el atributo :attr:" +"`restype` del objeto de la función." #: ../Doc/library/ctypes.rst:451 msgid "" "Here is a more advanced example, it uses the ``strchr`` function, which " "expects a string pointer and a char, and returns a pointer to a string::" msgstr "" +"Aquí hay un ejemplo más avanzado, utiliza la función``strchr``, que espera " +"un puntero de cadena y un carácter, y retorna un puntero a una cadena::" #: ../Doc/library/ctypes.rst:464 msgid "" @@ -569,6 +712,9 @@ msgid "" "`argtypes` attribute, and the second argument will be converted from a " "single character Python bytes object into a C char::" msgstr "" +"Si quieres evitar las llamadas ``ord(\"x\")`` de arriba, puedes establecer " +"el atributo :attr:`argtypes`, y el segundo argumento se convertirá de un " +"objeto de un solo carácter de bytes de Python a un char::" #: ../Doc/library/ctypes.rst:482 msgid "" @@ -579,6 +725,12 @@ msgid "" "function call. This is useful to check for error return values and " "automatically raise an exception::" msgstr "" +"También puedes usar un objeto Python invocable (una función o una clase, por " +"ejemplo) como el atributo :attr:`restype`, si la función foránea retorna un " +"número entero. El objeto invocable será llamado con el *entero* que la " +"función C retorna, y el resultado de esta llamada será utilizado como " +"resultado de la llamada a la función. Esto es útil para comprobar si hay " +"valores de retorno de error y plantear automáticamente una excepción::" #: ../Doc/library/ctypes.rst:505 msgid "" @@ -587,16 +739,24 @@ msgid "" "exception. ``WinError`` takes an optional error code parameter, if no one is " "used, it calls :func:`GetLastError` to retrieve it." msgstr "" +"``WinError`` es una función que llamará a la api Windows ``FormatMessage`` " +"para obtener la representación de la cadena de un código de error, y " +"retornará una excepción. ``WinError`` toma un parámetro de código de error " +"opcional, si no se usa ninguno, llama a :func:`GetLastError`` para " +"recuperarlo." #: ../Doc/library/ctypes.rst:510 msgid "" "Please note that a much more powerful error checking mechanism is available " "through the :attr:`errcheck` attribute; see the reference manual for details." msgstr "" +"Tenga en cuenta que un mecanismo de comprobación de errores mucho más " +"potente está disponible a través del atributo :attr:`errcheck`; consulte el " +"manual de referencia para obtener más detalles." #: ../Doc/library/ctypes.rst:517 msgid "Passing pointers (or: passing parameters by reference)" -msgstr "" +msgstr "Pasar los punteros (o: pasar los parámetros por referencia)" #: ../Doc/library/ctypes.rst:519 msgid "" @@ -605,6 +765,10 @@ msgid "" "large to be passed by value. This is also known as *passing parameters by " "reference*." msgstr "" +"A veces una función api C espera un *puntero* a un tipo de datos como " +"parámetro, probablemente para escribir en el lugar correspondiente, o si los " +"datos son demasiado grandes para ser pasados por valor. Esto también se " +"conoce cómo *pasar parámetros por referencia*." #: ../Doc/library/ctypes.rst:523 msgid "" @@ -614,10 +778,15 @@ msgid "" "constructs a real pointer object, so it is faster to use :func:`byref` if " "you don't need the pointer object in Python itself::" msgstr "" +":mod:`ctypes` exporta la función :func:`byref` que se utiliza para pasar " +"parámetros por referencia. El mismo efecto se puede conseguir con la " +"función :func:`pointer`, aunque :func:`pointer` hace mucho más trabajo ya " +"que construye un objeto puntero real, por lo que es más rápido usar :func:" +"`byref` si no se necesita el objeto puntero en el propio Python::" #: ../Doc/library/ctypes.rst:545 msgid "Structures and unions" -msgstr "" +msgstr "Estructuras y uniones" #: ../Doc/library/ctypes.rst:547 msgid "" @@ -626,12 +795,20 @@ msgid "" "subclass must define a :attr:`_fields_` attribute. :attr:`_fields_` must be " "a list of *2-tuples*, containing a *field name* and a *field type*." msgstr "" +"Las estructuras y uniones deben derivar de las clases base :class:" +"`Structure` y :class:`Union` que se definen en el módulo :mod:`ctypes`. Cada " +"subclase debe definir un atributo :attr:`_fields_`. :attr:`_fields_` debe " +"ser una lista de *2-tuplas*, que contenga un *nombre de campo* y un *tipo de " +"campo*." #: ../Doc/library/ctypes.rst:552 msgid "" "The field type must be a :mod:`ctypes` type like :class:`c_int`, or any " "other derived :mod:`ctypes` type: structure, union, array, pointer." msgstr "" +"El tipo de campo debe ser un tipo :mod:`ctypes` como :class:`c_int`, o " +"cualquier otro tipo :mod:`ctypes` derivado: estructura, unión, matriz, " +"puntero." #: ../Doc/library/ctypes.rst:555 msgid "" @@ -639,30 +816,42 @@ msgid "" "named *x* and *y*, and also shows how to initialize a structure in the " "constructor::" msgstr "" +"Aquí hay un ejemplo simple de una estructura POINT, que contiene dos enteros " +"llamados *x* y *y*, y también muestra cómo inicializar una estructura en el " +"constructor::" #: ../Doc/library/ctypes.rst:575 msgid "" "You can, however, build much more complicated structures. A structure can " "itself contain other structures by using a structure as a field type." msgstr "" +"Sin embargo, se pueden construir estructuras mucho más complicadas. Una " +"estructura puede contener por sí misma otras estructuras usando una " +"estructura como tipo de campo." #: ../Doc/library/ctypes.rst:578 msgid "" "Here is a RECT structure which contains two POINTs named *upperleft* and " "*lowerright*::" msgstr "" +"Aquí hay una estructura RECT que contiene dos POINTs llamados *upperleft* " +"(superior izquierda)y *lowerright* (abajo a la derecha)::" #: ../Doc/library/ctypes.rst:592 msgid "" "Nested structures can also be initialized in the constructor in several " "ways::" msgstr "" +"Las estructuras anidadas también pueden ser inicializadas en el constructor " +"de varias maneras::" #: ../Doc/library/ctypes.rst:597 msgid "" "Field :term:`descriptor`\\s can be retrieved from the *class*, they are " "useful for debugging because they can provide useful information::" msgstr "" +"El campo :term:`descriptor` puede ser recuperado de la *class*, son útiles " +"para la depuración porque pueden proporcionar información útil::" #: ../Doc/library/ctypes.rst:611 msgid "" @@ -671,10 +860,15 @@ msgid "" "guaranteed by the library to work in the general case. Unions and " "structures with bit-fields should always be passed to functions by pointer." msgstr "" +":mod:`ctypes` no soporta el paso de uniones o estructuras con campos de bits " +"a funciones por valor. Aunque esto puede funcionar en 32-bit x86, la " +"biblioteca no garantiza que funcione en el caso general. Las uniones y " +"estructuras con campos de bits siempre deben pasarse a las funciones por " +"puntero." #: ../Doc/library/ctypes.rst:617 msgid "Structure/union alignment and byte order" -msgstr "" +msgstr "Alineación de estructura/unión y orden de bytes" #: ../Doc/library/ctypes.rst:619 msgid "" @@ -684,6 +878,12 @@ msgid "" "to a positive integer and specifies the maximum alignment for the fields. " "This is what ``#pragma pack(n)`` also does in MSVC." msgstr "" +"Por defecto, los campos de Estructura y Unión están alineados de la misma " +"manera que lo hace el compilador C. Es posible anular este comportamiento " +"especificando un atributo de clase :attr:`_pack_` en la definición de la " +"subclase. Este debe ser establecido como un entero positivo y especifica la " +"alineación máxima de los campos. Esto es lo que ``#pragma pack(n)`` también " +"hace en MSVC." #: ../Doc/library/ctypes.rst:625 msgid "" @@ -693,10 +893,15 @@ msgid "" "`BigEndianUnion`, and :class:`LittleEndianUnion` base classes. These " "classes cannot contain pointer fields." msgstr "" +":mod:`ctypes` utiliza el orden de bytes nativos para las Estructuras y " +"Uniones. Para construir estructuras con un orden de bytes no nativo, puedes " +"usar una de las clases base :class:`BigEndianStructure`, :class:" +"`LittleEndianStructure`, :class:`BigEndianUnion`, y :class:" +"`LittleEndianUnion`. Estas clases no pueden contener campos puntero." #: ../Doc/library/ctypes.rst:635 msgid "Bit fields in structures and unions" -msgstr "" +msgstr "Campos de bits en estructuras y uniones" #: ../Doc/library/ctypes.rst:637 msgid "" @@ -704,64 +909,81 @@ msgid "" "fields are only possible for integer fields, the bit width is specified as " "the third item in the :attr:`_fields_` tuples::" msgstr "" +"Es posible crear estructuras y uniones que contengan campos de bits. Los " +"campos de bits sólo son posibles para campos enteros, el ancho de bit se " +"especifica como el tercer ítem en las tuplas :attr:`_fields_`::" #: ../Doc/library/ctypes.rst:655 msgid "Arrays" -msgstr "" +msgstr "Arreglos" #: ../Doc/library/ctypes.rst:657 msgid "" "Arrays are sequences, containing a fixed number of instances of the same " "type." msgstr "" +"Los arreglos son secuencias, que contienen un número fijo de instancias del " +"mismo tipo." #: ../Doc/library/ctypes.rst:659 msgid "" "The recommended way to create array types is by multiplying a data type with " "a positive integer::" msgstr "" +"La forma recomendada de crear tipos de arreglos es multiplicando un tipo de " +"dato por un entero positivo::" #: ../Doc/library/ctypes.rst:664 msgid "" "Here is an example of a somewhat artificial data type, a structure " "containing 4 POINTs among other stuff::" msgstr "" +"Aquí hay un ejemplo de un tipo de datos algo artificial, una estructura que " +"contiene 4 POINTs entre otras cosas::" #: ../Doc/library/ctypes.rst:680 msgid "Instances are created in the usual way, by calling the class::" -msgstr "" +msgstr "Las instancias se crean de la manera habitual, llamando a la clase::" #: ../Doc/library/ctypes.rst:686 msgid "" "The above code print a series of ``0 0`` lines, because the array contents " "is initialized to zeros." msgstr "" +"El código anterior imprime una serie de líneas ``0 0``, porque el contenido " +"del arreglos se inicializa con ceros." #: ../Doc/library/ctypes.rst:689 msgid "Initializers of the correct type can also be specified::" -msgstr "" +msgstr "También se pueden especificar inicializadores del tipo correcto::" #: ../Doc/library/ctypes.rst:705 msgid "Pointers" -msgstr "" +msgstr "Punteros" #: ../Doc/library/ctypes.rst:707 msgid "" "Pointer instances are created by calling the :func:`pointer` function on a :" "mod:`ctypes` type::" msgstr "" +"Las instancias de puntero se crean llamando a la función :func:`pointer` en " +"un tipo :mod:`ctypes`::" #: ../Doc/library/ctypes.rst:715 msgid "" "Pointer instances have a :attr:`~_Pointer.contents` attribute which returns " "the object to which the pointer points, the ``i`` object above::" msgstr "" +"Las instancias del puntero tienen un atributo :attr:`~_Pointer.contents` que " +"retorna el objeto al que apunta el puntero, el objeto ``i`` arriba::" #: ../Doc/library/ctypes.rst:722 msgid "" "Note that :mod:`ctypes` does not have OOR (original object return), it " "constructs a new, equivalent object each time you retrieve an attribute::" msgstr "" +"Ten en cuenta que :mod:`ctypes` no tiene OOR (original object return), " +"construye un nuevo objeto equivalente cada vez que recuperas un atributo::" #: ../Doc/library/ctypes.rst:731 msgid "" @@ -769,14 +991,17 @@ msgid "" "attribute would cause the pointer to point to the memory location where this " "is stored::" msgstr "" +"Asignar otra instancia :class:`c_int` al atributo de contenido del puntero " +"causaría que el puntero apunte al lugar de memoria donde se almacena::" #: ../Doc/library/ctypes.rst:743 msgid "Pointer instances can also be indexed with integers::" msgstr "" +"Las instancias de puntero también pueden ser indexadas con números enteros::" #: ../Doc/library/ctypes.rst:749 msgid "Assigning to an integer index changes the pointed to value::" -msgstr "" +msgstr "Asignando a un índice entero cambia el valor señalado::" #: ../Doc/library/ctypes.rst:758 msgid "" @@ -786,6 +1011,11 @@ msgid "" "a C function, and you *know* that the pointer actually points to an array " "instead of a single item." msgstr "" +"También es posible usar índices diferentes de 0, pero debes saber lo que " +"estás haciendo, al igual que en C: Puedes acceder o cambiar arbitrariamente " +"las ubicaciones de memoria. Generalmente sólo usas esta característica si " +"recibes un puntero de una función C, y *sabes* que el puntero en realidad " +"apunta a un arreglo en lugar de a un solo elemento." #: ../Doc/library/ctypes.rst:764 msgid "" @@ -794,22 +1024,31 @@ msgid "" "the :func:`POINTER` function, which accepts any :mod:`ctypes` type, and " "returns a new type::" msgstr "" +"Entre bastidores, la función :func:`pointer` hace más que simplemente crear " +"instancias de puntero, tiene que crear primero punteros *tipos*. Esto se " +"hace con la función :func:`POINTER`, que acepta cualquier tipo de :mod:" +"`ctypes`, y retorna un nuevo tipo::" #: ../Doc/library/ctypes.rst:780 msgid "" "Calling the pointer type without an argument creates a ``NULL`` pointer. " "``NULL`` pointers have a ``False`` boolean value::" msgstr "" +"Llamar al tipo de puntero sin un argumento crea un puntero ``NULL``. Los " +"punteros ``NULL`` tienen un valor booleano falso..:" #: ../Doc/library/ctypes.rst:788 msgid "" ":mod:`ctypes` checks for ``NULL`` when dereferencing pointers (but " "dereferencing invalid non-\\ ``NULL`` pointers would crash Python)::" msgstr "" +":mod:`ctypes` comprueba si hay ``NULL`` cuando los punteros de referencia " +"(pero los punteros no válidos de referencia no-\\ ``NULL`` se romperán en " +"Python)::" #: ../Doc/library/ctypes.rst:807 msgid "Type conversions" -msgstr "" +msgstr "Conversiones de tipos" #: ../Doc/library/ctypes.rst:809 msgid "" @@ -821,6 +1060,14 @@ msgid "" "instances instead of pointer types. So, for ``POINTER(c_int)``, ctypes " "accepts an array of c_int::" msgstr "" +"Por lo general, los ctypes hacen un control estricto de los tipos. Esto " +"significa que si tienes ``POINTER(c_int)`` en la lista :attr:`argtypes` de " +"una función o como el tipo de un campo miembro en una definición de " +"estructura, sólo se aceptan instancias exactamente del mismo tipo. Hay " +"algunas excepciones a esta regla, en las que ctypes acepta otros objetos. " +"Por ejemplo, se pueden pasar instancias de arreglo compatibles en lugar de " +"tipos de puntero. Así, para ``POINTER(c_int)``, ctypes acepta un arreglo de " +"*c_int*::" #: ../Doc/library/ctypes.rst:830 msgid "" @@ -829,10 +1076,15 @@ msgid "" "pointed type (``c_int`` in this case) can be passed to the function. ctypes " "will apply the required :func:`byref` conversion in this case automatically." msgstr "" +"Además, si se declara explícitamente que un argumento de función es de tipo " +"puntero (como ``POINTER(c_int)``) en :attr:`argtypes`, se puede pasar un " +"objeto de tipo puntero (``c_int`` en este caso) a la función. ctypes " +"aplicará la conversión :func:`byref` requerida en este caso automáticamente." #: ../Doc/library/ctypes.rst:835 msgid "To set a POINTER type field to ``NULL``, you can assign ``None``::" msgstr "" +"Para poner un campo de tipo POINTER a ``NULL``, puedes asignar ``None``::" #: ../Doc/library/ctypes.rst:842 msgid "" @@ -842,10 +1094,15 @@ msgid "" "accepts ``POINTER(c_int)`` pointers or :class:`c_int` arrays for its " "``values`` field, but not instances of other types::" msgstr "" +"A veces se tienen instancias de tipos incompatibles. En C, puedes cambiar un " +"tipo por otro tipo. :mod:`ctypes` proporciona una función :func:`cast` qué " +"puede ser usada de la misma manera. La estructura ``Bar`` definida arriba " +"acepta punteros ``POINTER(c_int)`` o arreglos :class:`c_int`` para su campo " +"``values``, pero no instancias de otros tipos::" #: ../Doc/library/ctypes.rst:854 msgid "For these cases, the :func:`cast` function is handy." -msgstr "" +msgstr "Para estos casos, la función :func:`cast` es muy útil." #: ../Doc/library/ctypes.rst:856 msgid "" @@ -855,16 +1112,24 @@ msgid "" "ctypes pointer type. It returns an instance of the second argument, which " "references the same memory block as the first argument::" msgstr "" +"La función :func:`cast` puede ser usada para lanzar una instancia ctypes en " +"un puntero a un tipo de datos ctypes diferente. :func:`cast` toma dos " +"parámetros, un objeto ctypes que es o puede ser convertido en un puntero de " +"algún tipo, y un tipo de puntero ctypes. retorna una instancia del segundo " +"argumento, que hace referencia al mismo bloque de memoria que el primer " +"argumento::" #: ../Doc/library/ctypes.rst:867 msgid "" "So, :func:`cast` can be used to assign to the ``values`` field of ``Bar`` " "the structure::" msgstr "" +"Así, :func:`cast` puede ser usado para asignar al campo ``values`` de " +"``Bar`` la estructura::" #: ../Doc/library/ctypes.rst:880 msgid "Incomplete Types" -msgstr "" +msgstr "Tipos incompletos" #: ../Doc/library/ctypes.rst:882 msgid "" @@ -872,12 +1137,16 @@ msgid "" "yet specified. In C, they are specified by forward declarations, which are " "defined later::" msgstr "" +"*Los Tipos Incompletos* son estructuras, uniones o matrices cuyos miembros " +"aún no están especificados. En C, se especifican mediante declaraciones a " +"futuro, que se definen más adelante::" #: ../Doc/library/ctypes.rst:893 msgid "" "The straightforward translation into ctypes code would be this, but it does " "not work::" msgstr "" +"La traducción directa al código de ctypes sería esta, pero no funciona::" #: ../Doc/library/ctypes.rst:906 msgid "" @@ -885,22 +1154,30 @@ msgid "" "itself. In :mod:`ctypes`, we can define the ``cell`` class and set the :attr:" "`_fields_` attribute later, after the class statement::" msgstr "" +"porque la nueva ``class cell`` no está disponible en la propia declaración " +"de clase. En :mod:`ctypes`, podemos definir la clase ``cell`` y establecer " +"el atributo :attr:`_fields_` más tarde, después de la declaración de clase::" #: ../Doc/library/ctypes.rst:918 msgid "" "Let's try it. We create two instances of ``cell``, and let them point to " "each other, and finally follow the pointer chain a few times::" msgstr "" +"Vamos a intentarlo. Creamos dos instancias de ``cell``, y dejamos que se " +"apunten una a la otra, y finalmente seguimos la cadena de punteros unas " +"cuantas veces::" #: ../Doc/library/ctypes.rst:939 msgid "Callback functions" -msgstr "" +msgstr "Funciones de retrollamadas (*callback*)" #: ../Doc/library/ctypes.rst:941 msgid "" ":mod:`ctypes` allows creating C callable function pointers from Python " "callables. These are sometimes called *callback functions*." msgstr "" +":mod:`ctypes` permite crear punteros de función invocables C a partir de los " +"invocables de Python. A veces se llaman *funciones de retrollamada*." #: ../Doc/library/ctypes.rst:944 msgid "" @@ -908,6 +1185,9 @@ msgid "" "the calling convention, the return type, and the number and types of " "arguments this function will receive." msgstr "" +"Primero, debes crear una clase para la función de retrollamada. La clase " +"conoce la convención de llamada, el tipo de retorno, y el número y tipos de " +"argumentos que esta función recibirá." #: ../Doc/library/ctypes.rst:948 msgid "" @@ -916,6 +1196,10 @@ msgid "" "factory function creates types for callback functions using the ``stdcall`` " "calling convention." msgstr "" +"La función de fábrica :func:`CFUNCTYPE`` crea tipos para las funciones de " +"retrollamada usando la convención de llamada ``cdecl``. En Windows, la " +"función de fábrica :func:`WINFUNCTYPE` crea tipos para funciones de " +"retrollamadas usando la convención de llamadas ``stdcall``." #: ../Doc/library/ctypes.rst:953 msgid "" @@ -923,6 +1207,9 @@ msgid "" "argument, and the callback functions expected argument types as the " "remaining arguments." msgstr "" +"Ambas funciones de fábrica se llaman con el tipo de resultado como primer " +"argumento, y las funciones de llamada de retorno con los tipos de argumentos " +"esperados como los argumentos restantes." #: ../Doc/library/ctypes.rst:957 msgid "" @@ -930,6 +1217,10 @@ msgid "" "`qsort` function, that is used to sort items with the help of a callback " "function. :c:func:`qsort` will be used to sort an array of integers::" msgstr "" +"Presentaré un ejemplo aquí que utiliza la función :c:func:`qsort` de la " +"biblioteca estándar de C, que se utiliza para ordenar los elementos con la " +"ayuda de una función de retrollamada. :c:func:`qsort` se utilizará para " +"ordenar un conjunto de números enteros::" #: ../Doc/library/ctypes.rst:967 msgid "" @@ -940,36 +1231,50 @@ msgid "" "is smaller than the second, a zero if they are equal, and a positive integer " "otherwise." msgstr "" +":func:`qsort` debe ser llamada con un puntero a los datos a ordenar, el " +"número de elementos en el array de datos, el tamaño de un elemento, y un " +"puntero a la función de comparación, la llamada de retorno. La llamada de " +"retorno se llamará entonces con dos punteros a los ítems, y debe retornar un " +"entero negativo si el primer ítem es más pequeño que el segundo, un cero si " +"son iguales, y un entero positivo en caso contrario." #: ../Doc/library/ctypes.rst:973 msgid "" "So our callback function receives pointers to integers, and must return an " "integer. First we create the ``type`` for the callback function::" msgstr "" +"Así que nuestra función de retrollamada recibe punteros a números enteros, y " +"debe retornar un número entero. Primero creamos el ``tipo`` para la función " +"de retrollamada:" #: ../Doc/library/ctypes.rst:979 msgid "" "To get started, here is a simple callback that shows the values it gets " "passed::" msgstr "" +"Para empezar, aquí hay una simple llamada que muestra los valores que se " +"pasan::" #: ../Doc/library/ctypes.rst:989 msgid "The result::" -msgstr "" +msgstr "El resultado::" #: ../Doc/library/ctypes.rst:999 msgid "Now we can actually compare the two items and return a useful result::" -msgstr "" +msgstr "Ahora podemos comparar los dos artículos y obtener un resultado útil::" #: ../Doc/library/ctypes.rst:1014 msgid "As we can easily check, our array is sorted now::" msgstr "" +"Como podemos comprobar fácilmente, nuestro arreglo está ordenado ahora::" #: ../Doc/library/ctypes.rst:1021 msgid "" "The function factories can be used as decorator factories, so we may as well " "write::" msgstr "" +"Las funciones de fabrica pueden ser usadas como decoradores de fabrica, así " +"que podemos escribir::" #: ../Doc/library/ctypes.rst:1039 msgid "" @@ -977,6 +1282,10 @@ msgid "" "are used from C code. :mod:`ctypes` doesn't, and if you don't, they may be " "garbage collected, crashing your program when a callback is made." msgstr "" +"Asegúrate de mantener las referencias a los objetos :func:`CFUNCTYPE` " +"mientras se usen desde el código C. :mod:`ctypes` no lo hace, y si no lo " +"haces, pueden ser basura recolectada, colapsando tu programa cuando se hace " +"una llamada." #: ../Doc/library/ctypes.rst:1043 msgid "" @@ -987,10 +1296,17 @@ msgid "" "with :class:`threading.local` will *not* survive across different callbacks, " "even when those calls are made from the same C thread." msgstr "" +"Además, nótese que sí se llama a la función de retrollamada en un hilo " +"creado fuera del control de Python (por ejemplo, por el código foráneo que " +"llama a la retrollamada), ctypes crea un nuevo hilo Python tonto en cada " +"invocación. Este comportamiento es correcto para la mayoría de los " +"propósitos, pero significa que los valores almacenados con :class:`threading." +"local` *no* sobreviven a través de diferentes llamadas de retorno, incluso " +"cuando esas llamadas se hacen desde el mismo hilo C." #: ../Doc/library/ctypes.rst:1053 msgid "Accessing values exported from dlls" -msgstr "" +msgstr "Acceder a los valores exportados de los dlls" #: ../Doc/library/ctypes.rst:1055 msgid "" @@ -999,6 +1315,10 @@ msgid "" "integer set to 0, 1, or 2, depending on the :option:`-O` or :option:`-OO` " "flag given on startup." msgstr "" +"Algunas bibliotecas compartidas no sólo exportan funciones, sino también " +"variables. Un ejemplo en la propia biblioteca de Python es el :c:data:" +"`Py_OptimizeFlag`, un entero establecido en 0, 1, o 2, dependiendo del flag :" +"option:`-O` o :option:`-OO` dado en el inicio." #: ../Doc/library/ctypes.rst:1060 msgid "" @@ -1006,6 +1326,9 @@ msgid "" "methods of the type. *pythonapi* is a predefined symbol giving access to " "the Python C api::" msgstr "" +":mod:`ctypes` puede acceder a valores como este con los métodos de la clase :" +"meth:`in_dll` del tipo. *pythonapi* es un símbolo predefinido que da acceso " +"a la API de Python C::" #: ../Doc/library/ctypes.rst:1069 msgid "" @@ -1013,16 +1336,21 @@ msgid "" "would have printed ``c_long(1)``, or ``c_long(2)`` if :option:`-OO` would " "have been specified." msgstr "" +"Si el intérprete se hubiera iniciado con :option:`-O`, el ejemplo habría " +"impreso ``c_long(1)``, o ``c_long(2)`` si :option:`-OO` se hubiera " +"especificado." #: ../Doc/library/ctypes.rst:1073 msgid "" "An extended example which also demonstrates the use of pointers accesses " "the :c:data:`PyImport_FrozenModules` pointer exported by Python." msgstr "" +"Un ejemplo extendido que también demuestra el uso de punteros accediendo al " +"puntero :c:data:`PyImport_FrozenModules` exportado por Python." #: ../Doc/library/ctypes.rst:1076 msgid "Quoting the docs for that value:" -msgstr "" +msgstr "Citando los documentos para ese valor:" #: ../Doc/library/ctypes.rst:1078 msgid "" @@ -1032,18 +1360,28 @@ msgid "" "could play tricks with this to provide a dynamically created collection of " "frozen modules." msgstr "" +"Este puntero está inicializado para apuntar a un arreglo de registros :c:" +"type:`struct _frozen``, terminada por uno cuyos miembros son todos ``NULL`` " +"o cero. Cuando se importa un módulo congelado, se busca en esta tabla. El " +"código de terceros podría jugar con esto para proporcionar una colección " +"creada dinámicamente de módulos congelados." #: ../Doc/library/ctypes.rst:1083 msgid "" "So manipulating this pointer could even prove useful. To restrict the " "example size, we show only how this table can be read with :mod:`ctypes`::" msgstr "" +"Así que manipular este puntero podría incluso resultar útil. Para restringir " +"el tamaño del ejemplo, sólo mostramos cómo esta tabla puede ser leída con :" +"mod:`ctypes`::" #: ../Doc/library/ctypes.rst:1095 msgid "" "We have defined the :c:type:`struct _frozen` data type, so we can get the " "pointer to the table::" msgstr "" +"Hemos definido el tipo de datos :c:type:`struct _frozen`, para que podamos " +"obtener el puntero de la tabla::" #: ../Doc/library/ctypes.rst:1102 msgid "" @@ -1053,6 +1391,11 @@ msgid "" "crash with an access violation or whatever, so it's better to break out of " "the loop when we hit the ``NULL`` entry::" msgstr "" +"Como `tabla`` es un ``puntero`` al arreglo de registros ``struct_frozen``, " +"podemos iterar sobre ella, pero sólo tenemos que asegurarnos de que nuestro " +"bucle termine, porque los punteros no tienen tamaño. Tarde o temprano, " +"probablemente se caerá con una violación de acceso o lo que sea, así que es " +"mejor salir del bucle cuando le demos a la entrada ``NULL``::" #: ../Doc/library/ctypes.rst:1120 msgid "" @@ -1060,26 +1403,35 @@ msgid "" "(indicated by the negative ``size`` member) is not well known, it is only " "used for testing. Try it out with ``import __hello__`` for example." msgstr "" +"El hecho de que la Python estándar tenga un módulo congelado y un paquete " +"congelado (indicado por el miembro ``tamaño`` negativo) no se conoce bien, " +"sólo se usa para hacer pruebas. Pruébalo con ``import __hello__`` por " +"ejemplo." #: ../Doc/library/ctypes.rst:1128 msgid "Surprises" -msgstr "" +msgstr "Sorpresas" #: ../Doc/library/ctypes.rst:1130 msgid "" "There are some edges in :mod:`ctypes` where you might expect something other " "than what actually happens." msgstr "" +"Hay algunas aristas en :mod:`ctypes` en las que podrías esperar algo " +"distinto de lo que realmente sucede." #: ../Doc/library/ctypes.rst:1133 msgid "Consider the following example::" -msgstr "" +msgstr "Considere el siguiente ejemplo::" #: ../Doc/library/ctypes.rst:1153 msgid "" "Hm. We certainly expected the last statement to print ``3 4 1 2``. What " "happened? Here are the steps of the ``rc.a, rc.b = rc.b, rc.a`` line above::" msgstr "" +"Hm. Ciertamente esperábamos que la última declaración imprimiera ``3 4 1 " +"2``. ¿Qué ha pasado? Aquí están los pasos de la línea ``rc.a, rc.b = rc.b, " +"rc.a`` arriba::" #: ../Doc/library/ctypes.rst:1161 msgid "" @@ -1089,6 +1441,11 @@ msgid "" "the contents of ``temp1``. So, the last assignment ``rc.b = temp1``, doesn't " "have the expected effect." msgstr "" +"Note que ``temp0`` y ``temp1`` son objetos que todavía usan el buffer " +"interno del objeto ``rc`` de arriba. Así que ejecutando ``rc.a = temp0`` " +"copia el contenido del buffer de ``temp0`` en el buffer de ``rc``. Esto, a " +"su vez, cambia el contenido de ``temp1``. Por lo tanto, la última asignación " +"``rc.b = temp1``, no tiene el efecto esperado." #: ../Doc/library/ctypes.rst:1167 msgid "" @@ -1096,18 +1453,25 @@ msgid "" "doesn't *copy* the sub-object, instead it retrieves a wrapper object " "accessing the root-object's underlying buffer." msgstr "" +"Tengan en cuenta que la recuperación de subobjetos de Estructuras, Uniones y " +"Arreglos no *copia* el subobjeto, sino que recupera un objeto contenido que " +"accede al búfer subyacente del objeto raíz." #: ../Doc/library/ctypes.rst:1171 msgid "" "Another example that may behave differently from what one would expect is " "this::" msgstr "" +"Otro ejemplo que puede comportarse de manera diferente a lo que uno " +"esperaría es este::" #: ../Doc/library/ctypes.rst:1183 msgid "" "Objects instantiated from :class:`c_char_p` can only have their value set to " "bytes or integers." msgstr "" +"Los objetos instanciados desde :class:`c_char_p` sólo pueden tener su valor " +"fijado en bytes o enteros." #: ../Doc/library/ctypes.rst:1186 msgid "" @@ -1117,15 +1481,23 @@ msgid "" "object itself, instead the ``contents`` of the object is stored. Accessing " "the contents again constructs a new Python object each time!" msgstr "" +"¿Por qué está imprimiendo ``False``? Las instancias ctypes son objetos que " +"contienen un bloque de memoria más algunos :term:`descriptor`\\s que acceden " +"al contenido de la memoria. Almacenar un objeto Python en el bloque de " +"memoria no almacena el objeto en sí mismo, en su lugar se almacenan los " +"``contenidos`` del objeto. ¡Acceder a los contenidos de nuevo construye un " +"nuevo objeto Python cada vez!" #: ../Doc/library/ctypes.rst:1196 msgid "Variable-sized data types" -msgstr "" +msgstr "Tipos de datos de tamaño variable" #: ../Doc/library/ctypes.rst:1198 msgid "" ":mod:`ctypes` provides some support for variable-sized arrays and structures." msgstr "" +":mod:`ctypes` proporciona algo de soporte para matrices y estructuras de " +"tamaño variable." #: ../Doc/library/ctypes.rst:1200 msgid "" @@ -1135,6 +1507,12 @@ msgid "" "cannot be made smaller than the natural memory block specified by the " "objects type, a :exc:`ValueError` is raised if this is tried::" msgstr "" +"La función :func:`resize` puede ser usada para redimensionar el buffer de " +"memoria de un objeto ctypes existente. La función toma el objeto como primer " +"argumento, y el tamaño solicitado en bytes como segundo argumento. El bloque " +"de memoria no puede hacerse más pequeño que el bloque de memoria natural " +"especificado por el tipo de objeto, se lanza un :exc:`ValueError` si se " +"intenta::" #: ../Doc/library/ctypes.rst:1220 msgid "" @@ -1142,6 +1520,9 @@ msgid "" "contained in this array? Since the type still only knows about 4 elements, " "we get errors accessing other elements::" msgstr "" +"Esto está bien, pero ¿cómo se puede acceder a los elementos adicionales " +"contenidos en este arreglo? Dado que el tipo todavía sabe sólo 4 elementos, " +"obtenemos errores al acceder a otros elementos::" #: ../Doc/library/ctypes.rst:1232 msgid "" @@ -1149,20 +1530,26 @@ msgid "" "the dynamic nature of Python, and (re-)define the data type after the " "required size is already known, on a case by case basis." msgstr "" +"Otra forma de utilizar tipos de datos de tamaño variable con :mod:`ctypes` " +"es utilizar la naturaleza dinámica de Python, y (re)definir el tipo de datos " +"después de que se conozca el tamaño requerido, caso por caso." #: ../Doc/library/ctypes.rst:1240 msgid "ctypes reference" -msgstr "" +msgstr "referencia ctypes" #: ../Doc/library/ctypes.rst:1246 msgid "Finding shared libraries" -msgstr "" +msgstr "Encontrar bibliotecas compartidas" #: ../Doc/library/ctypes.rst:1248 msgid "" "When programming in a compiled language, shared libraries are accessed when " "compiling/linking a program, and when the program is run." msgstr "" +"Cuando se programa en un lenguaje compilado, se accede a las bibliotecas " +"compartidas cuando se compila/enlaza un programa, y cuándo se ejecuta el " +"programa." #: ../Doc/library/ctypes.rst:1251 msgid "" @@ -1172,12 +1559,20 @@ msgid "" "while the ctypes library loaders act like when a program is run, and call " "the runtime loader directly." msgstr "" +"El propósito de la función :func:`find_library` es localizar una biblioteca " +"de forma similar a lo que hace el compilador o el cargador en tiempo de " +"ejecución (en plataformas con varias versiones de una biblioteca compartida " +"se debería cargar la más reciente), mientras que los cargadores de " +"bibliotecas ctypes actúan como cuando se ejecuta un programa, y llaman " +"directamente al cargador en tiempo de ejecución." #: ../Doc/library/ctypes.rst:1257 msgid "" "The :mod:`ctypes.util` module provides a function which can help to " "determine the library to load." msgstr "" +"El módulo :mod:`ctypes.util` proporciona una función que puede ayudar a " +"determinar la biblioteca a cargar." #: ../Doc/library/ctypes.rst:1265 msgid "" @@ -1186,10 +1581,15 @@ msgid "" "number (this is the form used for the posix linker option :option:`!-l`). " "If no library can be found, returns ``None``." msgstr "" +"Intenta encontrar una biblioteca y retornar un nombre. *name* es el nombre " +"de la biblioteca sin ningún prefijo como *lib*, sufijo como ``.so``, ``." +"dylib`` o número de versión (esta es la forma usada para la opción del " +"enlazador posix :option:`!-l`). Si no se puede encontrar ninguna biblioteca, " +"retorna ``None``." #: ../Doc/library/ctypes.rst:1270 ../Doc/library/ctypes.rst:1903 msgid "The exact functionality is system dependent." -msgstr "" +msgstr "La funcionalidad exacta depende del sistema." #: ../Doc/library/ctypes.rst:1272 msgid "" @@ -1197,6 +1597,9 @@ msgid "" "ldconfig``, ``gcc``, ``objdump`` and ``ld``) to find the library file. It " "returns the filename of the library file." msgstr "" +"En Linux, :func:`find_library` intenta ejecutar programas externos (``/sbin/" +"ldconfig``, ``gcc``, ``objdump`` y ``ld``) para encontrar el archivo de la " +"biblioteca. retorna el nombre del archivo de la biblioteca." #: ../Doc/library/ctypes.rst:1276 msgid "" @@ -1204,16 +1607,22 @@ msgid "" "when searching for libraries, if a library cannot be found by any other " "means." msgstr "" +"En Linux, el valor de la variable de entorno ``LD_LIBRARY_PATH`` se utiliza " +"cuando se buscan bibliotecas, si una biblioteca no puede ser encontrada por " +"ningún otro medio." #: ../Doc/library/ctypes.rst:1280 msgid "Here are some examples::" -msgstr "" +msgstr "Aquí hay algunos ejemplos::" #: ../Doc/library/ctypes.rst:1291 msgid "" "On OS X, :func:`find_library` tries several predefined naming schemes and " "paths to locate the library, and returns a full pathname if successful::" msgstr "" +"En OS X, :func:`find_library` intenta varios esquemas de nombres y rutas " +"predefinidas para localizar la biblioteca, y retorna una ruta completa si " +"tiene éxito::" #: ../Doc/library/ctypes.rst:1305 msgid "" @@ -1221,6 +1630,10 @@ msgid "" "returns the full pathname, but since there is no predefined naming scheme a " "call like ``find_library(\"c\")`` will fail and return ``None``." msgstr "" +"En Windows, :func:`find_library`` busca a lo largo de la ruta de búsqueda " +"del sistema, y retorna la ruta completa, pero como no hay un esquema de " +"nombres predefinido, una llamada como ``find_library(\"c\")`` fallará y " +"retornará ``None``." #: ../Doc/library/ctypes.rst:1309 msgid "" @@ -1229,16 +1642,22 @@ msgid "" "into the wrapper module instead of using :func:`find_library` to locate the " "library at runtime." msgstr "" +"Si envolvemos una biblioteca compartida con :mod:`ctypes`, puede ser mejor " +"determinar el nombre de la biblioteca compartida en tiempo de desarrollo, y " +"codificarlo en el módulo de envoltura en lugar de usar :func:`find_library` " +"para localizar la biblioteca en tiempo de ejecución." #: ../Doc/library/ctypes.rst:1317 msgid "Loading shared libraries" -msgstr "" +msgstr "Cargando bibliotecas compartidas" #: ../Doc/library/ctypes.rst:1319 msgid "" "There are several ways to load shared libraries into the Python process. " "One way is to instantiate one of the following classes:" msgstr "" +"Hay varias maneras de cargar las bibliotecas compartidas en el proceso " +"Python. Una forma es instanciar una de las siguientes clases:" #: ../Doc/library/ctypes.rst:1325 msgid "" @@ -1246,6 +1665,9 @@ msgid "" "these libraries use the standard C calling convention, and are assumed to " "return :c:type:`int`." msgstr "" +"Las instancias de esta clase representan bibliotecas compartidas cargadas. " +"Las funciones de estas bibliotecas usan la convención estándar de llamada C, " +"y se asume que retornan :c:type:`int`." #: ../Doc/library/ctypes.rst:1332 msgid "" @@ -1256,10 +1678,17 @@ msgid "" "failed or succeeded, together with additional error code. If the return " "value signals a failure, an :class:`OSError` is automatically raised." msgstr "" +"Sólo Windows: Las instancias de esta clase representan bibliotecas " +"compartidas cargadas, las funciones en estas bibliotecas usan la convención " +"de llamada ``stdcall``, y se asume que retornan el código específico de " +"windows :class:`HRESULT``. Los valores :class:`HRESULT`` contienen " +"información que especifica si la llamada a la función falló o tuvo éxito, " +"junto con un código de error adicional. Si el valor de retorno señala un " +"fracaso, se eleva automáticamente un :class:`OSError``." #: ../Doc/library/ctypes.rst:1339 msgid ":exc:`WindowsError` used to be raised." -msgstr "" +msgstr ":exc:`WindowsError` solía ser lanzado." #: ../Doc/library/ctypes.rst:1345 msgid "" @@ -1267,6 +1696,9 @@ msgid "" "functions in these libraries use the ``stdcall`` calling convention, and are " "assumed to return :c:type:`int` by default." msgstr "" +"Sólo Windows: Las instancias de esta clase representan bibliotecas " +"compartidas cargadas, las funciones de estas bibliotecas usan la convención " +"de llamada ``stdcall``, y se supone que retornan :c:type:`int` por defecto." #: ../Doc/library/ctypes.rst:1349 msgid "" @@ -1274,12 +1706,17 @@ msgid "" "the :class:`WinDLL` and :class:`OleDLL` use the standard calling convention " "on this platform." msgstr "" +"En Windows CE sólo se utiliza la convención de llamadas estándar, para mayor " +"comodidad las :class:`WinDLL` y :class:`OleDLL` utilizan la convención de " +"llamadas estándar en esta plataforma." #: ../Doc/library/ctypes.rst:1353 msgid "" "The Python :term:`global interpreter lock` is released before calling any " "function exported by these libraries, and reacquired afterwards." msgstr "" +"El termino Python :term:`global interpreter lock` es lanzado antes de llamar " +"a cualquier función exportada por estas librerías, y se requiere después." #: ../Doc/library/ctypes.rst:1359 msgid "" @@ -1288,10 +1725,17 @@ msgid "" "function execution the Python error flag is checked. If the error flag is " "set, a Python exception is raised." msgstr "" +"Las instancias de esta clase se comportan como instancias :class:`CDLL` , " +"excepto que el GIL de Python es *no* liberado durante la llamada a la " +"función, y después de la ejecución de la función se comprueba si esta activo " +"el flag de error de Python. Si el flag de error esta activado, se lanza una " +"excepción Python." #: ../Doc/library/ctypes.rst:1364 msgid "Thus, this is only useful to call Python C api functions directly." msgstr "" +"Por lo tanto, esto sólo es útil para llamar directamente a las funciones api " +"C de Pythoni." #: ../Doc/library/ctypes.rst:1366 msgid "" @@ -1302,6 +1746,12 @@ msgid "" "``LoadLibrary`` function is used to load the library into the process, and " "to get a handle to it." msgstr "" +"Todas estas clases pueden ser instanciadas llamándolas con al menos un " +"argumento, la ruta de la biblioteca compartida. Si tienes un manejador " +"existente de una biblioteca compartida ya cargada, se puede pasar como el " +"parámetro llamado ``handle``, de lo contrario la función ``dlopen`` o " +"``LoadLibrary`` de la plataforma subyacente es utilizada para cargar la " +"biblioteca en el proceso, y obtener un manejador de la misma." #: ../Doc/library/ctypes.rst:1373 msgid "" @@ -1310,6 +1760,10 @@ msgid "" "ignored. On posix systems, RTLD_NOW is always added, and is not " "configurable." msgstr "" +"El parámetro *mode* puede utilizarse para especificar cómo se carga la " +"biblioteca. Para más detalles, consulte la página :manpage:`dlopen(3)` " +"manpage. En Windows, *mode* es ignorado. En los sistemas posix, RTLD_NOW " +"siempre se agrega, y no es configurable." #: ../Doc/library/ctypes.rst:1378 msgid "" @@ -1320,6 +1774,13 @@ msgid "" "the :data:`errno` value before the function call is swapped with the ctypes " "private copy, the same happens immediately after the function call." msgstr "" +"El parámetro *use_errno*, cuando se establece en true, habilita un mecanismo " +"ctypes que permite acceder al número de error del sistema :data:`errno` de " +"forma segura. :mod:`ctypes` mantiene una copia local del hilo de la variable " +"del sistema :data:`errno`; si llamas a funciones extranjeras creadas con " +"``use_errno=True`` entonces el valor :data:`errno` antes de la llamada a la " +"función se intercambia con la copia privada de ctypes, lo mismo ocurre " +"inmediatamente después de la llamada a la función." #: ../Doc/library/ctypes.rst:1385 msgid "" @@ -1327,6 +1788,9 @@ msgid "" "private copy, and the function :func:`ctypes.set_errno` changes the ctypes " "private copy to a new value and returns the former value." msgstr "" +"La función :func:`ctypes.get_errno` retorna el valor de la copia privada de " +"ctypes, y la función :func:`ctypes.set_errno` cambia la copia privada de " +"ctypes a un nuevo valor y retorna el valor anterior." #: ../Doc/library/ctypes.rst:1389 msgid "" @@ -1336,6 +1800,12 @@ msgid "" "and :func:`ctypes.set_last_error` are used to request and change the ctypes " "private copy of the windows error code." msgstr "" +"El parámetro *use_last_error*, cuando se establece en true, habilita el " +"mismo mecanismo para el código de error de Windows que es administrado por " +"las funciones de la API de Windows :func:`GetLastError` y :func:" +"`SetLastError`; :func:`ctypes.get_last_error` y :func:`ctypes." +"set_last_error` se utilizan para solicitar y cambiar la copia privada ctypes " +"del código de error de Windows." #: ../Doc/library/ctypes.rst:1395 msgid "" @@ -1346,28 +1816,42 @@ msgid "" "such as DLL hijacking. Passing the full path to the DLL is the safest way to " "ensure the correct library and dependencies are loaded." msgstr "" +"El parámetro *winmode* se utiliza en Windows para especificar cómo se carga " +"la biblioteca (ya que *mode* se ignora). Toma cualquier valor que sea válido " +"para el parámetro flags de la API de Win32 ``LoadLibraryEx``. Cuando se " +"omite, el valor por defecto es usar los flags que resultan en la carga de " +"DLL más segura para evitar problemas como el secuestro de DLL. Pasar la ruta " +"completa a la DLL es la forma más segura de asegurar que se cargan la " +"biblioteca y las dependencias correctas." #: ../Doc/library/ctypes.rst:1402 msgid "Added *winmode* parameter." -msgstr "" +msgstr "Añadido el parámetro *winmode*." #: ../Doc/library/ctypes.rst:1409 msgid "" "Flag to use as *mode* parameter. On platforms where this flag is not " "available, it is defined as the integer zero." msgstr "" +"Flag para usar como parámetro *modo*. En las plataformas en las que esta " +"bandera no está disponible, se define como el cero entero." #: ../Doc/library/ctypes.rst:1416 msgid "" "Flag to use as *mode* parameter. On platforms where this is not available, " "it is the same as *RTLD_GLOBAL*." msgstr "" +"Flag para usar como parámetro *modo*. En las plataformas en las que esto no " +"está disponible, es lo mismo que *RTLD_GLOBAL*." #: ../Doc/library/ctypes.rst:1423 msgid "" "The default mode which is used to load shared libraries. On OSX 10.3, this " "is *RTLD_GLOBAL*, otherwise it is the same as *RTLD_LOCAL*." msgstr "" +"El modo por defecto que se utiliza para cargar las bibliotecas compartidas. " +"En OSX 10.3, esto es *RTLD_GLOBAL*, de lo contrario es lo mismo que " +"*RTLD_LOCAL*." #: ../Doc/library/ctypes.rst:1426 msgid "" @@ -1377,20 +1861,28 @@ msgid "" "therefore accessing it repeatedly returns the same object each time. On the " "other hand, accessing it through an index returns a new object each time::" msgstr "" +"Las instancias de estas clases no tienen métodos públicos. Se puede acceder " +"a las funciones exportadas por la biblioteca compartida como atributos o por " +"índice. Tenga en cuenta que al acceder a la función a través de un atributo " +"se almacena en caché el resultado y, por lo tanto, al acceder a él " +"repetidamente se retorna el mismo objeto cada vez. Por otro lado, acceder a " +"ella a través de un índice retorna un nuevo objeto cada vez::" #: ../Doc/library/ctypes.rst:1439 msgid "" "The following public attributes are available, their name starts with an " "underscore to not clash with exported function names:" msgstr "" +"Los siguientes atributos públicos están disponibles, su nombre comienza con " +"un guion bajo para no chocar con los nombres de las funciones exportadas:" #: ../Doc/library/ctypes.rst:1445 msgid "The system handle used to access the library." -msgstr "" +msgstr "El manejador del sistema usado para acceder a la biblioteca." #: ../Doc/library/ctypes.rst:1450 msgid "The name of the library passed in the constructor." -msgstr "" +msgstr "El nombre de la biblioteca pasado en el constructor." #: ../Doc/library/ctypes.rst:1452 msgid "" @@ -1399,12 +1891,18 @@ msgid "" "calling the :meth:`LoadLibrary` method, or by retrieving the library as " "attribute of the loader instance." msgstr "" +"Las bibliotecas compartidas también pueden ser cargadas usando uno de los " +"objetos prefabricados, que son instancias de la clase :class:" +"`LibraryLoader`, ya sea llamando al método :meth:`LoadLibrary`, o " +"recuperando la biblioteca como atributo de la instancia de carga." #: ../Doc/library/ctypes.rst:1460 msgid "" "Class which loads shared libraries. *dlltype* should be one of the :class:" "`CDLL`, :class:`PyDLL`, :class:`WinDLL`, or :class:`OleDLL` types." msgstr "" +"Clase que carga bibliotecas compartidas. *dlltype* debe ser uno de los " +"tipos :class:`CDLL`, :class:`PyDLL`, :class:`WinDLL`, o :class:`OleDLL`." #: ../Doc/library/ctypes.rst:1463 msgid "" @@ -1412,38 +1910,46 @@ msgid "" "by accessing it as attribute of a library loader instance. The result is " "cached, so repeated attribute accesses return the same library each time." msgstr "" +":meth:`__getattr__` tiene un comportamiento especial: Permite cargar una " +"biblioteca compartida accediendo a ella como atributo de una instancia de " +"carga de biblioteca. El resultado se almacena en caché, de modo que los " +"accesos repetidos a los atributos retornan la misma biblioteca cada vez." #: ../Doc/library/ctypes.rst:1469 msgid "" "Load a shared library into the process and return it. This method always " "returns a new instance of the library." msgstr "" +"Carga una biblioteca compartida en el proceso y la retorna. Este método " +"siempre retorna una nueva instancia de la biblioteca." #: ../Doc/library/ctypes.rst:1473 msgid "These prefabricated library loaders are available:" -msgstr "" +msgstr "Estos cargadores prefabricados de bibliotecas están disponibles:" #: ../Doc/library/ctypes.rst:1478 msgid "Creates :class:`CDLL` instances." -msgstr "" +msgstr "Crea instancias de :class:`CDLL`." #: ../Doc/library/ctypes.rst:1484 msgid "Windows only: Creates :class:`WinDLL` instances." -msgstr "" +msgstr "Sólo Windows: Crea instancias de :class:`WinDLL`." #: ../Doc/library/ctypes.rst:1490 msgid "Windows only: Creates :class:`OleDLL` instances." -msgstr "" +msgstr "Sólo Windows: Crea instancias de :class:`OleDLL`." #: ../Doc/library/ctypes.rst:1496 msgid "Creates :class:`PyDLL` instances." -msgstr "" +msgstr "Crea instancias de :class:`PyDLL`." #: ../Doc/library/ctypes.rst:1499 msgid "" "For accessing the C Python api directly, a ready-to-use Python shared " "library object is available:" msgstr "" +"Para acceder directamente a la API C de Python, se dispone de un objeto de " +"biblioteca compartida de Python listo-para-usar:" #: ../Doc/library/ctypes.rst:1505 msgid "" @@ -1452,11 +1958,18 @@ msgid "" "`int`, which is of course not always the truth, so you have to assign the " "correct :attr:`restype` attribute to use these functions." msgstr "" +"Una instancia de :class:`PyDLL` que expone las funciones de la API C de " +"Python como atributos. Ten en cuenta que se supone que todas estas funciones " +"retornan C :c:type:`int`, lo que por supuesto no siempre es cierto, así que " +"tienes que asignar el atributo correcto :attr:`restype` para usar estas " +"funciones." msgid "" "Raises an :ref:`auditing event ` ``ctypes.dlopen`` with argument " "``name``." msgstr "" +"Lanza un :ref:`evento de auditoría ` ``ctypes.dlopen`` con " +"argumento ``name``." #: ../Doc/library/ctypes.rst:1512 msgid "" @@ -1464,11 +1977,16 @@ msgid "" "event ` ``ctypes.dlopen`` with string argument ``name``, the name " "used to load the library." msgstr "" +"Cargar una biblioteca a través de cualquiera de estos objetos lanza un :ref:" +"`evento de auditoría ` ``ctypes.dlopen`` con el argumento de " +"cadena ``name``, el nombre usado para cargar la biblioteca." msgid "" "Raises an :ref:`auditing event ` ``ctypes.dlsym`` with arguments " "``library``, ``name``." msgstr "" +"Lanza un :ref:`evento de auditoría ` ``ctypes.dlsym`` con " +"argumentos ``library``, ``name``." #: ../Doc/library/ctypes.rst:1518 msgid "" @@ -1476,11 +1994,16 @@ msgid "" "dlsym`` with arguments ``library`` (the library object) and ``name`` (the " "symbol's name as a string or integer)." msgstr "" +"Al acceder a una función en una biblioteca cargada se lanza un evento de " +"auditoría ``ctypes.dlsym`` con argumentos ``library`` (el objeto de la " +"biblioteca) y ``name`` (el nombre del símbolo como cadena o entero)." msgid "" "Raises an :ref:`auditing event ` ``ctypes.dlsym/handle`` with " "arguments ``handle``, ``name``." msgstr "" +"Lanza un :ref:`evento de auditoría ` ``ctypes.dlsym/handle`` con " +"argumentos ``handle``, ``name``." #: ../Doc/library/ctypes.rst:1524 msgid "" @@ -1488,10 +2011,14 @@ msgid "" "accessing a function raises an auditing event ``ctypes.dlsym/handle`` with " "arguments ``handle`` (the raw library handle) and ``name``." msgstr "" +"En los casos en los que sólo está disponible el manejador de la biblioteca " +"en lugar del objeto, al acceder a una función se produce un evento de " +"auditoría ``ctypes.dlsym/handle`` con los argumentos ``handle`` (el " +"manejador de la biblioteca en bruto) y ``name``." #: ../Doc/library/ctypes.rst:1531 msgid "Foreign functions" -msgstr "" +msgstr "Funciones foráneas" #: ../Doc/library/ctypes.rst:1533 msgid "" @@ -1501,28 +2028,40 @@ msgid "" "instances as arguments, and return the default result type specified by the " "library loader. They are instances of a private class:" msgstr "" +"Como se explicó en la sección anterior, se puede acceder a las funciones " +"foráneas como atributos de las bibliotecas compartidas cargadas. Los objetos " +"de función creados de esta forma aceptan por defecto cualquier número de " +"argumentos, aceptan cualquier instancia de datos ctypes como argumentos y " +"retornan el tipo de resultado por defecto especificado por el cargador de la " +"biblioteca. Son instancias de una clase privada:" #: ../Doc/library/ctypes.rst:1542 msgid "Base class for C callable foreign functions." -msgstr "" +msgstr "Clase base para funciones foráneas C invocables." #: ../Doc/library/ctypes.rst:1544 msgid "" "Instances of foreign functions are also C compatible data types; they " "represent C function pointers." msgstr "" +"Las instancias de funciones foráneas también son tipos de datos compatibles " +"con C; representan punteros de funciones C." #: ../Doc/library/ctypes.rst:1547 msgid "" "This behavior can be customized by assigning to special attributes of the " "foreign function object." msgstr "" +"Este comportamiento puede personalizarse asignando a los atributos " +"especiales del objeto de la función foránea." #: ../Doc/library/ctypes.rst:1552 msgid "" "Assign a ctypes type to specify the result type of the foreign function. Use " "``None`` for :c:type:`void`, a function not returning anything." msgstr "" +"Asigne un tipo de ctypes para especificar el tipo de resultado de la función " +"externa. Usa ``None`` para :c:type:`void`, una función que no retorna nada." #: ../Doc/library/ctypes.rst:1555 msgid "" @@ -1533,6 +2072,13 @@ msgid "" "or error checking use a ctypes data type as :attr:`restype` and assign a " "callable to the :attr:`errcheck` attribute." msgstr "" +"Es posible asignar un objeto Python invocable que no sea de tipo ctypes, en " +"este caso se supone que la función retorna un C :c:type:`int`, y el " +"invocable se llamará con este entero, lo que permite un posterior " +"procesamiento o comprobación de errores. El uso de esto está obsoleto, para " +"un postprocesamiento más flexible o para la comprobación de errores utilice " +"un tipo de datos ctypes como :attr:`restype` y asigne un invocable al " +"atributo :attr:`errcheck`." #: ../Doc/library/ctypes.rst:1564 msgid "" @@ -1542,6 +2088,11 @@ msgid "" "tuple; functions using the C calling convention accept additional, " "unspecified arguments as well." msgstr "" +"Asigne una tupla de tipos ctypes para especificar los tipos de argumentos " +"que acepta la función. Las funciones que utilizan la convención de llamada " +"``stdcall`` sólo pueden ser llamadas con el mismo número de argumentos que " +"la longitud de esta tupla; las funciones que utilizan la convención de " +"llamada C aceptan también argumentos adicionales no especificados." #: ../Doc/library/ctypes.rst:1570 msgid "" @@ -1552,6 +2103,12 @@ msgid "" "attr:`argtypes` tuple will convert a string passed as argument into a bytes " "object using ctypes conversion rules." msgstr "" +"Cuando se llama a una función foránea, cada argumento real se pasa al método " +"de la clase :meth:`from_param` de los elementos de la tupla :attr:" +"`argtypes`, este método permite adaptar el argumento real a un objeto que la " +"función externa acepta. Por ejemplo, un elemento :class:`c_char_p` de la " +"tupla :attr:`argtypes` convertirá una cadena pasada como argumento en un " +"objeto de bytes utilizando reglas de conversión ctypes." #: ../Doc/library/ctypes.rst:1577 msgid "" @@ -1560,30 +2117,45 @@ msgid "" "usable as argument (integer, string, ctypes instance). This allows defining " "adapters that can adapt custom objects as function parameters." msgstr "" +"Nuevo: Ahora es posible poner en argtypes elementos que no son de tipo " +"ctypes, pero cada elemento debe tener un método :meth:`from_param` que " +"retorne un valor utilizable como argumento (entero, cadena, instancia " +"ctypes). Esto permite definir adaptadores que pueden adaptar objetos " +"personalizados como parámetros de la función." #: ../Doc/library/ctypes.rst:1584 msgid "" "Assign a Python function or another callable to this attribute. The callable " "will be called with three or more arguments:" msgstr "" +"Asigne una función Python u otra llamada a este atributo. El invocable será " +"llamado con tres o más argumentos:" #: ../Doc/library/ctypes.rst:1591 msgid "" "*result* is what the foreign function returns, as specified by the :attr:" "`restype` attribute." msgstr "" +"*result* es lo que retorna la función externa, como se especifica en el " +"atributo :attr:`restype`." #: ../Doc/library/ctypes.rst:1594 msgid "" "*func* is the foreign function object itself, this allows reusing the same " "callable object to check or post process the results of several functions." msgstr "" +"*func* es el propio objeto de la función foránea, lo que permite reutilizar " +"el mismo objeto invocable para comprobar o postprocesar los resultados de " +"varias funciones." #: ../Doc/library/ctypes.rst:1598 msgid "" "*arguments* is a tuple containing the parameters originally passed to the " "function call, this allows specializing the behavior on the arguments used." msgstr "" +"*arguments* es una tupla que contiene los parámetros originalmente pasados a " +"la llamada de la función, esto permite especializar el comportamiento en los " +"argumentos utilizados." #: ../Doc/library/ctypes.rst:1602 msgid "" @@ -1591,17 +2163,24 @@ msgid "" "function call, but it can also check the result value and raise an exception " "if the foreign function call failed." msgstr "" +"El objeto que retorna esta función será retornado por la llamada de la " +"función foránea, pero también puede comprobar el valor del resultado y hacer " +"una excepción si la llamada de la función foránea ha fallado." #: ../Doc/library/ctypes.rst:1609 msgid "" "This exception is raised when a foreign function call cannot convert one of " "the passed arguments." msgstr "" +"Esta excepción se lanza cuando una llamada a una función foránea no puede " +"convertir uno de los argumentos pasados." msgid "" "Raises an :ref:`auditing event ` ``ctypes.seh_exception`` with " "argument ``code``." msgstr "" +"Lanza un :ref:`evento de auditoría ` ``ctypes.seh_exception`` con " +"el argumento ``code``." #: ../Doc/library/ctypes.rst:1615 msgid "" @@ -1611,11 +2190,19 @@ msgid "" "seh_exception`` with argument ``code`` will be raised, allowing an audit " "hook to replace the exception with its own." msgstr "" +"En Windows, cuando una llamada a una función foránea plantea una excepción " +"de sistema (por ejemplo, debido a una violación de acceso), será capturada y " +"sustituida por una excepción Python adecuada. Además, un evento de auditoría " +"``ctypes.seh_exception`` con el argumento ``code`` será levantado, " +"permitiendo que un gancho de auditoría reemplace la excepción con la suya " +"propia." msgid "" "Raises an :ref:`auditing event ` ``ctypes.call_function`` with " "arguments ``func_pointer``, ``arguments``." msgstr "" +"Lanza un :ref:`evento de auditoría ` ``ctypes.call_function`` con " +"argumentos ``func_pointer``, ``arguments``." #: ../Doc/library/ctypes.rst:1623 msgid "" @@ -1623,10 +2210,13 @@ msgid "" "``ctypes.call_function`` with arguments ``function pointer`` and " "``arguments``." msgstr "" +"Algunas formas de invocar llamadas a funciones foráneas pueden lanzar un " +"evento de auditoría ``ctypes.call_function`` con los argumentos ``function " +"pointer`` y ``arguments``." #: ../Doc/library/ctypes.rst:1629 msgid "Function prototypes" -msgstr "" +msgstr "Prototipos de funciones" #: ../Doc/library/ctypes.rst:1631 msgid "" @@ -1638,6 +2228,14 @@ msgid "" "decorator factories, and as such, be applied to functions through the " "``@wrapper`` syntax. See :ref:`ctypes-callback-functions` for examples." msgstr "" +"Las funciones foráneas también pueden crearse mediante la instanciación de " +"prototipos de funciones. Los prototipos de funciones son similares a los " +"prototipos de funciones en C; describen una función (tipo de retorno, tipos " +"de argumentos, convención de llamada) sin definir una implementación. Las " +"funciones de fábrica deben ser llamadas con el tipo de resultado deseado y " +"los tipos de argumento de la función, y pueden ser usadas como fábricas de " +"decoradores, y como tales, ser aplicadas a las funciones a través de la " +"sintaxis ``@wrapper``. Ver :ref:`ctypes-callback-functions` para ejemplos." #: ../Doc/library/ctypes.rst:1642 msgid "" @@ -1647,6 +2245,12 @@ msgid "" "`errno` variable is exchanged with the real :data:`errno` value before and " "after the call; *use_last_error* does the same for the Windows error code." msgstr "" +"El prototipo de función retornado crea funciones que usan la convención de " +"llamada C estándar. La función liberará el GIL durante la llamada. Si " +"*use_errno* se configura a true, la copia privada de ctypes de la variable " +"del sistema :data:`errno` se intercambia con el valor real :data:`errno` " +"antes y después de la llamada; *use_last_error* hace lo mismo con el código " +"de error de Windows." #: ../Doc/library/ctypes.rst:1652 msgid "" @@ -1656,12 +2260,19 @@ msgid "" "the GIL during the call. *use_errno* and *use_last_error* have the same " "meaning as above." msgstr "" +"Sólo Windows: El prototipo de función retornado crea funciones que usan la " +"convención de llamada ``stdcall``, excepto en Windows CE donde :func:" +"`WINFUNCTYPE` es lo mismo que :func:`CFUNCTYPE`. La función lanzará el GIL " +"durante la llamada. *use_errno* y *use_last_error* tienen el mismo " +"significado que arriba." #: ../Doc/library/ctypes.rst:1661 msgid "" "The returned function prototype creates functions that use the Python " "calling convention. The function will *not* release the GIL during the call." msgstr "" +"El prototipo de función retornado crea funciones que usan la convención de " +"llamadas de Python. La función *no* liberará el GIL durante la llamada." #: ../Doc/library/ctypes.rst:1664 msgid "" @@ -1669,16 +2280,23 @@ msgid "" "in different ways, depending on the type and number of the parameters in the " "call:" msgstr "" +"Los prototipos de funciones creados por estas funciones de fábrica pueden " +"ser instanciados de diferentes maneras, dependiendo del tipo y el número de " +"los parámetros en la llamada:" #: ../Doc/library/ctypes.rst:1672 msgid "" "Returns a foreign function at the specified address which must be an integer." msgstr "" +"Retorna una función foránea en la dirección especificada que debe ser un " +"número entero." #: ../Doc/library/ctypes.rst:1679 msgid "" "Create a C callable function (a callback function) from a Python *callable*." msgstr "" +"Crear una función de llamada C (una función de retrollamada) a partir de un " +"*callable* Python." #: ../Doc/library/ctypes.rst:1686 msgid "" @@ -1687,6 +2305,11 @@ msgid "" "exported function as string, or the ordinal of the exported function as " "small integer. The second item is the shared library instance." msgstr "" +"Retorna una función foránea exportada por una biblioteca compartida. " +"*func_spec* debe ser un 2-tupla ``(name_or_ordinal, library)``. El primer " +"elemento es el nombre de la función exportada como cadena, o el ordinal de " +"la función exportada como entero pequeño. El segundo elemento es la " +"instancia de la biblioteca compartida." #: ../Doc/library/ctypes.rst:1696 msgid "" @@ -1695,6 +2318,11 @@ msgid "" "is name of the COM method. *iid* is an optional pointer to the interface " "identifier which is used in extended error reporting." msgstr "" +"Retorna una función foránea que llamará a un método COM. *vtbl_index* es el " +"índice de la tabla de funciones virtuales, un pequeño entero no negativo. " +"*name* es el nombre del método COM. *iid* es un puntero opcional para el " +"identificador de la interfaz que se utiliza en el informe de errores " +"extendido." #: ../Doc/library/ctypes.rst:1701 msgid "" @@ -1702,62 +2330,75 @@ msgid "" "COM interface as first argument, in addition to those parameters that are " "specified in the :attr:`argtypes` tuple." msgstr "" +"Los métodos COM usan una convención especial de llamadas: Requieren un " +"puntero a la interfaz COM como primer argumento, además de los parámetros " +"que se especifican en la tupla :attr:`argtypes`." #: ../Doc/library/ctypes.rst:1705 msgid "" "The optional *paramflags* parameter creates foreign function wrappers with " "much more functionality than the features described above." msgstr "" +"El parámetro opcional *paramflags* crea envoltorios de funciones foráneas " +"con mucha más funcionalidad que las características descritas anteriormente." #: ../Doc/library/ctypes.rst:1708 msgid "*paramflags* must be a tuple of the same length as :attr:`argtypes`." msgstr "" +"*paramflags* deben ser una tupla de la misma longitud que :attr:`argtypes`." #: ../Doc/library/ctypes.rst:1710 msgid "" "Each item in this tuple contains further information about a parameter, it " "must be a tuple containing one, two, or three items." msgstr "" +"Cada elemento de esta tupla contiene más información sobre un parámetro, " +"debe ser una tupla que contenga uno, dos o tres elementos." #: ../Doc/library/ctypes.rst:1713 msgid "" "The first item is an integer containing a combination of direction flags for " "the parameter:" msgstr "" +"El primer elemento es un entero que contiene una combinación de flags de " +"dirección para el parámetro:" #: ../Doc/library/ctypes.rst:1717 msgid "1" -msgstr "" +msgstr "1" #: ../Doc/library/ctypes.rst:1717 msgid "Specifies an input parameter to the function." -msgstr "" +msgstr "Especifica un parámetro de entrada a la función." #: ../Doc/library/ctypes.rst:1720 msgid "2" -msgstr "" +msgstr "2" #: ../Doc/library/ctypes.rst:1720 msgid "Output parameter. The foreign function fills in a value." -msgstr "" +msgstr "Parámetro de salida. La función foránea rellena un valor." #: ../Doc/library/ctypes.rst:1723 msgid "4" -msgstr "" +msgstr "4" #: ../Doc/library/ctypes.rst:1723 msgid "Input parameter which defaults to the integer zero." -msgstr "" +msgstr "Parámetro de entrada que por defecto es el cero entero." #: ../Doc/library/ctypes.rst:1725 msgid "" "The optional second item is the parameter name as string. If this is " "specified, the foreign function can be called with named parameters." msgstr "" +"El segundo elemento opcional es el nombre del parámetro como cadena. Si se " +"especifica esto, se puede llamar a la función foránea con parámetros con " +"nombre." #: ../Doc/library/ctypes.rst:1728 msgid "The optional third item is the default value for this parameter." -msgstr "" +msgstr "El tercer elemento opcional es el valor por defecto de este parámetro." #: ../Doc/library/ctypes.rst:1730 msgid "" @@ -1765,14 +2406,17 @@ msgid "" "so that it supports default parameters and named arguments. The C " "declaration from the windows header file is this::" msgstr "" +"Este ejemplo demuestra cómo envolver la función ``MessageBoxW`` de Windows " +"para que soporte los parámetros por defecto y los argumentos con nombre. La " +"declaración C del archivo de cabecera de Windows es esta::" #: ../Doc/library/ctypes.rst:1741 ../Doc/library/ctypes.rst:1764 msgid "Here is the wrapping with :mod:`ctypes`::" -msgstr "" +msgstr "Aquí está el envoltorio con :mod:`ctypes`::" #: ../Doc/library/ctypes.rst:1749 msgid "The ``MessageBox`` foreign function can now be called in these ways::" -msgstr "" +msgstr "La función foránea de ``MessageBox`` puede ser llamada de esta manera:" #: ../Doc/library/ctypes.rst:1755 msgid "" @@ -1781,6 +2425,10 @@ msgid "" "copying them into ``RECT`` structure that the caller has to supply. Here is " "the C declaration::" msgstr "" +"Un segundo ejemplo demuestra los parámetros de salida. La función " +"``GetWindowRect`` de win32 retorna las dimensiones de una ventana " +"especificada copiándolas en la estructura ``RECT`` que la persona que llama " +"tiene que suministrar. Aquí está la declaración C::" #: ../Doc/library/ctypes.rst:1773 msgid "" @@ -1789,6 +2437,10 @@ msgid "" "parameter values when there are more than one, so the GetWindowRect function " "now returns a RECT instance, when called." msgstr "" +"Las funciones con parámetros de salida retornarán automáticamente el valor " +"del parámetro de salida si hay uno solo, o una tupla que contiene los " +"valores del parámetro de salida cuando hay más de uno, por lo que la función " +"GetWindowRect retorna ahora una instancia RECT, cuando se llama." #: ../Doc/library/ctypes.rst:1778 msgid "" @@ -1798,6 +2450,11 @@ msgid "" "function could do the error checking, and raises an exception when the api " "call failed::" msgstr "" +"Los parámetros de salida pueden combinarse con el protocolo :attr:`errcheck` " +"para hacer un mayor procesamiento de la salida y la comprobación de errores. " +"La función api de win32 ``GetWindowRect`` retorna un ``BOOL`` para señalar " +"el éxito o el fracaso, por lo que esta función podría hacer la comprobación " +"de errores, y plantea una excepción cuando la llamada api ha fallado::" #: ../Doc/library/ctypes.rst:1791 msgid "" @@ -1807,28 +2464,40 @@ msgid "" "instead of a ``RECT`` instance, you can retrieve the fields in the function " "and return them instead, the normal processing will no longer take place::" msgstr "" +"Si la función :attr:`errcheck` retorna la tupla de argumentos que recibe sin " +"cambios, :mod:`ctypes` continúa el procesamiento normal que hace en los " +"parámetros de salida. Si quieres retornar una tupla de coordenadas de " +"ventana en lugar de una instancia ``RECT``, puedes recuperar los campos de " +"la función y retornarlos en su lugar, el procesamiento normal ya no tendrá " +"lugar::" #: ../Doc/library/ctypes.rst:1810 msgid "Utility functions" -msgstr "" +msgstr "Funciones de utilidad" #: ../Doc/library/ctypes.rst:1814 msgid "" "Returns the address of the memory buffer as integer. *obj* must be an " "instance of a ctypes type." msgstr "" +"Retorna la dirección del buffer de memoria como un entero. *obj* debe ser " +"una instancia de tipo ctypes." #: ../Doc/library/ctypes.rst:1817 msgid "" "Raises an :ref:`auditing event ` ``ctypes.addressof`` with " "argument ``obj``." msgstr "" +"Lanza un :ref:`evento de auditoría ` ``ctypes.addressof`` con el " +"argumento ``obj``." #: ../Doc/library/ctypes.rst:1822 msgid "" "Returns the alignment requirements of a ctypes type. *obj_or_type* must be a " "ctypes type or instance." msgstr "" +"Retorna los requerimientos de alineación de un tipo de ctypes. *obj_or_type* " +"debe ser un tipo o instancia ctypes." #: ../Doc/library/ctypes.rst:1828 msgid "" @@ -1836,16 +2505,22 @@ msgid "" "ctypes type. *offset* defaults to zero, and must be an integer that will be " "added to the internal pointer value." msgstr "" +"Retorna un puntero ligero a *obj*, que debe ser un ejemplo de un tipo de " +"ctypes. *offset* es por defecto cero, y debe ser un entero que se añadirá al " +"valor del puntero interno." #: ../Doc/library/ctypes.rst:1832 msgid "``byref(obj, offset)`` corresponds to this C code::" -msgstr "" +msgstr "``byref(obj, offset)`` corresponde a este código C::" #: ../Doc/library/ctypes.rst:1836 msgid "" "The returned object can only be used as a foreign function call parameter. " "It behaves similar to ``pointer(obj)``, but the construction is a lot faster." msgstr "" +"El objeto retornado sólo puede ser utilizado como un parámetro de llamada de " +"función foránea. Se comporta de manera similar a ``pointer(obj)``, pero la " +"construcción es mucho más rápida." #: ../Doc/library/ctypes.rst:1842 msgid "" @@ -1854,18 +2529,27 @@ msgid "" "must be a pointer type, and *obj* must be an object that can be interpreted " "as a pointer." msgstr "" +"Esta función es similar a la del operador de reparto en C. retorna una nueva " +"instancia de *type* que apunta al mismo bloque de memoria que *obj*. *type* " +"debe ser un tipo de puntero, y *obj* debe ser un objeto que pueda ser " +"interpretado como un puntero." #: ../Doc/library/ctypes.rst:1850 msgid "" "This function creates a mutable character buffer. The returned object is a " "ctypes array of :class:`c_char`." msgstr "" +"Esta función crea un búfer de caracteres mutables. El objeto retornado es un " +"arreglo de ctypes de :class:`c_char`." #: ../Doc/library/ctypes.rst:1853 msgid "" "*init_or_size* must be an integer which specifies the size of the array, or " "a bytes object which will be used to initialize the array items." msgstr "" +"*init_or_size* debe ser un número entero que especifique el tamaño del " +"arreglo, o un objeto de bytes que se utilizará para inicializar los " +"elementos del arreglo." #: ../Doc/library/ctypes.rst:1856 msgid "" @@ -1875,24 +2559,35 @@ msgid "" "allows specifying the size of the array if the length of the bytes should " "not be used." msgstr "" +"Si se especifica un objeto bytes como primer argumento, el buffer se hace un " +"elemento más grande que su longitud, de modo que el último elemento del " +"arreglo es un carácter de terminación NUL. Se puede pasar un entero como " +"segundo argumento que permite especificar el tamaño del arreglo si no se " +"debe utilizar la longitud de los bytes." #: ../Doc/library/ctypes.rst:1861 msgid "" "Raises an :ref:`auditing event ` ``ctypes.create_string_buffer`` " "with arguments ``init``, ``size``." msgstr "" +"Lanza un :ref:`evento de auditoría ` ``ctypes." +"create_string_buffer`` con argumentos ``init``, ``size``." #: ../Doc/library/ctypes.rst:1866 msgid "" "This function creates a mutable unicode character buffer. The returned " "object is a ctypes array of :class:`c_wchar`." msgstr "" +"Esta función crea un búfer de caracteres unicode mutable. El objeto " +"retornado es un arreglo de ctypes de :class:`c_wchar`." #: ../Doc/library/ctypes.rst:1869 msgid "" "*init_or_size* must be an integer which specifies the size of the array, or " "a string which will be used to initialize the array items." msgstr "" +"*init_or_size* debe ser un entero que especifique el tamaño del arreglo, o " +"una cadena que se utilizará para inicializar los elementos del arreglo." #: ../Doc/library/ctypes.rst:1872 msgid "" @@ -1902,12 +2597,19 @@ msgid "" "which allows specifying the size of the array if the length of the string " "should not be used." msgstr "" +"Si se especifica una cadena como primer argumento, el búfer se hace un " +"elemento más grande que la longitud de la cadena, de modo que el último " +"elemento del arreglo es un carácter de terminación NUL. Se puede pasar un " +"entero como segundo argumento que permite especificar el tamaño del arreglo " +"si no se debe utilizar la longitud de la cadena." #: ../Doc/library/ctypes.rst:1878 msgid "" "Raises an :ref:`auditing event ` ``ctypes.create_unicode_buffer`` " "with arguments ``init``, ``size``." msgstr "" +"Lanza un :ref:`evento de auditoría ` ``ctypes." +"create_unicode_buffer`` con argumentos ``init``, ``size``." #: ../Doc/library/ctypes.rst:1883 msgid "" @@ -1915,6 +2617,9 @@ msgid "" "COM servers with ctypes. It is called from the DllCanUnloadNow function " "that the _ctypes extension dll exports." msgstr "" +"Sólo Windows: Esta función es un gancho que permite implementar servidores " +"COM en proceso con ctypes. Se llama desde la función DllCanUnloadNow que la " +"extensión _ctypes dll exporta." #: ../Doc/library/ctypes.rst:1890 msgid "" @@ -1922,14 +2627,22 @@ msgid "" "COM servers with ctypes. It is called from the DllGetClassObject function " "that the ``_ctypes`` extension dll exports." msgstr "" +"Sólo Windows: Esta función es un gancho que permite implementar servidores " +"COM en proceso con ctypes. Se llama desde la función DllGetClassObject que " +"la extensión ``_ctypes`` exporta." #: ../Doc/library/ctypes.rst:1898 msgid "" "Try to find a library and return a pathname. *name* is the library name " "without any prefix like ``lib``, suffix like ``.so``, ``.dylib`` or version " -"number (this is the form used for the posix linker option :option:`!-l`). " -"If no library can be found, returns ``None``." +"number (this is the form used for the posix linker option :option:`!-l`). If " +"no library can be found, returns ``None``." msgstr "" +"Intenta encontrar una biblioteca y retornar un nombre. *name* es el nombre " +"de la biblioteca sin ningún prefijo como ``lib``, sufijo como ``.so``, ``." +"dylib`` o número de versión (esta es la forma usada para la opción del " +"enlazador posix :option:`!-l`). Si no se puede encontrar ninguna biblioteca, " +"retorna ``None``." #: ../Doc/library/ctypes.rst:1909 msgid "" @@ -1937,6 +2650,9 @@ msgid "" "and by the extension modules. If the name of the library cannot be " "determined, ``None`` is returned." msgstr "" +"Sólo Windows: retorna el nombre de archivo de la biblioteca de tiempo de " +"ejecución de VC usada por Python, y por los módulos de extensión. Si no se " +"puede determinar el nombre de la biblioteca, se retorna ``None``." #: ../Doc/library/ctypes.rst:1913 msgid "" @@ -1944,6 +2660,9 @@ msgid "" "with a call to the ``free(void *)``, it is important that you use the " "function in the same library that allocated the memory." msgstr "" +"Si necesita liberar memoria, por ejemplo, asignada por un módulo de " +"extensión con una llamada al ``free(void *)``, es importante que utilice la " +"función en la misma biblioteca que asignó la memoria." #: ../Doc/library/ctypes.rst:1920 msgid "" @@ -1951,6 +2670,9 @@ msgid "" "error code is specified, the last error code is used by calling the Windows " "api function GetLastError." msgstr "" +"Sólo Windows: retorna una descripción textual del código de error *code*. Si " +"no se especifica ningún código de error, se utiliza el último código de " +"error llamando a la función de api de Windows GetLastError." #: ../Doc/library/ctypes.rst:1927 msgid "" @@ -1958,30 +2680,42 @@ msgid "" "thread. This function calls the Windows `GetLastError()` function directly, " "it does not return the ctypes-private copy of the error code." msgstr "" +"Sólo Windows: retorna el último código de error establecido por Windows en " +"el hilo de llamada. Esta función llama directamente a la función " +"`GetLastError()` de Windows, no retorna la copia ctypes-private del código " +"de error." #: ../Doc/library/ctypes.rst:1933 msgid "" "Returns the current value of the ctypes-private copy of the system :data:" "`errno` variable in the calling thread." msgstr "" +"Retorna el valor actual de la copia ctypes-private de la variable de " +"sistema :data:`errno` en el hilo de llamada." #: ../Doc/library/ctypes.rst:1936 msgid "" "Raises an :ref:`auditing event ` ``ctypes.get_errno`` with no " "arguments." msgstr "" +"Lanza un :ref:`evento de auditoría ` ``ctypes.get_errno`` sin " +"argumentos." #: ../Doc/library/ctypes.rst:1940 msgid "" "Windows only: returns the current value of the ctypes-private copy of the " "system :data:`LastError` variable in the calling thread." msgstr "" +"Sólo Windows: retorna el valor actual de la copia ctypes-private de la " +"variable de sistema :data:`LastError` en el hilo de llamada." #: ../Doc/library/ctypes.rst:1943 msgid "" "Raises an :ref:`auditing event ` ``ctypes.get_last_error`` with no " "arguments." msgstr "" +"Lanza un :ref:`evento de auditoría ` ``ctypes.get_last_error`` sin " +"argumentos." #: ../Doc/library/ctypes.rst:1947 msgid "" @@ -1989,6 +2723,9 @@ msgid "" "*src* to *dst*. *dst* and *src* must be integers or ctypes instances that " "can be converted to pointers." msgstr "" +"Igual que la función de la biblioteca estándar de C *memmove*: copia " +"*count* bytes de *src* a *dst*. *dst* y *src* deben ser enteros o instancias " +"ctypes que pueden ser convertidos en punteros." #: ../Doc/library/ctypes.rst:1954 msgid "" @@ -1996,6 +2733,10 @@ msgid "" "address *dst* with *count* bytes of value *c*. *dst* must be an integer " "specifying an address, or a ctypes instance." msgstr "" +"Igual que la función de la biblioteca estándar de C *memset* C: llena el " +"bloque de memoria en la dirección *dst* con *count* bytes de valor *c*. " +"*dst* debe ser un número entero que especifique una dirección, o una " +"instancia ctypes." #: ../Doc/library/ctypes.rst:1961 msgid "" @@ -2003,18 +2744,26 @@ msgid "" "types are cached and reused internally, so calling this function repeatedly " "is cheap. *type* must be a ctypes type." msgstr "" +"Esta función de fábrica crea y retorna un nuevo tipo de puntero ctypes. Los " +"tipos de puntero se almacenan en caché y se reutilizan internamente, por lo " +"que llamar a esta función repetidamente es barato. *type* debe ser un tipo " +"ctypes." #: ../Doc/library/ctypes.rst:1968 msgid "" "This function creates a new pointer instance, pointing to *obj*. The " "returned object is of the type ``POINTER(type(obj))``." msgstr "" +"Esta función crea una nueva instancia de puntero, apuntando a *obj*. El " +"objeto retornado es del tipo ``POINTER(tipo(obj))``." #: ../Doc/library/ctypes.rst:1971 msgid "" "Note: If you just want to pass a pointer to an object to a foreign function " "call, you should use ``byref(obj)`` which is much faster." msgstr "" +"Nota: Si sólo quieres pasar un puntero a un objeto a una llamada de función " +"foránea, deberías usar ``byref(obj)`` que es mucho más rápido." #: ../Doc/library/ctypes.rst:1977 msgid "" @@ -2023,18 +2772,26 @@ msgid "" "than the native size of the objects type, as given by ``sizeof(type(obj))``, " "but it is possible to enlarge the buffer." msgstr "" +"Esta función redimensiona el búfer de memoria interna de *obj*, que debe ser " +"una instancia de tipo ctypes. No es posible hacer el buffer más pequeño que " +"el tamaño nativo del tipo de objetos, como lo indica ``size of " +"(type(obj))``, pero es posible agrandar el buffer." #: ../Doc/library/ctypes.rst:1985 msgid "" "Set the current value of the ctypes-private copy of the system :data:`errno` " "variable in the calling thread to *value* and return the previous value." msgstr "" +"Poner el valor actual de la copia ctypes-private de la variable del sistema :" +"data:`errno` en el hilo de llamada a *valor* y retornar el valor anterior." #: ../Doc/library/ctypes.rst:1988 msgid "" "Raises an :ref:`auditing event ` ``ctypes.set_errno`` with " "argument ``errno``." msgstr "" +"Lanza un :ref:`evento de auditoría ` ``ctypes.set_errno`` con " +"argumento ``errno``." #: ../Doc/library/ctypes.rst:1993 msgid "" @@ -2042,18 +2799,25 @@ msgid "" "system :data:`LastError` variable in the calling thread to *value* and " "return the previous value." msgstr "" +"Sólo para Windows: pone el valor actual de la copia ctypes-private de la " +"variable del sistema :data:`LastError` en el hilo de llamada a *valor* y " +"retorna el valor anterior." #: ../Doc/library/ctypes.rst:1997 msgid "" "Raises an :ref:`auditing event ` ``ctypes.set_last_error`` with " "argument ``error``." msgstr "" +"Lanza un :ref:`evento de auditoría ` ``ctypes.set_last_error`` con " +"argumento ``error``." #: ../Doc/library/ctypes.rst:2002 msgid "" "Returns the size in bytes of a ctypes type or instance memory buffer. Does " "the same as the C ``sizeof`` operator." msgstr "" +"Retorna el tamaño en bytes de un buffer de memoria tipo ctypes o instancia. " +"Hace lo mismo que el operador C ``sizeof``." #: ../Doc/library/ctypes.rst:2008 msgid "" @@ -2061,12 +2825,17 @@ msgid "" "bytes object. If size is specified, it is used as size, otherwise the string " "is assumed to be zero-terminated." msgstr "" +"Esta función retorna la cadena C que comienza en la dirección de memoria " +"*address* como un objeto de bytes. Si se especifica el tamaño, se utiliza " +"como tamaño, de lo contrario se asume que la cadena tiene un final cero." #: ../Doc/library/ctypes.rst:2012 msgid "" "Raises an :ref:`auditing event ` ``ctypes.string_at`` with " "arguments ``address``, ``size``." msgstr "" +"Lanza un :ref:`evento de auditoría ` ``ctypes.string_at`` con " +"argumentos ``address``, ``size``." #: ../Doc/library/ctypes.rst:2017 msgid "" @@ -2076,10 +2845,15 @@ msgid "" "specified, :func:`FormatError` is called to get a textual description of the " "error." msgstr "" +"Sólo para Windows: esta función es probablemente la cosa peor nombrada de " +"los ctypes. Crea una instancia de OSError. Si no se especifica el *code*, se " +"llama a ``GetLastError`` para determinar el código de error. Si no se " +"especifica *descr*, se llama a :func:`FormatError`` para obtener una " +"descripción textual del error." #: ../Doc/library/ctypes.rst:2023 msgid "An instance of :exc:`WindowsError` used to be created." -msgstr "" +msgstr "Una instancia de :exc:`WindowsError` solía ser creada." #: ../Doc/library/ctypes.rst:2029 msgid "" @@ -2088,16 +2862,22 @@ msgid "" "characters of the string, otherwise the string is assumed to be zero-" "terminated." msgstr "" +"Esta función retorna la cadena de caracteres anchos que comienza en la " +"dirección de memoria *address* como una cadena. Si se especifica *size*, se " +"utiliza como el número de caracteres de la cadena, de lo contrario se asume " +"que la cadena tiene un final cero." #: ../Doc/library/ctypes.rst:2034 msgid "" "Raises an :ref:`auditing event ` ``ctypes.wstring_at`` with " "arguments ``address``, ``size``." msgstr "" +"Lanza un :ref:`evento de auditoría ` ``ctypes.wstring_at`` con " +"argumentos ``address``, ``size``." #: ../Doc/library/ctypes.rst:2040 msgid "Data types" -msgstr "" +msgstr "Tipos de datos" #: ../Doc/library/ctypes.rst:2045 msgid "" @@ -2108,12 +2888,21 @@ msgid "" "attr:`_objects`; this contains other Python objects that need to be kept " "alive in case the memory block contains pointers." msgstr "" +"Esta clase no pública es la clase de base común de todos los tipos de datos " +"de los ctypes. Entre otras cosas, todas las instancias de tipo ctypes " +"contienen un bloque de memoria que contiene datos compatibles con C; la " +"dirección del bloque de memoria es retornada por la función de ayuda :func:" +"`addressof`. Otra variable de instancia se expone como :attr:`_objetos`; " +"ésta contiene otros objetos de Python que deben mantenerse vivos en caso de " +"que el bloque de memoria contenga punteros." #: ../Doc/library/ctypes.rst:2052 msgid "" "Common methods of ctypes data types, these are all class methods (to be " "exact, they are methods of the :term:`metaclass`):" msgstr "" +"Métodos comunes de tipos de datos ctypes, estos son todos métodos de clase " +"(para ser exactos, son métodos del :term:`metaclass`):" #: ../Doc/library/ctypes.rst:2057 msgid "" @@ -2123,12 +2912,19 @@ msgid "" "in bytes; the default is zero. If the source buffer is not large enough a :" "exc:`ValueError` is raised." msgstr "" +"Este método retorna una instancia ctypes que comparte el buffer del objeto " +"*source*. El objeto *source* debe soportar la interfaz del buffer de " +"escritura. El parámetro opcional *offset* especifica un offset en el buffer " +"de la fuente en bytes; el valor por defecto es cero. Si el buffer de la " +"fuente no es lo suficientemente grande se lanza un :exc:`ValueError`." #: ../Doc/library/ctypes.rst:2063 ../Doc/library/ctypes.rst:2073 msgid "" "Raises an :ref:`auditing event ` ``ctypes.cdata/buffer`` with " "arguments ``pointer``, ``size``, ``offset``." msgstr "" +"Lanza un :ref:`evento de auditoría ` ``ctypes.cdata/buffer`` con " +"argumentos ``pointer``, ``size``, ``offset``." #: ../Doc/library/ctypes.rst:2067 msgid "" @@ -2137,23 +2933,34 @@ msgid "" "specifies an offset into the source buffer in bytes; the default is zero. " "If the source buffer is not large enough a :exc:`ValueError` is raised." msgstr "" +"Este método crea una instancia ctypes, copiando el buffer del buffer de " +"objetos *source* que debe ser legible. El parámetro opcional *offset* " +"especifica un offset en el buffer de origen en bytes; el valor por defecto " +"es cero. Si el buffer de fuente no es lo suficientemente grande se lanza un :" +"exc:`ValueError`." #: ../Doc/library/ctypes.rst:2077 msgid "" "This method returns a ctypes type instance using the memory specified by " "*address* which must be an integer." msgstr "" +"Este método retorna una instancia de tipo ctypes utilizando la memoria " +"especificada por *address* que debe ser un entero." msgid "" "Raises an :ref:`auditing event ` ``ctypes.cdata`` with argument " "``address``." msgstr "" +"Lanza un :ref:`evento de auditoría ` ``ctypes.cdata`` con " +"argumento ``address``." #: ../Doc/library/ctypes.rst:2082 msgid "" "This method, and others that indirectly call this method, raises an :ref:" "`auditing event ` ``ctypes.cdata`` with argument ``address``." msgstr "" +"Este método, y otros que indirectamente llaman a este método, lanzan un :ref:" +"`evento de auditoría ` ``ctypes.cdata`` con argumento ``address``." #: ../Doc/library/ctypes.rst:2088 msgid "" @@ -2162,6 +2969,10 @@ msgid "" "foreign function's :attr:`argtypes` tuple; it must return an object that can " "be used as a function call parameter." msgstr "" +"Este método adapta el *obj* a un tipo de ctypes. Se llama con el objeto real " +"usado en una llamada a una función externa cuando el tipo está presente en " +"la tupla :attr:`argtypes` de la función foránea; debe retornar un objeto que " +"pueda ser usado como parámetro de llamada a la función." #: ../Doc/library/ctypes.rst:2093 msgid "" @@ -2169,6 +2980,9 @@ msgid "" "normally returns *obj* if that is an instance of the type. Some types " "accept other objects as well." msgstr "" +"Todos los tipos de datos ctypes tienen una implementación por defecto de " +"este método de clase que normalmente retorna *obj* si es una instancia del " +"tipo. Algunos tipos aceptan también otros objetos." #: ../Doc/library/ctypes.rst:2099 msgid "" @@ -2176,10 +2990,13 @@ msgid "" "*name* is the name of the symbol that exports the data, *library* is the " "loaded shared library." msgstr "" +"Este método retorna una instancia de tipo ctypes exportada por una " +"biblioteca compartida. *name* es el nombre del símbolo que exporta los " +"datos, *library* es la biblioteca compartida cargada." #: ../Doc/library/ctypes.rst:2103 msgid "Common instance variables of ctypes data types:" -msgstr "" +msgstr "Variables de instancia común de los tipos de datos de ctypes:" #: ../Doc/library/ctypes.rst:2107 msgid "" @@ -2188,12 +3005,19 @@ msgid "" "`_b_base_` read-only member is the root ctypes object that owns the memory " "block." msgstr "" +"A veces, las instancias de datos ctypes no poseen el bloque de memoria que " +"contienen, sino que comparten parte del bloque de memoria de un objeto base. " +"El miembro de sólo lectura :attr:`_b_base_` es el objeto raíz ctypes que " +"posee el bloque de memoria." #: ../Doc/library/ctypes.rst:2114 msgid "" "This read-only variable is true when the ctypes data instance has allocated " "the memory block itself, false otherwise." msgstr "" +"Esta variable de sólo lectura es verdadera cuando la instancia de datos " +"ctypes ha sido asignada a el propio bloque de memoria, falsa en caso " +"contrario." #: ../Doc/library/ctypes.rst:2119 msgid "" @@ -2202,6 +3026,10 @@ msgid "" "This object is only exposed for debugging; never modify the contents of this " "dictionary." msgstr "" +"Este miembro es ``None`` o un diccionario que contiene objetos de Python que " +"deben mantenerse vivos para que el contenido del bloque de memoria sea " +"válido. Este objeto sólo se expone para su depuración; nunca modifique el " +"contenido de este diccionario." #: ../Doc/library/ctypes.rst:2132 msgid "" @@ -2211,10 +3039,16 @@ msgid "" "class:`_CData`, so it inherits their methods and attributes. ctypes data " "types that are not and do not contain pointers can now be pickled." msgstr "" +"Esta clase no pública es la clase base de todos los tipos de datos de ctypes " +"fundamentales. Se menciona aquí porque contiene los atributos comunes de los " +"tipos de datos de ctypes fundamentales. :class:`_SimpleCData` es una " +"subclase de :class:`_CData`, por lo que hereda sus métodos y atributos. Los " +"tipos de datos ctypes que no son y no contienen punteros ahora pueden ser " +"archivados." #: ../Doc/library/ctypes.rst:2138 msgid "Instances have a single attribute:" -msgstr "" +msgstr "Los instancias tienen un solo atributo:" #: ../Doc/library/ctypes.rst:2142 msgid "" @@ -2223,6 +3057,10 @@ msgid "" "character bytes object or string, for character pointer types it is a Python " "bytes object or string." msgstr "" +"Este atributo contiene el valor real de la instancia. Para los tipos enteros " +"y punteros, es un entero, para los tipos de caracteres, es un objeto o " +"cadena de bytes de un solo carácter, para los tipos de punteros de " +"caracteres es un objeto o cadena de bytes de Python." #: ../Doc/library/ctypes.rst:2147 msgid "" @@ -2231,6 +3069,10 @@ msgid "" "original object return, always a new object is constructed. The same is " "true for all other ctypes object instances." msgstr "" +"Cuando el atributo ``value`` se recupera de una instancia ctypes, " +"normalmente se retorna un nuevo objeto cada vez. :mod:`ctypes` *no* " +"implementa el retorno del objeto original, siempre se construye un nuevo " +"objeto. Lo mismo ocurre con todas las demás instancias de objetos ctypes." #: ../Doc/library/ctypes.rst:2153 msgid "" @@ -2240,6 +3082,12 @@ msgid "" "foreign function has a :attr:`restype` of :class:`c_char_p`, you will always " "receive a Python bytes object, *not* a :class:`c_char_p` instance." msgstr "" +"Los tipos de datos fundamentales, cuando se retornan como resultados de " +"llamadas de funciones foráneas, o, por ejemplo, al recuperar miembros de " +"campo de estructura o elementos de arreglos, se convierten de forma " +"transparente a tipos nativos de Python. En otras palabras, si una función " +"externa tiene un :attr:`restype` de :class:`c_char_p`, siempre recibirá un " +"objeto de bytes Python, *no* una instancia de :class:`c_char_p`." #: ../Doc/library/ctypes.rst:2161 msgid "" @@ -2248,10 +3096,15 @@ msgid "" "will receive an instance of this subclass from the function call. Of course, " "you can get the value of the pointer by accessing the ``value`` attribute." msgstr "" +"Las subclases de los tipos de datos fundamentales *no* heredan este " +"comportamiento. Así, si una función externa :attr:`restype` es una subclase " +"de :class:`c_void_p`, recibirás una instancia de esta subclase desde la " +"llamada a la función. Por supuesto, puedes obtener el valor del puntero " +"accediendo al atributo ``value``." #: ../Doc/library/ctypes.rst:2166 msgid "These are the fundamental ctypes data types:" -msgstr "" +msgstr "Estos son los tipos de datos fundamentales de ctypes:" #: ../Doc/library/ctypes.rst:2170 msgid "" @@ -2259,6 +3112,9 @@ msgid "" "small integer. The constructor accepts an optional integer initializer; no " "overflow checking is done." msgstr "" +"Representa el tipo de datos C :c:type:`signed char`, e interpreta el valor " +"como un entero pequeño. El constructor acepta un inicializador de entero " +"opcional; no se hace ninguna comprobación de desbordamiento." #: ../Doc/library/ctypes.rst:2177 msgid "" @@ -2266,6 +3122,9 @@ msgid "" "single character. The constructor accepts an optional string initializer, " "the length of the string must be exactly one character." msgstr "" +"Representa el tipo de datos C :c:type:`char`, e interpreta el valor como un " +"solo carácter. El constructor acepta un inicializador de cadena opcional, la " +"longitud de la cadena debe ser exactamente un carácter." #: ../Doc/library/ctypes.rst:2184 msgid "" @@ -2274,12 +3133,18 @@ msgid "" "binary data, ``POINTER(c_char)`` must be used. The constructor accepts an " "integer address, or a bytes object." msgstr "" +"Representa el tipo de datos C :c:type:`char *` cuando apunta a una cadena " +"terminada en cero. Para un puntero de carácter general que también puede " +"apuntar a datos binarios, se debe usar ``POINTER(c_char)``. El constructor " +"acepta una dirección entera, o un objeto de bytes." #: ../Doc/library/ctypes.rst:2192 msgid "" "Represents the C :c:type:`double` datatype. The constructor accepts an " "optional float initializer." msgstr "" +"Representa el tipo de datos C :c:type:`double`. El constructor acepta un " +"inicializador flotante opcional." #: ../Doc/library/ctypes.rst:2198 msgid "" @@ -2287,12 +3152,17 @@ msgid "" "optional float initializer. On platforms where ``sizeof(long double) == " "sizeof(double)`` it is an alias to :class:`c_double`." msgstr "" +"Representa el tipo de datos C :c:type:`long double`. El constructor acepta " +"un inicializador flotante opcional. En las plataformas donde ``sizeof(long " +"double) == sizeof(double)`` es un alias de :class:`c_double`." #: ../Doc/library/ctypes.rst:2204 msgid "" "Represents the C :c:type:`float` datatype. The constructor accepts an " "optional float initializer." msgstr "" +"Representa el tipo de datos C :c:type:`float`. El constructor acepta un " +"inicializador flotante opcional." #: ../Doc/library/ctypes.rst:2210 msgid "" @@ -2300,56 +3170,77 @@ msgid "" "optional integer initializer; no overflow checking is done. On platforms " "where ``sizeof(int) == sizeof(long)`` it is an alias to :class:`c_long`." msgstr "" +"Representa el tipo de datos C :c:type:`signed int`. El constructor acepta un " +"inicializador entero opcional; no se hace ninguna comprobación de " +"desbordamiento. En plataformas donde ``sizeof(int) == sizeof(long)`` es un " +"alias de :class:`c_long`." #: ../Doc/library/ctypes.rst:2217 msgid "" "Represents the C 8-bit :c:type:`signed int` datatype. Usually an alias for :" "class:`c_byte`." msgstr "" +"Representa el tipo de datos C 8-bit :c:type:`signed int`. Normalmente un " +"alias para :class:`c_byte`." #: ../Doc/library/ctypes.rst:2223 msgid "" "Represents the C 16-bit :c:type:`signed int` datatype. Usually an alias " "for :class:`c_short`." msgstr "" +"Representa el tipo de datos C 16-bit :c:type:`signed int`. Normalmente un " +"alias para :class:`c_short`." #: ../Doc/library/ctypes.rst:2229 msgid "" "Represents the C 32-bit :c:type:`signed int` datatype. Usually an alias " "for :class:`c_int`." msgstr "" +"Representa el tipo de datos C 32-bit :c:type:`signed int`. Normalmente un " +"alias para :class:`c_int`." #: ../Doc/library/ctypes.rst:2235 msgid "" "Represents the C 64-bit :c:type:`signed int` datatype. Usually an alias " "for :class:`c_longlong`." msgstr "" +"Representa el tipo de datos C 64-bit :c:type:`signed int`. Normalmente un " +"alias para :class:`c_longlong`." #: ../Doc/library/ctypes.rst:2241 msgid "" "Represents the C :c:type:`signed long` datatype. The constructor accepts an " "optional integer initializer; no overflow checking is done." msgstr "" +"Representa el tipo de datos C :c:type:`signed long`. El constructor acepta " +"un inicializador entero opcional; no se hace ninguna comprobación de " +"desbordamiento." #: ../Doc/library/ctypes.rst:2247 msgid "" "Represents the C :c:type:`signed long long` datatype. The constructor " "accepts an optional integer initializer; no overflow checking is done." msgstr "" +"Representa el tipo de datos C :c:type:`significado long long`. El " +"constructor acepta un inicializador entero opcional; no se hace ninguna " +"comprobación de desbordamiento." #: ../Doc/library/ctypes.rst:2253 msgid "" "Represents the C :c:type:`signed short` datatype. The constructor accepts " "an optional integer initializer; no overflow checking is done." msgstr "" +"Representa el tipo de datos C :c:type:`signed short`. El constructor acepta " +"un inicializador entero opcional; no se hace ninguna comprobación de " +"desbordamiento." #: ../Doc/library/ctypes.rst:2259 msgid "Represents the C :c:type:`size_t` datatype." -msgstr "" +msgstr "Representa el tipo de datos C :c:type:`size_t`." #: ../Doc/library/ctypes.rst:2264 msgid "Represents the C :c:type:`ssize_t` datatype." -msgstr "" +msgstr "Representa el tipo de datos C :c:type:`ssize_t`." #: ../Doc/library/ctypes.rst:2271 msgid "" @@ -2357,6 +3248,9 @@ msgid "" "as small integer. The constructor accepts an optional integer initializer; " "no overflow checking is done." msgstr "" +"Representa el tipo de datos C :c:type:`unsigned char`, interpreta el valor " +"como un entero pequeño. El constructor acepta un inicializador entero " +"opcional; no se hace ninguna comprobación de desbordamiento." #: ../Doc/library/ctypes.rst:2278 msgid "" @@ -2364,54 +3258,77 @@ msgid "" "an optional integer initializer; no overflow checking is done. On platforms " "where ``sizeof(int) == sizeof(long)`` it is an alias for :class:`c_ulong`." msgstr "" +"Representa el tipo de datos C :c:type:`unsigned int`. El constructor acepta " +"un inicializador entero opcional; no se hace ninguna comprobación de " +"desbordamiento. En plataformas donde ``sizeof(int) == sizeof(long)`` es un " +"alias para :class:`c_ulong`." #: ../Doc/library/ctypes.rst:2285 msgid "" "Represents the C 8-bit :c:type:`unsigned int` datatype. Usually an alias " "for :class:`c_ubyte`." msgstr "" +"Representa el tipo de datos C 8-bit :c:type:`unsigned int`. Normalmente un " +"alias para :class:`c_ubyte`." #: ../Doc/library/ctypes.rst:2291 msgid "" "Represents the C 16-bit :c:type:`unsigned int` datatype. Usually an alias " "for :class:`c_ushort`." msgstr "" +"Representa el tipo de datos C 16-bit :c:type:`unsigned int`. Normalmente un " +"alias para :class:`c_ushort`." #: ../Doc/library/ctypes.rst:2297 msgid "" "Represents the C 32-bit :c:type:`unsigned int` datatype. Usually an alias " "for :class:`c_uint`." msgstr "" +"Representa el tipo de datos C 32-bit :c:type:`unsigned int`. Normalmente un " +"alias para :class:`c_uint`." #: ../Doc/library/ctypes.rst:2303 msgid "" "Represents the C 64-bit :c:type:`unsigned int` datatype. Usually an alias " "for :class:`c_ulonglong`." msgstr "" +"Representa el tipo de datos C 64-bit :c:type:`unsigned int`. Normalmente un " +"alias para :class:`c_ulonglong`." #: ../Doc/library/ctypes.rst:2309 msgid "" "Represents the C :c:type:`unsigned long` datatype. The constructor accepts " "an optional integer initializer; no overflow checking is done." msgstr "" +"Representa el tipo de datos C :c:type:`unsigned long`. El constructor acepta " +"un inicializador entero opcional; no se hace ninguna comprobación de " +"desbordamiento." #: ../Doc/library/ctypes.rst:2315 msgid "" "Represents the C :c:type:`unsigned long long` datatype. The constructor " "accepts an optional integer initializer; no overflow checking is done." msgstr "" +"Representa el tipo de datos C :c:type:`unsigned long long`. El constructor " +"acepta un inicializador entero opcional; no se hace ninguna comprobación de " +"desbordamiento." #: ../Doc/library/ctypes.rst:2321 msgid "" "Represents the C :c:type:`unsigned short` datatype. The constructor accepts " "an optional integer initializer; no overflow checking is done." msgstr "" +"Representa el tipo de datos C :c:type:`unsigned short`. El constructor " +"acepta un inicializador entero opcional; no se hace ninguna comprobación de " +"desbordamiento." #: ../Doc/library/ctypes.rst:2327 msgid "" "Represents the C :c:type:`void *` type. The value is represented as " "integer. The constructor accepts an optional integer initializer." msgstr "" +"Representa el tipo C :c:type:`void *`. El valor se representa como un " +"entero. El constructor acepta un inicializador entero opcional." #: ../Doc/library/ctypes.rst:2333 msgid "" @@ -2419,6 +3336,10 @@ msgid "" "single character unicode string. The constructor accepts an optional string " "initializer, the length of the string must be exactly one character." msgstr "" +"Representa el tipo de datos C :c:type:`wchar_t`, e interpreta el valor como " +"una cadena unicode de un solo carácter. El constructor acepta un " +"inicializador de cadena opcional, la longitud de la cadena debe ser " +"exactamente de un carácter." #: ../Doc/library/ctypes.rst:2340 msgid "" @@ -2426,6 +3347,9 @@ msgid "" "zero-terminated wide character string. The constructor accepts an integer " "address, or a string." msgstr "" +"Representa el tipo de datos C :c:type:`wchar_t *`, que debe ser un puntero a " +"una cadena de caracteres anchos con terminación cero. El constructor acepta " +"una dirección entera, o una cadena." #: ../Doc/library/ctypes.rst:2347 msgid "" @@ -2433,18 +3357,25 @@ msgid "" "from C99). Its value can be ``True`` or ``False``, and the constructor " "accepts any object that has a truth value." msgstr "" +"Representa el tipo de datos C :c:type:`bool` (más exactamente, :c:type:" +"`_Bool` de C99). Su valor puede ser ``True`` o ``False``, y el constructor " +"acepta cualquier objeto que tenga un valor verdadero." #: ../Doc/library/ctypes.rst:2354 msgid "" "Windows only: Represents a :c:type:`HRESULT` value, which contains success " "or error information for a function or method call." msgstr "" +"Sólo Windows: Representa un valor :c:type:`HRESULT` , que contiene " +"información de éxito o error para una llamada de función o método." #: ../Doc/library/ctypes.rst:2360 msgid "" "Represents the C :c:type:`PyObject *` datatype. Calling this without an " "argument creates a ``NULL`` :c:type:`PyObject *` pointer." msgstr "" +"Representa el tipo de datos C :c:type:`PyObject *`. Llamar esto sin un " +"argumento crea un puntero ``NULL`` :c:type:`PyObject *`." #: ../Doc/library/ctypes.rst:2363 msgid "" @@ -2453,32 +3384,40 @@ msgid "" "`DWORD`. Some useful structures like :c:type:`MSG` or :c:type:`RECT` are " "also defined." msgstr "" +"El módulo :mod:`ctypes.wintypes` proporciona otros tipos de datos " +"específicos de Windows, por ejemplo :c:type:`HWND`, :c:type:`WPARAM`, o :c:" +"type:`DWORD`. Algunas estructuras útiles como :c:type:`MSG` o :c:type:`RECT` " +"también están definidas." #: ../Doc/library/ctypes.rst:2371 msgid "Structured data types" -msgstr "" +msgstr "Tipos de datos estructurados" #: ../Doc/library/ctypes.rst:2376 msgid "Abstract base class for unions in native byte order." -msgstr "" +msgstr "Clase base abstracta para uniones en orden de bytes nativos." #: ../Doc/library/ctypes.rst:2381 msgid "Abstract base class for structures in *big endian* byte order." -msgstr "" +msgstr "Clase base abstracta para estructuras en orden de bytes *big endian*." #: ../Doc/library/ctypes.rst:2386 msgid "Abstract base class for structures in *little endian* byte order." msgstr "" +"Clase base abstracta para estructuras en orden de bytes *little endian*." #: ../Doc/library/ctypes.rst:2388 msgid "" "Structures with non-native byte order cannot contain pointer type fields, or " "any other data types containing pointer type fields." msgstr "" +"Las estructuras con un orden de bytes no nativo no pueden contener campos de " +"tipo puntero, o cualquier otro tipo de datos que contenga campos de tipo " +"puntero." #: ../Doc/library/ctypes.rst:2394 msgid "Abstract base class for structures in *native* byte order." -msgstr "" +msgstr "Clase base abstracta para estructuras en orden de bytes *native*." #: ../Doc/library/ctypes.rst:2396 msgid "" @@ -2487,6 +3426,10 @@ msgid "" "`ctypes` will create :term:`descriptor`\\s which allow reading and writing " "the fields by direct attribute accesses. These are the" msgstr "" +"La estructura concreta y los tipos de unión deben crearse subclasificando " +"uno de estos tipos, y al menos definir una variable de clase :attr:" +"`_fields_`. :mod:`ctypes` creará :term:`descriptor`\\s que permitan leer y " +"escribir los campos por accesos directos de atributos. Estos son los" #: ../Doc/library/ctypes.rst:2404 msgid "" @@ -2494,6 +3437,9 @@ msgid "" "tuples. The first item is the name of the field, the second item specifies " "the type of the field; it can be any ctypes data type." msgstr "" +"Una secuencia que define los campos de estructura. Los elementos deben ser " +"de 2 o 3 tuplas. El primer ítem es el nombre del campo, el segundo ítem " +"especifica el tipo de campo; puede ser cualquier tipo de datos ctypes." #: ../Doc/library/ctypes.rst:2408 msgid "" @@ -2501,12 +3447,18 @@ msgid "" "given. It must be a small positive integer defining the bit width of the " "field." msgstr "" +"Para los campos de tipo entero como :class:`c_int`, se puede dar un tercer " +"elemento opcional. Debe ser un pequeño entero positivo que defina el ancho " +"de bit del campo." #: ../Doc/library/ctypes.rst:2412 msgid "" "Field names must be unique within one structure or union. This is not " "checked, only one field can be accessed when names are repeated." msgstr "" +"Los nombres de los campos deben ser únicos dentro de una estructura o unión. " +"Esto no se comprueba, sólo se puede acceder a un campo cuando los nombres se " +"repiten." #: ../Doc/library/ctypes.rst:2415 msgid "" @@ -2514,6 +3466,9 @@ msgid "" "class statement that defines the Structure subclass, this allows creating " "data types that directly or indirectly reference themselves::" msgstr "" +"Es posible definir la variable de clase :attr:`_fields_` *después* de la " +"sentencia de clase que define la subclase Estructura, esto permite crear " +"tipos de datos que se refieren directa o indirectamente a sí mismos::" #: ../Doc/library/ctypes.rst:2425 msgid "" @@ -2522,6 +3477,10 @@ msgid "" "and so on). Later assignments to the :attr:`_fields_` class variable will " "raise an AttributeError." msgstr "" +"Sin embargo, la variable de clase :attr:`_fields_` debe ser definida antes " +"de que el tipo sea usado por primera vez (se crea una instancia, se llama a :" +"func:`sizeof`, y así sucesivamente). Las asignaciones posteriores a la " +"variable de clase :attr:`_fields_` lanzarán un AttributeError." #: ../Doc/library/ctypes.rst:2430 msgid "" @@ -2529,6 +3488,8 @@ msgid "" "fields of the base class plus the :attr:`_fields_` defined in the sub-" "subclass, if any." msgstr "" +"Es posible definir subclases de tipos de estructura, que heredan los campos " +"de la clase base más el :attr:`_fields_` definido en la subclase, si existe." #: ../Doc/library/ctypes.rst:2437 msgid "" @@ -2536,6 +3497,9 @@ msgid "" "fields in the instance. :attr:`_pack_` must already be defined when :attr:" "`_fields_` is assigned, otherwise it will have no effect." msgstr "" +"Un pequeño entero opcional que permite anular la alineación de los campos de " +"estructura en la instancia. :attr:`_pack_` ya debe estar definido cuando se " +"asigna :attr:`_fields_`, de lo contrario no tendrá ningún efecto." #: ../Doc/library/ctypes.rst:2444 msgid "" @@ -2543,6 +3507,9 @@ msgid "" "attr:`_anonymous_` must be already defined when :attr:`_fields_` is " "assigned, otherwise it will have no effect." msgstr "" +"Una secuencia opcional que enumera los nombres de los campos sin nombre " +"(anónimos). :attr:`_anonymous_` debe estar ya definida cuando se asigna :" +"attr:`_fields_`, de lo contrario no tendrá ningún efecto." #: ../Doc/library/ctypes.rst:2448 msgid "" @@ -2551,10 +3518,14 @@ msgid "" "accessing the nested fields directly, without the need to create the " "structure or union field." msgstr "" +"Los campos listados en esta variable deben ser campos de tipo estructura o " +"unión. :mod:`ctypes` creará descriptores en el tipo de estructura que " +"permitan acceder a los campos anidados directamente, sin necesidad de crear " +"el campo de estructura o unión." #: ../Doc/library/ctypes.rst:2453 msgid "Here is an example type (Windows)::" -msgstr "" +msgstr "Aquí hay un tipo de ejemplo (Windows)::" #: ../Doc/library/ctypes.rst:2466 msgid "" @@ -2565,6 +3536,12 @@ msgid "" "equivalent, but the former is faster since it does not need to create a " "temporary union instance::" msgstr "" +"La estructura ``TYPEDESC`` describe un tipo de datos COM, el campo ``vt`` " +"especifica cuál de los campos de unión es válido. Como el campo ``u`` está " +"definido como campo anónimo, ahora es posible acceder a los miembros " +"directamente desde la instancia TYPEDESC. ``td.lptdesc`` y ``td.u.lptdesc`` " +"son equivalentes, pero el primero es más rápido ya que no necesita crear una " +"instancia de unión temporal::" #: ../Doc/library/ctypes.rst:2478 msgid "" @@ -2573,6 +3550,10 @@ msgid "" "`_fields_` variable, the fields specified in this are appended to the fields " "of the base class." msgstr "" +"Es posible definir subclases de estructuras, que heredan los campos de la " +"clase base. Si la definición de la subclase tiene una variable :attr:" +"`_fields_` separada, los campos especificados en ella se añaden a los campos " +"de la clase base." #: ../Doc/library/ctypes.rst:2483 msgid "" @@ -2583,14 +3564,21 @@ msgid "" "initialize :attr:`_fields_` with the same name, or create new attributes for " "names not present in :attr:`_fields_`." msgstr "" +"Los constructores de estructuras y uniones aceptan tanto argumentos " +"posicionales como de palabras clave. Los argumentos posicionales se usan " +"para inicializar los campos de los miembros en el mismo orden en que " +"aparecen en :attr:`_fields_`. Los argumentos de palabras clave en el " +"constructor se interpretan como asignaciones de atributos, por lo que " +"inicializarán :attr:`_fields_` con el mismo nombre, o crearán nuevos " +"atributos para nombres no presentes en :attr:`_fields_`." #: ../Doc/library/ctypes.rst:2494 msgid "Arrays and pointers" -msgstr "" +msgstr "Arreglos y punteros" #: ../Doc/library/ctypes.rst:2498 msgid "Abstract base class for arrays." -msgstr "" +msgstr "Clase base abstracta para arreglos." #: ../Doc/library/ctypes.rst:2500 msgid "" @@ -2601,6 +3589,12 @@ msgid "" "and slice accesses; for slice reads, the resulting object is *not* itself " "an :class:`Array`." msgstr "" +"La forma recomendada de crear tipos de arreglos concretos es multiplicando " +"cualquier tipo de datos :mod:`ctypes` con un número entero positivo. " +"Alternativamente, puedes subclasificar este tipo y definir las variables de " +"clase :attr:`_length_` y :attr:`_type_`. Los elementos del arreglo pueden " +"ser leídos y escritos usando subíndices estándar y accesos slice; para las " +"lecturas slice, el objeto resultante *no es* en sí mismo un :class:`Array`." #: ../Doc/library/ctypes.rst:2510 msgid "" @@ -2608,26 +3602,33 @@ msgid "" "range subscripts result in an :exc:`IndexError`. Will be returned by :func:" "`len`." msgstr "" +"Un número entero positivo que especifica el número de elementos del " +"conjunto. Los subíndices fuera de rango dan como resultado un :exc:" +"`IndexError`. Será retornado por :func:`len`." #: ../Doc/library/ctypes.rst:2517 msgid "Specifies the type of each element in the array." -msgstr "" +msgstr "Especifica el tipo de cada elemento del arreglo." #: ../Doc/library/ctypes.rst:2520 msgid "" "Array subclass constructors accept positional arguments, used to initialize " "the elements in order." msgstr "" +"Los constructores de subclases de arreglos aceptan argumentos posicionales, " +"usados para inicializar los elementos en orden." #: ../Doc/library/ctypes.rst:2526 msgid "Private, abstract base class for pointers." -msgstr "" +msgstr "Clase base, privada y abstracta para punteros." #: ../Doc/library/ctypes.rst:2528 msgid "" "Concrete pointer types are created by calling :func:`POINTER` with the type " "that will be pointed to; this is done automatically by :func:`pointer`." msgstr "" +"Los tipos de punteros concretos se crean llamando a :func:`POINTER` con el " +"tipo que será apuntado; esto se hace automáticamente por :func:`pointer`." #: ../Doc/library/ctypes.rst:2532 msgid "" @@ -2637,13 +3638,21 @@ msgid "" "the memory *before* the pointer (as in C), and out-of-range subscripts will " "probably crash with an access violation (if you're lucky)." msgstr "" +"Si un puntero apunta a un arreglo, sus elementos pueden ser leídos y " +"escritos usando accesos de subíndices y cortes estándar. Los objetos " +"punteros no tienen tamaño, así que :func:`len` lanzará un :exc:`TypeError`. " +"Los subíndices negativos se leerán de la memoria *antes* que el puntero " +"(como en C), y los subíndices fuera de rango probablemente se bloqueen con " +"una violación de acceso (si tienes suerte)." #: ../Doc/library/ctypes.rst:2542 msgid "Specifies the type pointed to." -msgstr "" +msgstr "Especifica el tipo apuntado." #: ../Doc/library/ctypes.rst:2546 msgid "" -"Returns the object to which to pointer points. Assigning to this attribute " +"Returns the object to which to pointer points. Assigning to this attribute " "changes the pointer to point to the assigned object." msgstr "" +"Retorna el objeto al que apunta. Asignar a este atributo cambia el puntero " +"para que apunte al objeto asignado."