python-docs-fr/library/ctypes.po

2992 lines
119 KiB
Plaintext
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# SOME DESCRIPTIVE TITLE.
# Copyright (C) 2001-2016, Python Software Foundation
# This file is distributed under the same license as the Python package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: Python 3.5\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-10-30 10:42+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: ../Doc/library/ctypes.rst:2
msgid ":mod:`ctypes` --- A foreign function library for Python"
msgstr ":mod:`ctypes` — Bibliothèque Python d'appels à des fonctions externes"
#: ../Doc/library/ctypes.rst:11
msgid ""
":mod:`ctypes` is a foreign function library for Python. It provides C "
"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` est une bibliothèque d'appel à des fonctions externes en "
"python. Elle fournit des types de données compatibles avec le langage C et "
"permet d'appeler des fonctions depuis des DLL ou des bibliothèques "
"partagées, rendant ainsi possible l'interfaçage de ces bibliothèques avec du "
"pur code Python."
#: ../Doc/library/ctypes.rst:19
msgid "ctypes tutorial"
msgstr "Didacticiel de *ctypes*"
#: ../Doc/library/ctypes.rst:21
msgid ""
"Note: The code samples in this tutorial use :mod:`doctest` to make sure that "
"they actually work. Since some code samples behave differently under Linux, "
"Windows, or Mac OS X, they contain doctest directives in comments."
msgstr ""
"Remarque : Les exemples de code de ce didacticiel utilisent :mod:`doctest` "
"pour s'assurer de leur propre bon fonctionnement. Vu que certains de ces "
"exemples ont un comportement différent en Linux, Windows ou Mac OS X, ils "
"contiennent des directives *doctest* dans les commentaires."
#: ../Doc/library/ctypes.rst:25
msgid ""
"Note: Some code samples reference the ctypes :class:`c_int` type. On "
"platforms where ``sizeof(long) == sizeof(int)`` it is an alias to :class:"
"`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 ""
"Remarque : Le type :class:`c_int` du module apparaît dans certains de ces "
"exemples. Sur les plates-formes où ``sizeof(long) == sizeof(int)``, ce type "
"est un alias de :class:`c_long`. Ne soyez donc pas surpris si :class:"
"`c_long` s'affiche là où vous vous attendiez à :class:`c_int` — il s'agit "
"bien du même type."
#: ../Doc/library/ctypes.rst:33
msgid "Loading dynamic link libraries"
msgstr "Chargement des DLL"
#: ../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` fournit l'objet *cdll* pour charger des bibliothèques à liens "
"dynamiques (et les objets *windll* et *oledll* en Windows)."
#: ../Doc/library/ctypes.rst:38
msgid ""
"You load libraries by accessing them as attributes of these objects. *cdll* "
"loads libraries which export functions using the standard ``cdecl`` calling "
"convention, while *windll* libraries call functions using the ``stdcall`` "
"calling convention. *oledll* also uses the ``stdcall`` calling convention, "
"and assumes the functions return a Windows :c:type:`HRESULT` error code. The "
"error code is used to automatically raise an :class:`OSError` exception when "
"the function call fails."
msgstr ""
"Une bibliothèque se charge en y accédant comme un attribut de ces objets. "
"*cdll* charge les bibliothèques qui exportent des fonctions utilisant la "
"convention d'appel standard ``cdecl``, alors que les bibliothèques qui se "
"chargent avec *windll* utilisent la convention d'appel ``stdcall``. *oledll* "
"utilise elle aussi la convention ``stdcall`` et suppose que les fonctions "
"renvoient un code d'erreur :c:type:`HRESULT` de Windows. Ce code d'erreur "
"est utilisé pour lever automatiquement une :class:`OSError` quand l'appel de "
"la fonction échoue."
#: ../Doc/library/ctypes.rst:46
msgid ""
"Windows errors used to raise :exc:`WindowsError`, which is now an alias of :"
"exc:`OSError`."
msgstr ""
"En Windows, les erreurs levaient auparavant une :exc:`WindowsError`, qui est "
"maintenant un alias de :exc:`OSError`."
#: ../Doc/library/ctypes.rst:51
msgid ""
"Here are some examples for Windows. Note that ``msvcrt`` is the MS standard "
"C library containing most standard C functions, and uses the cdecl calling "
"convention::"
msgstr ""
"Voici quelques exemples Windows. ``msvcrt`` est la bibliothèque standard C "
"de Microsoft qui contient la plupart des fonctions standards C. Elle suit la "
"convention d'appel *cdecl* ::"
#: ../Doc/library/ctypes.rst:63
msgid "Windows appends the usual ``.dll`` file suffix automatically."
msgstr "Windows ajoute le suffixe habituel ``.dll`` automatiquement."
#: ../Doc/library/ctypes.rst:66
msgid ""
"Accessing the standard C library through ``cdll.msvcrt`` will use an "
"outdated version of the library that may be incompatible with the one being "
"used by Python. Where possible, use native Python functionality, or else "
"import and use the ``msvcrt`` module."
msgstr ""
"Accéder à la bibliothèque standard C par ``cdll.msvcrt`` utilise une version "
"obsolète de la bibliothèque qui peut avoir des problèmes de compatibilité "
"avec celle que Python utilise. Si possible, mieux vaut utiliser la "
"fonctionnalité native de Python, ou bien importer et utiliser le module "
"``msvcrt``."
#: ../Doc/library/ctypes.rst:71
msgid ""
"On Linux, it is required to specify the filename *including* the extension "
"to load a library, so attribute access can not be used to load libraries. "
"Either the :meth:`LoadLibrary` method of the dll loaders should be used, or "
"you should load the library by creating an instance of CDLL by calling the "
"constructor::"
msgstr ""
"Pour charger une bibliothèque en Linux, il faut passer le nom du fichier "
"*avec* son extension. Il est donc impossible de charger une bibliothèque en "
"accédant à un attribut. Il faut utiliser la méthode :meth:`LoadLibrary` des "
"chargeurs de DLL, ou bien charger la bibliothèque en créant une instance de "
"*CDLL* en appelant son constructeur ::"
#: ../Doc/library/ctypes.rst:89
msgid "Accessing functions from loaded dlls"
msgstr "Accès aux fonctions des DLL chargées"
#: ../Doc/library/ctypes.rst:91
msgid "Functions are accessed as attributes of dll objects::"
msgstr "Les fonctions sont alors des attributs des objets DLL ::"
#: ../Doc/library/ctypes.rst:106
msgid ""
"Note that win32 system dlls like ``kernel32`` and ``user32`` often export "
"ANSI as well as UNICODE versions of a function. The UNICODE version is "
"exported with an ``W`` appended to the name, while the ANSI version is "
"exported with an ``A`` appended to the name. The win32 ``GetModuleHandle`` "
"function, which returns a *module handle* for a given module name, has the "
"following C prototype, and a macro is used to expose one of them as "
"``GetModuleHandle`` depending on whether UNICODE is defined or not::"
msgstr ""
"Les DLL des systèmes *win32* comme ``kernel32`` et ``user32`` exportent "
"souvent une version ANSI et une version UNICODE d'une fonction. La version "
"UNICODE est exportée avec un ``W`` à la fin, et la version ANSI avec un "
"``A``. La fonction *win32* ``GetModuleHandle``, qui renvoie un *gestionnaire "
"de module* à partir de son nom, a le prototype C suivant (c'est une macro "
"qui décide d'exporter l'une ou l'autre à travers ``GetModuleHandle``, selon "
"qu'UNICODE est définie ou non) ::"
#: ../Doc/library/ctypes.rst:119
msgid ""
"*windll* does not try to select one of them by magic, you must access the "
"version you need by specifying ``GetModuleHandleA`` or ``GetModuleHandleW`` "
"explicitly, and then call it with bytes or string objects respectively."
msgstr ""
"*windll* n'en choisit pas une par magie, il faut accéder à la bonne en "
"écrivant explicitement ``GetModuleHandleA`` ou ``GetModuleHandleW`` et en "
"les appelant ensuite avec des objets octets ou avec des chaînes de "
"caractères, respectivement."
#: ../Doc/library/ctypes.rst:123
msgid ""
"Sometimes, dlls export functions with names which aren't valid Python "
"identifiers, like ``\"??2@YAPAXI@Z\"``. In this case you have to use :func:"
"`getattr` to retrieve the function::"
msgstr ""
"Les DLL exportent parfois des fonctions dont les noms ne sont pas des "
"identifiants Python valides, comme ``\"??2@YAPAXI@Z\"``. Dans ce cas, il "
"faut utiliser :func:`getattr` pour accéder à la fonction ::"
#: ../Doc/library/ctypes.rst:131
msgid ""
"On Windows, some dlls export functions not by name but by ordinal. These "
"functions can be accessed by indexing the dll object with the ordinal "
"number::"
msgstr ""
"Sous Windows, certaines DLL exportent des fonctions à travers un indice "
"plutôt qu'à travers un nom. On accède à une fonction en indiçant l'objet DLL "
"avec son index ::"
#: ../Doc/library/ctypes.rst:148
msgid "Calling functions"
msgstr "Appel de fonctions"
#: ../Doc/library/ctypes.rst:150
msgid ""
"You can call these functions like any other Python callable. This example "
"uses the ``time()`` function, which returns system time in seconds since the "
"Unix epoch, and the ``GetModuleHandleA()`` function, which returns a win32 "
"module handle."
msgstr ""
"Ces fonctions s'appellent comme n'importe quel appelable Python. Cet exemple "
"utilise la fonction ``time()``, qui renvoie le temps en secondes du système "
"depuis l'*epoch* Unix, et la fonction ``GetModuleHandleA()``, qui renvoie un "
"gestionnaire de module *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 ""
#: ../Doc/library/ctypes.rst:164
msgid ""
":mod:`ctypes` tries to protect you from calling functions with the wrong "
"number of arguments or the wrong calling convention. Unfortunately this "
"only works on Windows. It does this by examining the stack after the "
"function returns, so although an error is raised the function *has* been "
"called::"
msgstr ""
#: ../Doc/library/ctypes.rst:179
msgid ""
"The same exception is raised when you call an ``stdcall`` function with the "
"``cdecl`` calling convention, or vice versa::"
msgstr ""
#: ../Doc/library/ctypes.rst:194
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 ""
"Pour déterminer la convention d'appel, il faut consulter l'en-tête C ou la "
"documentation de la fonction à appeler."
#: ../Doc/library/ctypes.rst:197
msgid ""
"On Windows, :mod:`ctypes` uses win32 structured exception handling to "
"prevent crashes from general protection faults when functions are called "
"with invalid argument values::"
msgstr ""
"En Windows, :mod:`ctypes` tire profit de la gestion structurée des "
"exceptions (*structured exception handling*) *win32* pour empêcher les "
"plantages dus à des interruptions, afin de préserver la protection globale "
"(*general protection faults*) du système, lorsque des fonctions sont "
"appelées avec un nombre incorrect d'arguments ::"
#: ../Doc/library/ctypes.rst:207
msgid ""
"There are, however, enough ways to crash Python with :mod:`ctypes`, so you "
"should be careful anyway. The :mod:`faulthandler` module can be helpful in "
"debugging crashes (e.g. from segmentation faults produced by erroneous C "
"library calls)."
msgstr ""
"Cependant, il y a suffisamment de façons de faire planter Python avec :mod:"
"`ctypes`, donc il faut être prudent dans tous les cas. Le module :mod:"
"`faulthandler` est pratique pour déboguer les plantages (p. ex. dus à des "
"erreurs de segmentation produites par des appels erronés à la bibliothèque "
"C)."
#: ../Doc/library/ctypes.rst:212
msgid ""
"``None``, integers, bytes objects and (unicode) strings are the only native "
"Python objects that can directly be used as parameters in these function "
"calls. ``None`` is passed as a C ``NULL`` pointer, bytes objects and strings "
"are passed as pointer to the memory block that contains their data (:c:type:"
"`char *` or :c:type:`wchar_t *`). Python integers are passed as the "
"platforms default C :c:type:`int` type, their value is masked to fit into "
"the C type."
msgstr ""
"``None``, les entiers, les objets octets et les chaînes de caractères "
"(Unicode) sont les seuls types natifs de Python qui peuvent être directement "
"passés en paramètres de ces appels de fonctions. ``None`` est passé comme le "
"pointeur C ``NULL``, les objets octets et les chaînes de caractères sont "
"passés comme un pointeur sur le bloc mémoire qui contient la donnée (:c:type:"
"`char *` ou :c:type:`wchar_t *`). Les entiers Python sont passés comme le "
"type C :c:type:`int` par défaut de la plate-forme, un masque étant appliqué "
"pour qu'ils tiennent dans le type C."
#: ../Doc/library/ctypes.rst:219
msgid ""
"Before we move on calling functions with other parameter types, we have to "
"learn more about :mod:`ctypes` data types."
msgstr ""
"Avant de poursuivre sur l'appel de fonctions avec d'autres types de "
"paramètres, apprenons-en un peu plus sur les types de données de :mod:"
"`ctypes`."
#: ../Doc/library/ctypes.rst:226 ../Doc/library/ctypes.rst:2043
msgid "Fundamental data types"
msgstr "Types de données de base"
#: ../Doc/library/ctypes.rst:228
msgid ":mod:`ctypes` defines a number of primitive C compatible data types:"
msgstr ""
":mod:`ctypes` définit plusieurs types de donnée de base compatibles avec le "
"C :"
#: ../Doc/library/ctypes.rst:231
msgid "ctypes type"
msgstr "Type *ctype*"
#: ../Doc/library/ctypes.rst:231
msgid "C type"
msgstr "Type C"
#: ../Doc/library/ctypes.rst:231
msgid "Python type"
msgstr "Type Python"
#: ../Doc/library/ctypes.rst:233
msgid ":class:`c_bool`"
msgstr ":class:`c_bool`"
#: ../Doc/library/ctypes.rst:233
msgid ":c:type:`_Bool`"
msgstr ":c:type:`_Bool`"
#: ../Doc/library/ctypes.rst:233
msgid "bool (1)"
msgstr "bool (1)"
#: ../Doc/library/ctypes.rst:235
msgid ":class:`c_char`"
msgstr ":class:`c_char`"
#: ../Doc/library/ctypes.rst:235 ../Doc/library/ctypes.rst:239
msgid ":c:type:`char`"
msgstr ":c:type:`char`"
#: ../Doc/library/ctypes.rst:235
msgid "1-character bytes object"
msgstr "objet octet (*bytes*) de 1 caractère"
#: ../Doc/library/ctypes.rst:237
msgid ":class:`c_wchar`"
msgstr ":class:`c_wchar`"
#: ../Doc/library/ctypes.rst:237
msgid ":c:type:`wchar_t`"
msgstr ":c:type:`wchar_t`"
#: ../Doc/library/ctypes.rst:237
msgid "1-character string"
msgstr "chaîne de caractères (*string*) de longueur 1"
#: ../Doc/library/ctypes.rst:239
msgid ":class:`c_byte`"
msgstr ":class:`c_byte`"
#: ../Doc/library/ctypes.rst:239 ../Doc/library/ctypes.rst:241
#: ../Doc/library/ctypes.rst:243 ../Doc/library/ctypes.rst:245
#: ../Doc/library/ctypes.rst:247 ../Doc/library/ctypes.rst:249
#: ../Doc/library/ctypes.rst:251 ../Doc/library/ctypes.rst:253
#: ../Doc/library/ctypes.rst:255 ../Doc/library/ctypes.rst:257
#: ../Doc/library/ctypes.rst:260 ../Doc/library/ctypes.rst:262
msgid "int"
msgstr "*int*"
#: ../Doc/library/ctypes.rst:241
msgid ":class:`c_ubyte`"
msgstr ":class:`c_ubyte`"
#: ../Doc/library/ctypes.rst:241
msgid ":c:type:`unsigned char`"
msgstr ":c:type:`unsigned char`"
#: ../Doc/library/ctypes.rst:243
msgid ":class:`c_short`"
msgstr ":class:`c_short`"
#: ../Doc/library/ctypes.rst:243
msgid ":c:type:`short`"
msgstr ":c:type:`short`"
#: ../Doc/library/ctypes.rst:245
msgid ":class:`c_ushort`"
msgstr ":class:`c_ushort`"
#: ../Doc/library/ctypes.rst:245
msgid ":c:type:`unsigned short`"
msgstr ":c:type:`unsigned short`"
#: ../Doc/library/ctypes.rst:247
msgid ":class:`c_int`"
msgstr ":class:`c_int`"
#: ../Doc/library/ctypes.rst:247
msgid ":c:type:`int`"
msgstr ":c:type:`int`"
#: ../Doc/library/ctypes.rst:249
msgid ":class:`c_uint`"
msgstr ":class:`c_uint`"
#: ../Doc/library/ctypes.rst:249
msgid ":c:type:`unsigned int`"
msgstr ":c:type:`unsigned int`"
#: ../Doc/library/ctypes.rst:251
msgid ":class:`c_long`"
msgstr ":class:`c_long`"
#: ../Doc/library/ctypes.rst:251
msgid ":c:type:`long`"
msgstr ":c:type:`long`"
#: ../Doc/library/ctypes.rst:253
msgid ":class:`c_ulong`"
msgstr ":class:`c_ulong`"
#: ../Doc/library/ctypes.rst:253
msgid ":c:type:`unsigned long`"
msgstr ":c:type:`unsigned long`"
#: ../Doc/library/ctypes.rst:255
msgid ":class:`c_longlong`"
msgstr ":class:`c_longlong`"
#: ../Doc/library/ctypes.rst:255
msgid ":c:type:`__int64` or :c:type:`long long`"
msgstr ":c:type:`__int64` ou :c:type:`long long`"
#: ../Doc/library/ctypes.rst:257
msgid ":class:`c_ulonglong`"
msgstr ":class:`c_ulonglong`"
#: ../Doc/library/ctypes.rst:257
msgid ":c:type:`unsigned __int64` or :c:type:`unsigned long long`"
msgstr ":c:type:`unsigned __int64` ou :c:type:`unsigned long long`"
#: ../Doc/library/ctypes.rst:260
msgid ":class:`c_size_t`"
msgstr ":class:`c_size_t`"
#: ../Doc/library/ctypes.rst:260
msgid ":c:type:`size_t`"
msgstr ":c:type:`size_t`"
#: ../Doc/library/ctypes.rst:262
msgid ":class:`c_ssize_t`"
msgstr ":class:`c_ssize_t`"
#: ../Doc/library/ctypes.rst:262
msgid ":c:type:`ssize_t` or :c:type:`Py_ssize_t`"
msgstr ":c:type:`ssize_t` ou :c:type:`Py_ssize_t`"
#: ../Doc/library/ctypes.rst:265
msgid ":class:`c_float`"
msgstr ":class:`c_float`"
#: ../Doc/library/ctypes.rst:265
msgid ":c:type:`float`"
msgstr ":c:type:`float`"
#: ../Doc/library/ctypes.rst:265 ../Doc/library/ctypes.rst:267
#: ../Doc/library/ctypes.rst:269
msgid "float"
msgstr "*float*"
#: ../Doc/library/ctypes.rst:267
msgid ":class:`c_double`"
msgstr ":class:`c_double`"
#: ../Doc/library/ctypes.rst:267
msgid ":c:type:`double`"
msgstr ":c:type:`double`"
#: ../Doc/library/ctypes.rst:269
msgid ":class:`c_longdouble`"
msgstr ":class:`c_longdouble`"
#: ../Doc/library/ctypes.rst:269
msgid ":c:type:`long double`"
msgstr ":c:type:`long double`"
#: ../Doc/library/ctypes.rst:271
msgid ":class:`c_char_p`"
msgstr ":class:`c_char_p`"
#: ../Doc/library/ctypes.rst:271
msgid ":c:type:`char *` (NUL terminated)"
msgstr ":c:type:`char *` (NUL terminated)"
#: ../Doc/library/ctypes.rst:271
msgid "bytes object or ``None``"
msgstr "objet *bytes* ou ``None``"
#: ../Doc/library/ctypes.rst:273
msgid ":class:`c_wchar_p`"
msgstr ":class:`c_wchar_p`"
#: ../Doc/library/ctypes.rst:273
msgid ":c:type:`wchar_t *` (NUL terminated)"
msgstr ":c:type:`wchar_t *` (Terminé par NUL)"
#: ../Doc/library/ctypes.rst:273
msgid "string or ``None``"
msgstr "string ou ``None``"
#: ../Doc/library/ctypes.rst:275
msgid ":class:`c_void_p`"
msgstr ":class:`c_void_p`"
#: ../Doc/library/ctypes.rst:275
msgid ":c:type:`void *`"
msgstr ":c:type:`void *`"
#: ../Doc/library/ctypes.rst:275
msgid "int or ``None``"
msgstr "``int`` ou ``None``"
#: ../Doc/library/ctypes.rst:279
msgid "The constructor accepts any object with a truth value."
msgstr "Le constructeur accepte n'importe quel objet convertible en booléen."
#: ../Doc/library/ctypes.rst:281
msgid ""
"All these types can be created by calling them with an optional initializer "
"of the correct type and value::"
msgstr ""
"Il est possible de créer chacun de ces types en les appelant avec une valeur "
"d'initialisation du bon type et avec une valeur cohérente ::"
#: ../Doc/library/ctypes.rst:292
msgid ""
"Since these types are mutable, their value can also be changed afterwards::"
msgstr ""
"Ces types étant des muables, leur valeur peut aussi être modifiée après "
"coup ::"
#: ../Doc/library/ctypes.rst:304
msgid ""
"Assigning a new value to instances of the pointer types :class:`c_char_p`, :"
"class:`c_wchar_p`, and :class:`c_void_p` changes the *memory location* they "
"point to, *not the contents* of the memory block (of course not, because "
"Python bytes objects are immutable)::"
msgstr ""
"Affecter une nouvelle valeur à une instance de type pointeur — :class:"
"`c_char_p`, :class:`c_wchar_p` et :class:`c_void_p` — change *la zone "
"mémoire* sur laquelle elle pointe, et non *le contenu* de ce bloc mémoire "
"(c'est logique parce que les objets octets sont immuables en Python) ::"
#: ../Doc/library/ctypes.rst:320
msgid ""
"You should be careful, however, not to pass them to functions expecting "
"pointers to mutable memory. If you need mutable memory blocks, ctypes has a :"
"func:`create_string_buffer` function which creates these in various ways. "
"The current memory block contents can be accessed (or changed) with the "
"``raw`` property; if you want to access it as NUL terminated string, use the "
"``value`` property::"
msgstr ""
"Cependant, prenez garde à ne pas en passer à des fonctions qui prennent en "
"paramètre des pointeurs sur de la mémoire modifiable. S'il vous faut de la "
"mémoire modifiable, *ctypes* fournit la fonction :func:"
"`create_string_buffer` qui en crée de plusieurs façons. L'attribut ``raw`` "
"permet d'accéder à (ou de modifier) un bloc mémoire ; l'attribut ``value`` "
"permet d'y accéder comme à une chaîne de caractères terminée par NUL ::"
#: ../Doc/library/ctypes.rst:344
msgid ""
"The :func:`create_string_buffer` function replaces the :func:`c_buffer` "
"function (which is still available as an alias), as well as the :func:"
"`c_string` function from earlier ctypes releases. To create a mutable "
"memory block containing unicode characters of the C type :c:type:`wchar_t` "
"use the :func:`create_unicode_buffer` function."
msgstr ""
"La fonction :func:`create_string_buffer` remplace les fonctions :func:"
"`c_buffer` (qui en reste un alias) et :func:`c_string` des versions "
"antérieures de *ctypes*. La fonction :func:`create_unicode_buffer` crée un "
"bloc mémoire modifiable contenant des caractères Unicode du type C :c:type:"
"`wchar_t`."
#: ../Doc/library/ctypes.rst:354
msgid "Calling functions, continued"
msgstr "Appel de fonctions, suite"
#: ../Doc/library/ctypes.rst:356
msgid ""
"Note that printf prints to the real standard output channel, *not* to :data:"
"`sys.stdout`, so these examples will only work at the console prompt, not "
"from within *IDLE* or *PythonWin*::"
msgstr ""
"*printf* utilise la vraie sortie standard, et non :data:`sys.stdout` ; les "
"exemples suivants ne fonctionnent donc que dans une invite de commande et "
"non depuis *IDLE* or *PythonWin* ::"
#: ../Doc/library/ctypes.rst:376
msgid ""
"As has been mentioned before, all Python types except integers, strings, and "
"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 ""
"Comme mentionné plus haut, tous les types Python (les entiers, les chaînes "
"de caractères et les objets octet exceptés) doivent être encapsulés dans "
"leur type :mod:`ctypes` correspondant pour pouvoir être convertis dans le "
"type C requis ::"
#: ../Doc/library/ctypes.rst:389
msgid "Calling functions with your own custom data types"
msgstr "Appel de fonctions avec des types de données personnalisés"
#: ../Doc/library/ctypes.rst:391
msgid ""
"You can also customize :mod:`ctypes` argument conversion to allow instances "
"of your own classes be used as function arguments. :mod:`ctypes` looks for "
"an :attr:`_as_parameter_` attribute and uses this as the function argument. "
"Of course, it must be one of integer, string, or bytes::"
msgstr ""
"Il est possible de personnaliser la conversion des arguments effectuée par :"
"mod:`ctypes` pour permettre de passer en argument des instances de vos "
"propres classes. :mod:`ctypes` recherche un attribut :attr:`_as_parameter_` "
"et le prend comme argument à la fonction. Bien entendu, cet attribut doit "
"être un entier, une chaîne de caractères ou des octets ::"
#: ../Doc/library/ctypes.rst:406
msgid ""
"If you don't want to store the instance's data in the :attr:`_as_parameter_` "
"instance variable, you could define a :class:`property` which makes the "
"attribute available on request."
msgstr ""
"Si vous ne souhaitez pas stocker les données de l'instance dans la variable :"
"attr:`_as_parameter_` de l'instance, vous pouvez toujours définir une :class:"
"`propriété <property>` qui rend cet attribut disponible sur demande."
#: ../Doc/library/ctypes.rst:414
msgid "Specifying the required argument types (function prototypes)"
msgstr "Définition du type des arguments nécessaires (prototypes de fonction)"
#: ../Doc/library/ctypes.rst:416
msgid ""
"It is possible to specify the required argument types of functions exported "
"from DLLs by setting the :attr:`argtypes` attribute."
msgstr ""
"Il est possible de définir le type des arguments demandés par une fonction "
"exportée depuis une DLL en définissant son attribut :attr:`argtypes`."
#: ../Doc/library/ctypes.rst:419
msgid ""
":attr:`argtypes` must be a sequence of C data types (the ``printf`` function "
"is probably not a good example here, because it takes a variable number and "
"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` doit être une séquence de types de données C (la fonction "
"``printf`` n'est probablement pas le meilleur exemple pour l'illustrer, car "
"elle accepte un nombre variable d'arguments de types eux aussi variables, "
"selon la chaîne de formatage ; cela dit, elle se révèle pratique pour tester "
"cette fonctionnalité) ::"
#: ../Doc/library/ctypes.rst:430
msgid ""
"Specifying a format protects against incompatible argument types (just as a "
"prototype for a C function), and tries to convert the arguments to valid "
"types::"
msgstr ""
"Définir un format empêche de passer des arguments de type incompatible "
"(comme le fait le prototype d'une fonction C) et tente de convertir les "
"arguments en des types valides ::"
#: ../Doc/library/ctypes.rst:442
msgid ""
"If you have defined your own classes which you pass to function calls, you "
"have to implement a :meth:`from_param` class method for them to be able to "
"use them in the :attr:`argtypes` sequence. The :meth:`from_param` class "
"method receives the Python object passed to the function call, it should do "
"a typecheck or whatever is needed to make sure this object is acceptable, "
"and then return the object itself, its :attr:`_as_parameter_` attribute, or "
"whatever you want to pass as the C function argument in this case. Again, "
"the result should be an integer, string, bytes, a :mod:`ctypes` instance, or "
"an object with an :attr:`_as_parameter_` attribute."
msgstr ""
"Pour appeler une fonction avec votre propre classe définie dans la séquence :"
"attr:`argtypes`, il est nécessaire d'implémenter une méthode de classe :meth:"
"`from_param`. La méthode de classe :meth:`from_param` récupère l'objet "
"Python passé à la fonction et doit faire une vérification de type ou tout ce "
"qui est nécessaire pour s'assurer que l'objet est valide, puis renvoie "
"l'objet lui-même, son attribut :attr:`_as_parameter_`, ou tout ce que vous "
"voulez passer comme argument fonction C dans ce cas. Encore une fois, il "
"convient que le résultat soit un entier, une chaîne, des octets, une "
"instance :mod:`ctypes` ou un objet avec un attribut :attr:`_as_parameter_`."
#: ../Doc/library/ctypes.rst:456
msgid "Return types"
msgstr "Types de sortie"
#: ../Doc/library/ctypes.rst:458
msgid ""
"By default functions are assumed to return the C :c:type:`int` type. Other "
"return types can be specified by setting the :attr:`restype` attribute of "
"the function object."
msgstr ""
"Le module suppose que toutes les fonctions renvoient par défaut un :c:type:"
"`int` C. Pour préciser un autre type de sortie, il faut définir l'attribut :"
"attr:`restype` de l'objet encapsulant la fonction."
#: ../Doc/library/ctypes.rst:462
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 ""
"Voici un exemple plus poussé. Celui-ci utilise la fonction ``strchr``, qui "
"prend en paramètres un pointeur vers une chaîne et un caractère. Elle "
"renvoie un pointeur sur une chaîne de caractères ::"
#: ../Doc/library/ctypes.rst:475
msgid ""
"If you want to avoid the ``ord(\"x\")`` calls above, you can set the :attr:"
"`argtypes` attribute, and the second argument will be converted from a "
"single character Python bytes object into a C char::"
msgstr ""
"Pour économiser l'appel ``ord(\"x\")``, il est possible de définir "
"l'attribut :attr:`argtypes` ; le second argument, un objet octet à un seul "
"caractère, sera automatiquement converti en un caractère C ::"
#: ../Doc/library/ctypes.rst:493
msgid ""
"You can also use a callable Python object (a function or a class for "
"example) as the :attr:`restype` attribute, if the foreign function returns "
"an integer. The callable will be called with the *integer* the C function "
"returns, and the result of this call will be used as the result of your "
"function call. This is useful to check for error return values and "
"automatically raise an exception::"
msgstr ""
"Si la fonction à interfacer renvoie un entier, l'attribut :attr:`restype` "
"peut aussi être un appelable (une fonction ou une classe par exemple). Dans "
"ce cas, l'appelable est appelé avec l'entier renvoyé par la fonction et le "
"résultat de cet appel sera le résultat final de l'appel à la fonction. C'est "
"pratique pour vérifier les codes d'erreurs des valeurs de retour et lever "
"automatiquement des exceptions ::"
#: ../Doc/library/ctypes.rst:516
msgid ""
"``WinError`` is a function which will call Windows ``FormatMessage()`` api "
"to get the string representation of an error code, and *returns* an "
"exception. ``WinError`` takes an optional error code parameter, if no one is "
"used, it calls :func:`GetLastError` to retrieve it."
msgstr ""
"``WinError`` appelle l'API Windows ``FormatMessage()`` pour obtenir une "
"représentation de la chaîne de caractères qui correspond au code d'erreur, "
"et *renvoie* une exception. ``WinError`` prend en paramètre — optionnel — le "
"code d'erreur. Si celui-ci n'est pas passé, elle appelle :func:"
"`GetLastError` pour le récupérer."
#: ../Doc/library/ctypes.rst:521
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 ""
"Notez cependant que l'attribut :attr:`errcheck` permet de vérifier bien plus "
"efficacement les erreurs ; référez-vous au manuel de référence pour plus de "
"précisions."
#: ../Doc/library/ctypes.rst:528
msgid "Passing pointers (or: passing parameters by reference)"
msgstr "Passage de pointeurs (passage de paramètres par référence)"
#: ../Doc/library/ctypes.rst:530
msgid ""
"Sometimes a C api function expects a *pointer* to a data type as parameter, "
"probably to write into the corresponding location, or if the data is too "
"large to be passed by value. This is also known as *passing parameters by "
"reference*."
msgstr ""
"Il arrive qu'une fonction C du code à interfacer requière un *pointeur* vers "
"un certain type de donnée en paramètre, typiquement pour écrire à l'endroit "
"correspondant ou si la donnée est trop grande pour pouvoir être passée par "
"valeur. Ce mécanisme est appelé *passage de paramètres par référence*."
#: ../Doc/library/ctypes.rst:534
msgid ""
":mod:`ctypes` exports the :func:`byref` function which is used to pass "
"parameters by reference. The same effect can be achieved with the :func:"
"`pointer` function, although :func:`pointer` does a lot more work since it "
"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` contient la fonction :func:`byref` qui permet de passer des "
"paramètres par référence. La fonction :func:`pointer` a la même utilité, "
"mais fait plus de travail car :func:`pointer` construit un véritable objet "
"pointeur. Ainsi, si vous n'avez pas besoin de cet objet dans votre code "
"Python, utiliser :func:`byref` est plus performant ::"
#: ../Doc/library/ctypes.rst:556
msgid "Structures and unions"
msgstr "Structures et unions"
#: ../Doc/library/ctypes.rst:558
msgid ""
"Structures and unions must derive from the :class:`Structure` and :class:"
"`Union` base classes which are defined in the :mod:`ctypes` module. Each "
"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 ""
"Les structures et les unions doivent hériter des classes de base :class:"
"`Structure` et :class:`Union` définies dans le module :mod:`ctypes`. Chaque "
"sous-classe doit définir un attribut :attr:`_fields_`. :attr:`_fields_` doit "
"être une liste de *paires*, contenant un *nom de champ* et un *type de "
"champ*."
#: ../Doc/library/ctypes.rst:563
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 ""
"Le type de champ doit être un type :mod:`ctypes` comme :class:`c_int` ou un "
"type :mod:`ctypes` dérivé : structure, union, tableau ou pointeur."
#: ../Doc/library/ctypes.rst:566
msgid ""
"Here is a simple example of a POINT structure, which contains two integers "
"named *x* and *y*, and also shows how to initialize a structure in the "
"constructor::"
msgstr ""
"Voici un exemple simple : une structure POINT qui contient deux entiers *x* "
"et *y* et qui montre également comment instancier une structure avec le "
"constructeur ::"
#: ../Doc/library/ctypes.rst:586
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 ""
"Il est bien entendu possible de créer des structures plus complexes. Une "
"structure peut elle-même contenir d'autres structures en prenant une "
"structure comme type de champ."
#: ../Doc/library/ctypes.rst:589
msgid ""
"Here is a RECT structure which contains two POINTs named *upperleft* and "
"*lowerright*::"
msgstr ""
"Voici une structure RECT qui contient deux POINTs *upperleft* et "
"*lowerright* ::"
#: ../Doc/library/ctypes.rst:603
msgid ""
"Nested structures can also be initialized in the constructor in several "
"ways::"
msgstr ""
"Une structure encapsulée peut être instanciée par un constructeur de "
"plusieurs façons ::"
#: ../Doc/library/ctypes.rst:608
msgid ""
"Field :term:`descriptor`\\s can be retrieved from the *class*, they are "
"useful for debugging because they can provide useful information::"
msgstr ""
"Il est possible de récupérer les :term:`descripteurs <descriptor>` des "
"champs depuis la *classe*. Ils sont importants pour déboguer car ils "
"contiennent des informations utiles ::"
#: ../Doc/library/ctypes.rst:622
msgid ""
":mod:`ctypes` does not support passing unions or structures with bit-fields "
"to functions by value. While this may work on 32-bit x86, it's not "
"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` ne prend pas en charge le passage par valeur des unions ou des "
"structures avec des champs de bits. Bien que cela puisse fonctionner sur des "
"architectures 32 bits avec un jeu d'instructions x86, ce n'est pas garanti "
"par la bibliothèque en général. Les unions et les structures avec des champs "
"de bits doivent toujours être passées par pointeur."
#: ../Doc/library/ctypes.rst:628
msgid "Structure/union alignment and byte order"
msgstr "Alignement et boutisme des structures et des unions"
#: ../Doc/library/ctypes.rst:630
msgid ""
"By default, Structure and Union fields are aligned in the same way the C "
"compiler does it. It is possible to override this behavior be specifying a :"
"attr:`_pack_` class attribute in the subclass definition. This must be set "
"to a positive integer and specifies the maximum alignment for the fields. "
"This is what ``#pragma pack(n)`` also does in MSVC."
msgstr ""
#: ../Doc/library/ctypes.rst:636
msgid ""
":mod:`ctypes` uses the native byte order for Structures and Unions. To "
"build structures with non-native byte order, you can use one of the :class:"
"`BigEndianStructure`, :class:`LittleEndianStructure`, :class:"
"`BigEndianUnion`, and :class:`LittleEndianUnion` base classes. These "
"classes cannot contain pointer fields."
msgstr ""
":mod:`ctypes` suit le boutisme natif pour les *Structure* et les *Union*. "
"Pour construire des structures avec un boutisme différent, utilisez les "
"classes de base :class:`BigEndianStructure`, :class:"
"`LittleEndianStructure`, :class:`BigEndianUnion` ou :class:"
"`LittleEndianUnion`. Ces classes ne peuvent pas avoir de champ pointeur."
#: ../Doc/library/ctypes.rst:646
msgid "Bit fields in structures and unions"
msgstr "Champs de bits dans les structures et les unions"
#: ../Doc/library/ctypes.rst:648
msgid ""
"It is possible to create structures and unions containing bit fields. Bit "
"fields are only possible for integer fields, the bit width is specified as "
"the third item in the :attr:`_fields_` tuples::"
msgstr ""
"Il est possible de créer des structures et des unions contenant des champs "
"de bits. Seuls les entiers peuvent être des champs de bits, le nombre de "
"bits est défini dans le troisième champ du *n*-uplet :attr:`_fields_` ::"
#: ../Doc/library/ctypes.rst:666
msgid "Arrays"
msgstr "Tableaux"
#: ../Doc/library/ctypes.rst:668
msgid ""
"Arrays are sequences, containing a fixed number of instances of the same "
"type."
msgstr ""
"Les tableaux sont des séquences qui contiennent un nombre fixe d'instances "
"du même type."
#: ../Doc/library/ctypes.rst:670
msgid ""
"The recommended way to create array types is by multiplying a data type with "
"a positive integer::"
msgstr ""
"La meilleure façon de créer des tableaux consiste à multiplier le type de "
"donnée par un entier positif ::"
#: ../Doc/library/ctypes.rst:675
msgid ""
"Here is an example of a somewhat artificial data type, a structure "
"containing 4 POINTs among other stuff::"
msgstr ""
"Voici un exemple — un peu artificiel — d'une structure contenant, entre "
"autres, 4 POINTs ::"
#: ../Doc/library/ctypes.rst:691
msgid "Instances are created in the usual way, by calling the class::"
msgstr "Comme d'habitude, on crée les instances en appelant la classe ::"
#: ../Doc/library/ctypes.rst:697
msgid ""
"The above code print a series of ``0 0`` lines, because the array contents "
"is initialized to zeros."
msgstr ""
"Le code précédent affiche une suite de ``0 0`` car le contenu du tableau est "
"initialisé avec des zéros."
#: ../Doc/library/ctypes.rst:700
msgid "Initializers of the correct type can also be specified::"
msgstr "Des valeurs d'initialisation du bon type peuvent être passées ::"
#: ../Doc/library/ctypes.rst:716
msgid "Pointers"
msgstr "Pointeurs"
#: ../Doc/library/ctypes.rst:718
msgid ""
"Pointer instances are created by calling the :func:`pointer` function on a :"
"mod:`ctypes` type::"
msgstr ""
"On crée une instance de pointeur en appelant la fonction :func:`pointer` sur "
"un type :mod:`ctypes` ::"
#: ../Doc/library/ctypes.rst:726
msgid ""
"Pointer instances have a :attr:`~_Pointer.contents` attribute which returns "
"the object to which the pointer points, the ``i`` object above::"
msgstr ""
"Les instances de pointeurs ont un attribut :attr:`~_Pointer.contents` qui "
"renvoie l'objet pointé (l'objet ``i`` ci-dessus) ::"
#: ../Doc/library/ctypes.rst:733
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 ""
"Attention, :mod:`ctypes` ne fait pas de ROI (retour de l'objet initial). Il "
"crée un nouvel objet à chaque fois qu'on accède à un attribut ::"
#: ../Doc/library/ctypes.rst:742
msgid ""
"Assigning another :class:`c_int` instance to the pointer's contents "
"attribute would cause the pointer to point to the memory location where this "
"is stored::"
msgstr ""
"Affecter une autre instance de :class:`c_int` à l'attribut *contents* du "
"pointeur fait pointer le pointeur vers l'adresse mémoire de cette nouvelle "
"instance ::"
#: ../Doc/library/ctypes.rst:754
msgid "Pointer instances can also be indexed with integers::"
msgstr "Il est possible d'indexer les pointeurs par des entiers ::"
#: ../Doc/library/ctypes.rst:760
msgid "Assigning to an integer index changes the pointed to value::"
msgstr "Affecter à travers un indice change la valeur pointée ::"
#: ../Doc/library/ctypes.rst:769
msgid ""
"It is also possible to use indexes different from 0, but you must know what "
"you're doing, just as in C: You can access or change arbitrary memory "
"locations. Generally you only use this feature if you receive a pointer from "
"a C function, and you *know* that the pointer actually points to an array "
"instead of a single item."
msgstr ""
"Si vous êtes sûr de vous, vous pouvez utiliser d'autres valeurs que 0, comme "
"en C : il est ainsi possible de modifier une zone mémoire de votre choix. De "
"manière générale cette fonctionnalité ne s'utilise que sur un pointeur "
"renvoyé par une fonction C, pointeur que vous *savez* pointer vers un "
"tableau et non sur un seul élément."
#: ../Doc/library/ctypes.rst:775
msgid ""
"Behind the scenes, the :func:`pointer` function does more than simply create "
"pointer instances, it has to create pointer *types* first. This is done with "
"the :func:`POINTER` function, which accepts any :mod:`ctypes` type, and "
"returns a new type::"
msgstr ""
"Sous le capot, la fonction :func:`pointer` fait plus que simplement créer "
"une instance de pointeur ; elle doit d'abord créer un type « pointeur "
"sur… ». Cela s'effectue avec la fonction :func:`POINTER`, qui prend en "
"paramètre n'importe quel type :mod:`ctypes` et renvoie un nouveau type ::"
#: ../Doc/library/ctypes.rst:791
msgid ""
"Calling the pointer type without an argument creates a ``NULL`` pointer. "
"``NULL`` pointers have a ``False`` boolean value::"
msgstr ""
"Appeler le pointeur sur type sans arguments crée un pointeur ``NULL``. Les "
"pointeurs ``NULL`` s'évaluent à ``False`` ::"
#: ../Doc/library/ctypes.rst:799
msgid ""
":mod:`ctypes` checks for ``NULL`` when dereferencing pointers (but "
"dereferencing invalid non-\\ ``NULL`` pointers would crash Python)::"
msgstr ""
":mod:`ctypes` vérifie que le pointeur n'est pas ``NULL`` quand il en "
"déréférence un (mais déréférencer des pointeurs non ``NULL`` invalides fait "
"planter Python) ::"
#: ../Doc/library/ctypes.rst:818
msgid "Type conversions"
msgstr "Conversions de type"
#: ../Doc/library/ctypes.rst:820
msgid ""
"Usually, ctypes does strict type checking. This means, if you have "
"``POINTER(c_int)`` in the :attr:`argtypes` list of a function or as the type "
"of a member field in a structure definition, only instances of exactly the "
"same type are accepted. There are some exceptions to this rule, where "
"ctypes accepts other objects. For example, you can pass compatible array "
"instances instead of pointer types. So, for ``POINTER(c_int)``, ctypes "
"accepts an array of c_int::"
msgstr ""
"En général, *ctypes* respecte un typage fort. Cela signifie que si un "
"``POINTER(c_int)`` est présent dans la liste des :attr:`argtypes` d'une "
"fonction ou est le type d'un attribut membre dans une définition de "
"structure, seules des instances de ce type seront valides. Cette règle "
"comporte quelques exceptions pour lesquelles *ctypes* accepte d'autres "
"objets. Par exemple il est possible de passer des instances de tableau à "
"place de pointeurs, s'ils sont compatibles. Dans le cas de "
"``POINTER(c_int)``, *ctypes* accepte des tableaux de *c_int* ::"
#: ../Doc/library/ctypes.rst:841
msgid ""
"In addition, if a function argument is explicitly declared to be a pointer "
"type (such as ``POINTER(c_int)``) in :attr:`argtypes`, an object of the "
"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 ""
"De plus, si un paramètre de fonction est déclaré explicitement de type "
"pointeur (comme ``POINTER(c_int)``) dans les :attr:`argtypes`, il est aussi "
"possible de passer un objet du type pointé — ici, ``c_int`` — à la fonction. "
"*ctypes* appelle alors automatiquement la fonction de conversion :func:"
"`byref`."
#: ../Doc/library/ctypes.rst:846
msgid "To set a POINTER type field to ``NULL``, you can assign ``None``::"
msgstr ""
"Pour mettre un champ de type *POINTER* à ``NULL``, il faut lui affecter "
"``None`` ::"
#: ../Doc/library/ctypes.rst:853
msgid ""
"Sometimes you have instances of incompatible types. In C, you can cast one "
"type into another type. :mod:`ctypes` provides a :func:`cast` function "
"which can be used in the same way. The ``Bar`` structure defined above "
"accepts ``POINTER(c_int)`` pointers or :class:`c_int` arrays for its "
"``values`` field, but not instances of other types::"
msgstr ""
"Parfois il faut gérer des incompatibilités entre les types. En C, il est "
"possible de convertir un type en un autre. :mod:`ctypes` fournit la "
"fonction :func:`cast` qui permet la même chose. La structure ``Bar`` ci-"
"dessus accepte des pointeurs ``POINTER(c_int)`` ou des tableaux de :class:"
"`c_int` comme valeur pour le champ ``values``, mais pas des instances "
"d'autres types ::"
#: ../Doc/library/ctypes.rst:865
msgid "For these cases, the :func:`cast` function is handy."
msgstr "C'est là que la fonction :func:`cast` intervient."
#: ../Doc/library/ctypes.rst:867
msgid ""
"The :func:`cast` function can be used to cast a ctypes instance into a "
"pointer to a different ctypes data type. :func:`cast` takes two parameters, "
"a ctypes object that is or can be converted to a pointer of some kind, and a "
"ctypes pointer type. It returns an instance of the second argument, which "
"references the same memory block as the first argument::"
msgstr ""
"La fonction :func:`cast` permet de convertir une instance de *ctypes* en un "
"pointeur vers un type de données *ctypes* différent. :func:`cast` prend deux "
"paramètres : un objet *ctypes* qui est, ou qui peut être converti en, un "
"certain pointeur et un type pointeur de *ctypes*. Elle renvoie une instance "
"du second argument, qui pointe sur le même bloc mémoire que le premier "
"argument ::"
#: ../Doc/library/ctypes.rst:878
msgid ""
"So, :func:`cast` can be used to assign to the ``values`` field of ``Bar`` "
"the structure::"
msgstr ""
"Ainsi, la fonction :func:`cast` permet de remplir le champ ``values`` de la "
"structure ``Bar`` ::"
#: ../Doc/library/ctypes.rst:891
msgid "Incomplete Types"
msgstr "Types incomplets"
#: ../Doc/library/ctypes.rst:893
msgid ""
"*Incomplete Types* are structures, unions or arrays whose members are not "
"yet specified. In C, they are specified by forward declarations, which are "
"defined later::"
msgstr ""
"Un *type incomplet* est une structure, une union ou un tableau dont les "
"membres ne sont pas encore définis. C'est l'équivalent d'une déclaration "
"avancée en C, où la définition est fournie plus tard ::"
#: ../Doc/library/ctypes.rst:904
msgid ""
"The straightforward translation into ctypes code would be this, but it does "
"not work::"
msgstr ""
"Une traduction naïve, mais invalide, en code *ctypes* ressemblerait à ça ::"
#: ../Doc/library/ctypes.rst:917
msgid ""
"because the new ``class cell`` is not available in the class statement "
"itself. In :mod:`ctypes`, we can define the ``cell`` class and set the :attr:"
"`_fields_` attribute later, after the class statement::"
msgstr ""
"Cela ne fonctionne pas parce que la nouvelle ``class cell`` n'est pas "
"accessible dans la définition de la classe elle-même. Dans le module :mod:"
"`ctypes`, on définit la classe ``cell`` et on définira les :attr:`_fields_` "
"plus tard, après avoir défini la classe ::"
#: ../Doc/library/ctypes.rst:929
msgid ""
"Lets 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 ""
#: ../Doc/library/ctypes.rst:950
msgid "Callback functions"
msgstr "Fonctions de rappel"
#: ../Doc/library/ctypes.rst:952
msgid ""
":mod:`ctypes` allows creating C callable function pointers from Python "
"callables. These are sometimes called *callback functions*."
msgstr ""
":mod:`ctypes` permet de créer des pointeurs de fonctions appelables par des "
"appelables Python. On les appelle parfois *fonctions de rappel*."
#: ../Doc/library/ctypes.rst:955
msgid ""
"First, you must create a class for the callback function. The class knows "
"the calling convention, the return type, and the number and types of "
"arguments this function will receive."
msgstr ""
"Tout d'abord, il faut créer une classe pour la fonction de rappel. La classe "
"connaît la convention d'appel, le type de retour ainsi que le nombre et le "
"type de paramètres que la fonction accepte."
#: ../Doc/library/ctypes.rst:959
msgid ""
"The :func:`CFUNCTYPE` factory function creates types for callback functions "
"using the ``cdecl`` calling convention. On Windows, the :func:`WINFUNCTYPE` "
"factory function creates types for callback functions using the ``stdcall`` "
"calling convention."
msgstr ""
"La fabrique :func:`CFUNCTYPE` crée un type pour les fonctions de rappel qui "
"suivent la convention d'appel ``cdecl``. En Windows, c'est la fabrique :func:"
"`WINFUNCTYPE` qui crée un type pour les fonctions de rappel qui suivent la "
"convention d'appel ``stdcall``."
#: ../Doc/library/ctypes.rst:964
msgid ""
"Both of these factory functions are called with the result type as first "
"argument, and the callback functions expected argument types as the "
"remaining arguments."
msgstr ""
"Le premier paramètre de ces deux fonctions est le type de retour, et les "
"suivants sont les types des arguments qu'attend la fonction de rappel."
#: ../Doc/library/ctypes.rst:968
msgid ""
"I will present an example here which uses the standard C library's :c:func:"
"`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 ""
"Intéressons-nous à un exemple tiré de la bibliothèque standard C : la "
"fonction :c:func:`qsort`. Celle-ci permet de classer des éléments par "
"l'emploi d'une fonction de rappel. Nous allons utiliser :c:func:`qsort` pour "
"ordonner un tableau d'entiers ::"
#: ../Doc/library/ctypes.rst:978
msgid ""
":func:`qsort` must be called with a pointer to the data to sort, the number "
"of items in the data array, the size of one item, and a pointer to the "
"comparison function, the callback. The callback will then be called with two "
"pointers to items, and it must return a negative integer if the first item "
"is smaller than the second, a zero if they are equal, and a positive integer "
"otherwise."
msgstr ""
":func:`qsort` doit être appelée avec un pointeur vers la donnée à ordonner, "
"le nombre d'éléments dans la donnée, la taille d'un élément et un pointeur "
"vers le comparateur, c.-à-d. la fonction de rappel. Cette fonction sera "
"invoquée avec deux pointeurs sur deux éléments et doit renvoyer un entier "
"négatif si le premier élément est plus petit que le second, zéro s'ils sont "
"égaux et un entier positif sinon."
#: ../Doc/library/ctypes.rst:984
msgid ""
"So our callback function receives pointers to integers, and must return an "
"integer. First we create the ``type`` for the callback function::"
msgstr ""
"Ainsi notre fonction de rappel reçoit des pointeurs vers des entiers et doit "
"renvoyer un entier. Créons d'abord le ``type`` pour la fonction de rappel ::"
#: ../Doc/library/ctypes.rst:990
msgid ""
"To get started, here is a simple callback that shows the values it gets "
"passed::"
msgstr ""
"Pour commencer, voici une fonction de rappel simple qui affiche les valeurs "
"qu'on lui passe ::"
#: ../Doc/library/ctypes.rst:1000
msgid "The result::"
msgstr "Résultat ::"
#: ../Doc/library/ctypes.rst:1010
msgid "Now we can actually compare the two items and return a useful result::"
msgstr ""
"À présent, comparons pour de vrai les deux entiers et renvoyons un résultat "
"utile ::"
#: ../Doc/library/ctypes.rst:1025
msgid "As we can easily check, our array is sorted now::"
msgstr ""
"Et comme il est facile de le voir, notre tableau est désormais classé ::"
#: ../Doc/library/ctypes.rst:1034
msgid ""
"Make sure you keep references to :func:`CFUNCTYPE` objects as long as they "
"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 ""
"Prenez garde à bien conserver une référence à un objet :func:`CFUNCTYPE` "
"tant que celui-ci est utilisé par le code C. :mod:`ctypes` ne le fait pas "
"tout seul et, si vous ne le faites pas, le ramasse-miette pourrait les "
"libérer, ce qui fera planter votre programme quand un appel sera fait."
#: ../Doc/library/ctypes.rst:1038
msgid ""
"Also, note that if the callback function is called in a thread created "
"outside of Python's control (e.g. by the foreign code that calls the "
"callback), ctypes creates a new dummy Python thread on every invocation. "
"This behavior is correct for most purposes, but it means that values stored "
"with :class:`threading.local` will *not* survive across different callbacks, "
"even when those calls are made from the same C thread."
msgstr ""
"Notez aussi que si la fonction de rappel est appelée dans un fil d'exécution "
"créé hors de Python (p. ex. par du code externe qui appelle la fonction de "
"rappel), *ctypes* crée un nouveau fil Python « creux » à chaque fois. Ce "
"comportement est acceptable pour la plupart des cas d'utilisation, mais cela "
"implique que les valeurs stockées avec :class:`threading.local` ne seront "
"*pas* persistantes d'un appel à l'autre, même si les appels proviennent du "
"même fil d'exécution C."
#: ../Doc/library/ctypes.rst:1048
msgid "Accessing values exported from dlls"
msgstr "Accès aux variables exportées depuis une DLL"
#: ../Doc/library/ctypes.rst:1050
msgid ""
"Some shared libraries not only export functions, they also export variables. "
"An example in the Python library itself is the :c:data:`Py_OptimizeFlag`, an "
"integer set to 0, 1, or 2, depending on the :option:`-O` or :option:`-OO` "
"flag given on startup."
msgstr ""
"Certaines bibliothèques ne se contentent pas d'exporter des fonctions, elles "
"exportent aussi des variables. Par exemple, la bibliothèque Python exporte :"
"c:data:`Py_OptimizeFlag`, un entier valant 0, 1, ou 2 selon que l'option :"
"option:`-O` ou :option:`-OO` soit donnée au démarrage."
#: ../Doc/library/ctypes.rst:1055
msgid ""
":mod:`ctypes` can access values like this with the :meth:`in_dll` class "
"methods of the type. *pythonapi* is a predefined symbol giving access to "
"the Python C api::"
msgstr ""
":mod:`ctypes` peut accéder à ce type de valeurs avec les méthodes de classe :"
"meth:`in_dll` du type considéré. *pythonapi* est un symbole prédéfini qui "
"donne accès à l'API C Python ::"
#: ../Doc/library/ctypes.rst:1064
msgid ""
"If the interpreter would have been started with :option:`-O`, the sample "
"would have printed ``c_long(1)``, or ``c_long(2)`` if :option:`-OO` would "
"have been specified."
msgstr ""
"Si l'interpréteur est lancé avec :option:`-O`, l'exemple affiche "
"``c_long(1)`` et ``c_long(2)`` avec :option:`-OO`."
#: ../Doc/library/ctypes.rst:1068
msgid ""
"An extended example which also demonstrates the use of pointers accesses "
"the :c:data:`PyImport_FrozenModules` pointer exported by Python."
msgstr ""
"Le pointeur :c:data:`PyImport_FrozenModules` exposé par Python est un autre "
"exemple complet de l'utilisation de pointeurs."
#: ../Doc/library/ctypes.rst:1071
msgid "Quoting the docs for that value:"
msgstr "Citons la documentation :"
#: ../Doc/library/ctypes.rst:1073
msgid ""
"This pointer is initialized to point to an array of :c:type:`struct _frozen` "
"records, terminated by one whose members are all *NULL* or zero. When a "
"frozen module is imported, it is searched in this table. Third-party code "
"could play tricks with this to provide a dynamically created collection of "
"frozen modules."
msgstr ""
#: ../Doc/library/ctypes.rst:1078
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 ""
"Donc manipuler ce pointeur peut même se révéler utile. Pour limiter la "
"taille de l'exemple, nous nous bornons à montrer comment lire ce tableau "
"avec :mod:`ctypes` ::"
#: ../Doc/library/ctypes.rst:1090
msgid ""
"We have defined the :c:type:`struct _frozen` data type, so we can get the "
"pointer to the table::"
msgstr ""
"Le type de donnée :c:type:`struct _frozen` ayant été défini, nous pouvons "
"récupérer le pointeur vers le tableau ::"
#: ../Doc/library/ctypes.rst:1097
msgid ""
"Since ``table`` is a ``pointer`` to the array of ``struct_frozen`` records, "
"we can iterate over it, but we just have to make sure that our loop "
"terminates, because pointers have no size. Sooner or later it would probably "
"crash with an access violation or whatever, so it's better to break out of "
"the loop when we hit the NULL entry::"
msgstr ""
#: ../Doc/library/ctypes.rst:1115
msgid ""
"The fact that standard Python has a frozen module and a frozen package "
"(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 ""
#: ../Doc/library/ctypes.rst:1123
msgid "Surprises"
msgstr "Surprises"
#: ../Doc/library/ctypes.rst:1125
msgid ""
"There are some edges in :mod:`ctypes` where you might expect something other "
"than what actually happens."
msgstr ""
"Il y a quelques cas tordus dans :mod:`ctypes` où on peut s'attendre à un "
"résultat différent de la réalité."
#: ../Doc/library/ctypes.rst:1128
msgid "Consider the following example::"
msgstr "Examinons l'exemple suivant ::"
#: ../Doc/library/ctypes.rst:1148
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 ""
"Diantre. On s'attendait certainement à ce que le dernier résultat affiche "
"``3 4 1 2``. Que s'est-il passé ? Les étapes de la ligne ``rc.a, rc.b = rc."
"b, rc.a`` ci-dessus sont les suivantes ::"
#: ../Doc/library/ctypes.rst:1156
msgid ""
"Note that ``temp0`` and ``temp1`` are objects still using the internal "
"buffer of the ``rc`` object above. So executing ``rc.a = temp0`` copies the "
"buffer contents of ``temp0`` into ``rc`` 's buffer. This, in turn, changes "
"the contents of ``temp1``. So, the last assignment ``rc.b = temp1``, doesn't "
"have the expected effect."
msgstr ""
"Les objets ``temp0`` et ``temp1`` utilisent encore le tampon interne de "
"l'objet ``rc`` ci-dessus. Donc exécuter ``rc.a = temp0`` copie le contenu du "
"tampon de ``temp0`` dans celui de ``rc``. Ce qui, par ricochet, modifie le "
"contenu de ``temp1``. Et donc, la dernière affectation, ``rc.b = temp1``, "
"n'a pas l'effet escompté."
#: ../Doc/library/ctypes.rst:1162
msgid ""
"Keep in mind that retrieving sub-objects from Structure, Unions, and Arrays "
"doesn't *copy* the sub-object, instead it retrieves a wrapper object "
"accessing the root-object's underlying buffer."
msgstr ""
"Gardez en tête qu'accéder au sous-objet depuis une *Structure*, une *Union* "
"ou un *Array* ne copie *pas* le sous-objet, mais crée un objet interface qui "
"accède au tampon sous-jacent de l'objet initial."
#: ../Doc/library/ctypes.rst:1166
msgid ""
"Another example that may behave different from what one would expect is "
"this::"
msgstr ""
#: ../Doc/library/ctypes.rst:1176
msgid ""
"Why is it printing ``False``? ctypes instances are objects containing a "
"memory block plus some :term:`descriptor`\\s accessing the contents of the "
"memory. Storing a Python object in the memory block does not store the "
"object itself, instead the ``contents`` of the object is stored. Accessing "
"the contents again constructs a new Python object each time!"
msgstr ""
"Pourquoi cela affiche-t'il ``False`` ? Les instances *ctypes* sont des "
"objets qui contiennent un bloc mémoire et des :term:`descriptor` qui donnent "
"accès au contenu du ce bloc. Stocker un objet Python dans le bloc mémoire ne "
"stocke pas l'objet même ; seuls ses ``contents`` le sont. Accéder au "
"``contents`` crée un nouvel objet Python à chaque fois !"
#: ../Doc/library/ctypes.rst:1186
msgid "Variable-sized data types"
msgstr "Types de données à taille flottante"
#: ../Doc/library/ctypes.rst:1188
msgid ""
":mod:`ctypes` provides some support for variable-sized arrays and structures."
msgstr ""
":mod:`ctypes` assure la prise en charge des tableaux et des structures à "
"taille flottante."
#: ../Doc/library/ctypes.rst:1190
msgid ""
"The :func:`resize` function can be used to resize the memory buffer of an "
"existing ctypes object. The function takes the object as first argument, "
"and the requested size in bytes as the second argument. The memory block "
"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 fonction :func:`resize` permet de redimensionner la taille du tampon "
"mémoire d'un objet *ctypes* existant. Cette fonction prend l'objet comme "
"premier argument et la taille en octets désirée comme second. La taille du "
"tampon mémoire ne peut pas être inférieure à celle occupée par un objet "
"unitaire du type considéré. Une :exc:`ValueError` est levée si c'est le "
"cas ::"
#: ../Doc/library/ctypes.rst:1210
msgid ""
"This is nice and fine, but how would one access the additional elements "
"contained in this array? Since the type still only knows about 4 elements, "
"we get errors accessing other elements::"
msgstr ""
"Cela dit, comment accéder aux éléments supplémentaires contenus dans le "
"tableau ? Vu que le type ne connaît que 4 éléments, on obtient une erreur si "
"l'on accède aux suivants ::"
#: ../Doc/library/ctypes.rst:1222
msgid ""
"Another way to use variable-sized data types with :mod:`ctypes` is to use "
"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 ""
"Une autre approche pour utiliser des types de donnée à taille flottante "
"avec :mod:`ctypes` consiste à tirer profit de la nature intrinsèquement "
"dynamique de Python et de (re)définir le type de donnée une fois que la "
"taille demandée est connue, au cas-par-cas."
#: ../Doc/library/ctypes.rst:1230
msgid "ctypes reference"
msgstr "Référence du module"
#: ../Doc/library/ctypes.rst:1236
msgid "Finding shared libraries"
msgstr "Recherche de bibliothèques partagées"
#: ../Doc/library/ctypes.rst:1238
msgid ""
"When programming in a compiled language, shared libraries are accessed when "
"compiling/linking a program, and when the program is run."
msgstr ""
"Les langages compilés ont besoin d'accéder aux bibliothèques partagées au "
"moment de la compilation, de l'édition de liens et pendant l'exécution du "
"programme."
#: ../Doc/library/ctypes.rst:1241
msgid ""
"The purpose of the :func:`find_library` function is to locate a library in a "
"way similar to what the compiler does (on platforms with several versions of "
"a shared library the most recent should be loaded), while the ctypes library "
"loaders act like when a program is run, and call the runtime loader directly."
msgstr ""
#: ../Doc/library/ctypes.rst:1246
msgid ""
"The :mod:`ctypes.util` module provides a function which can help to "
"determine the library to load."
msgstr ""
"Le module :mod:`ctypes.util` fournit une fonction pour déterminer quelle "
"bibliothèque charger."
#: ../Doc/library/ctypes.rst:1254
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``."
msgstr ""
#: ../Doc/library/ctypes.rst:1259 ../Doc/library/ctypes.rst:1837
msgid "The exact functionality is system dependent."
msgstr "Le mode opératoire exact dépend du système."
#: ../Doc/library/ctypes.rst:1261
msgid ""
"On Linux, :func:`find_library` tries to run external programs (``/sbin/"
"ldconfig``, ``gcc``, and ``objdump``) to find the library file. It returns "
"the filename of the library file. Here are some examples::"
msgstr ""
#: ../Doc/library/ctypes.rst:1274
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 ""
"Sous OS X, :func:`find_library` regarde dans des chemins et conventions de "
"chemins prédéfinies pour trouver la bibliothèque et en renvoie le chemin "
"complet si elle la trouve :"
#: ../Doc/library/ctypes.rst:1288
msgid ""
"On Windows, :func:`find_library` searches along the system search path, and "
"returns the full pathname, but since there is no predefined naming scheme a "
"call like ``find_library(\"c\")`` will fail and return ``None``."
msgstr ""
"Sous Windows, :func:`find_library` examine le chemin de recherche du système "
"et renvoie le chemin complet de la bibliothèque, mais comme il n'existe pas "
"de convention de nommage, des appels comme ``find_library(\"c\")`` échouent "
"et renvoient ``None``."
#: ../Doc/library/ctypes.rst:1292
msgid ""
"If wrapping a shared library with :mod:`ctypes`, it *may* be better to "
"determine the shared library name at development time, and hardcode that "
"into the wrapper module instead of using :func:`find_library` to locate the "
"library at runtime."
msgstr ""
"Si vous encapsulez une bibliothèque partagée avec :mod:`ctypes`, il est "
"*probablement* plus judicieux de déterminer le chemin de cette bibliothèque "
"lors du développement et de l'écrire en dur dans le module d'encapsulation, "
"plutôt que d'utiliser :func:`find_library` pour la trouver lors de "
"l'exécution."
#: ../Doc/library/ctypes.rst:1300
msgid "Loading shared libraries"
msgstr "Chargement des bibliothèques partagées"
#: ../Doc/library/ctypes.rst:1302
msgid ""
"There are several ways to load shared libraries into the Python process. "
"One way is to instantiate one of the following classes:"
msgstr ""
"Il y a plusieurs moyens de charger une bibliothèque partagée dans un "
"processus Python. L'un d'entre eux consiste à instancier une des classes "
"suivantes :"
#: ../Doc/library/ctypes.rst:1308
msgid ""
"Instances of this class represent loaded shared libraries. Functions in "
"these libraries use the standard C calling convention, and are assumed to "
"return :c:type:`int`."
msgstr ""
"Une instance de cette classe représente une bibliothèque partagée déjà "
"chargée. Les fonctions de cette bibliothèque utilisent la convention d'appel "
"C standard et doivent renvoyer un :c:type:`int`."
#: ../Doc/library/ctypes.rst:1315
msgid ""
"Windows only: Instances of this class represent loaded shared libraries, "
"functions in these libraries use the ``stdcall`` calling convention, and are "
"assumed to return the windows specific :class:`HRESULT` code. :class:"
"`HRESULT` values contain information specifying whether the function call "
"failed or succeeded, together with additional error code. If the return "
"value signals a failure, an :class:`OSError` is automatically raised."
msgstr ""
"En Windows seulement : une instance de cette classe représente une "
"bibliothèque partagée déjà chargée. Les fonctions de cette bibliothèque "
"utilisent la convention d'appel *stdcall*, et doivent renvoyer un code :"
"class:`HRESULT` (propre à Windows). Les valeurs de :class:`HRESULT` "
"contiennent des informations précisant si l'appel de la fonction a échoué ou "
"s'il a réussi, ainsi qu'un code d'erreur supplémentaire. Si la valeur de "
"retour signale un échec, une :class:`OSError` est levée automatiquement."
#: ../Doc/library/ctypes.rst:1322
msgid ":exc:`WindowsError` used to be raised."
msgstr ":exc:`WindowsError` était levée auparavant."
#: ../Doc/library/ctypes.rst:1328
msgid ""
"Windows only: Instances of this class represent loaded shared libraries, "
"functions in these libraries use the ``stdcall`` calling convention, and are "
"assumed to return :c:type:`int` by default."
msgstr ""
"En Windows seulement : une instance de cette classe représente une "
"bibliothèque partagée déjà chargée. Les fonctions de cette bibliothèque "
"utilisent la convention d'appel *stdcall* et doivent renvoyer par défaut un :"
"c:type:`int`."
#: ../Doc/library/ctypes.rst:1332
msgid ""
"On Windows CE only the standard calling convention is used, for convenience "
"the :class:`WinDLL` and :class:`OleDLL` use the standard calling convention "
"on this platform."
msgstr ""
"Sous Windows CE, seule la convention d'appel standard est utilisée. Pour des "
"raisons pratiques, :class:`WinDLL` et :class:`OleDLL` utilisent la "
"convention d'appel standard sur cette plate-forme."
#: ../Doc/library/ctypes.rst:1336
msgid ""
"The Python :term:`global interpreter lock` is released before calling any "
"function exported by these libraries, and reacquired afterwards."
msgstr ""
"Le :term:`verrou global de l'interpréteur <global interpreter lock>` Python "
"est relâché avant chaque appel d'une fonction exposée par ces bibliothèques "
"et ré-activé après."
#: ../Doc/library/ctypes.rst:1342
msgid ""
"Instances of this class behave like :class:`CDLL` instances, except that the "
"Python GIL is *not* released during the function call, and after the "
"function execution the Python error flag is checked. If the error flag is "
"set, a Python exception is raised."
msgstr ""
"Cette classe est identique à :class:`CDLL`, à ceci près que le GIL n'est "
"*pas* relâché pendant l'appel de la fonction, et, qu'au terme de l'appel, le "
"drapeau d'erreur Python est vérifié. Si celui-ci est activé, une exception "
"Python est levée."
#: ../Doc/library/ctypes.rst:1347
msgid "Thus, this is only useful to call Python C api functions directly."
msgstr ""
"Donc, cette classe ne sert qu'à appeler les fonctions de l'API C de Python."
#: ../Doc/library/ctypes.rst:1349
msgid ""
"All these classes can be instantiated by calling them with at least one "
"argument, the pathname of the shared library. If you have an existing "
"handle to an already loaded shared library, it can be passed as the "
"``handle`` named parameter, otherwise the underlying platforms ``dlopen`` or "
"``LoadLibrary`` function is used to load the library into the process, and "
"to get a handle to it."
msgstr ""
"Toutes ces classes peuvent être instanciées en les appelant avec le chemin "
"de la bibliothèque partagée comme unique argument. Il est aussi possible de "
"passer un lien vers une bibliothèque déjà chargée en utilisant le paramètre "
"``handle``. Sinon, les fonctions ``dlopen`` ou ``LoadLibrary`` de la plate-"
"forme sous-jacente permettent de charger la bibliothèque dans le processus, "
"et d'en obtenir un lien."
#: ../Doc/library/ctypes.rst:1356
msgid ""
"The *mode* parameter can be used to specify how the library is loaded. For "
"details, consult the :manpage:`dlopen(3)` manpage. On Windows, *mode* is "
"ignored. On posix systems, RTLD_NOW is always added, and is not "
"configurable."
msgstr ""
"Le mode de chargement de la bibliothèque est défini par le paramètre *mode*. "
"Pour plus de détails, référez-vous à l'entrée :manpage:`dlopen(3)` du "
"manuel. En Windows, *mode* est ignoré. Sur les systèmes POSIX, RTLD_NOW y "
"est toujours ajouté. Ceci n'est pas configurable."
#: ../Doc/library/ctypes.rst:1361
msgid ""
"The *use_errno* parameter, when set to true, enables a ctypes mechanism that "
"allows accessing the system :data:`errno` error number in a safe way. :mod:"
"`ctypes` maintains a thread-local copy of the systems :data:`errno` "
"variable; if you call foreign functions created with ``use_errno=True`` then "
"the :data:`errno` value before the function call is swapped with the ctypes "
"private copy, the same happens immediately after the function call."
msgstr ""
"Le paramètre *use_errno*, lorsque défini à vrai, active un mécanisme de "
"*ctypes* qui permet d'accéder au numéro d'erreur :data:`errno` du système de "
"manière sécurisée. :mod:`ctypes` maintient une copie de :data:`errno` du "
"système dans chaque fil d'exécution. Si vous appelez des fonctions externes "
"créées avec ``use_errno=True``, la valeur de :data:`errno` avant l'appel de "
"la fonction est échangée avec la copie privée de *ctypes*. La même chose se "
"produit juste après l'appel de la fonction."
#: ../Doc/library/ctypes.rst:1368
msgid ""
"The function :func:`ctypes.get_errno` returns the value of the ctypes "
"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 fonction :func:`ctypes.get_errno` renvoie la valeur de la copie privée de "
"*ctypes*. La fonction :func:`ctypes.set_errno` affecte une nouvelle valeur à "
"la copie privée et renvoie l'ancienne valeur."
#: ../Doc/library/ctypes.rst:1372
msgid ""
"The *use_last_error* parameter, when set to true, enables the same mechanism "
"for the Windows error code which is managed by the :func:`GetLastError` and :"
"func:`SetLastError` Windows API functions; :func:`ctypes.get_last_error` "
"and :func:`ctypes.set_last_error` are used to request and change the ctypes "
"private copy of the windows error code."
msgstr ""
"Définir le paramètre *use_last_error* à vrai active le même mécanisme pour "
"le code d'erreur de Windows qui est géré par les fonctions :func:"
"`GetLastError` et :func:`SetLastError` de l'API Windows ; :func:`ctypes."
"get_last_error` et :func:`ctypes.set_last_error` servent à obtenir et "
"modifier la copie privée *ctypes* de ce code d'erreur."
#: ../Doc/library/ctypes.rst:1381
msgid ""
"Flag to use as *mode* parameter. On platforms where this flag is not "
"available, it is defined as the integer zero."
msgstr ""
"Valeur possible pour le paramètre *mode*. Vaut zéro sur les plates-formes où "
"ce drapeau n'est pas disponible."
#: ../Doc/library/ctypes.rst:1388
msgid ""
"Flag to use as *mode* parameter. On platforms where this is not available, "
"it is the same as *RTLD_GLOBAL*."
msgstr ""
"Valeur possible pour le paramètre *mode*. Vaut *RTLD_GLOBAL* sur les plates-"
"formes où ce drapeau n'est pas disponible."
#: ../Doc/library/ctypes.rst:1395
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 ""
"Mode de chargement par défaut des bibliothèques partagées. Vaut "
"*RTLD_GLOBAL* sur OSX 10.3 et *RTLD_LOCAL* sur les autres systèmes "
"d'exploitation."
#: ../Doc/library/ctypes.rst:1398
msgid ""
"Instances of these classes have no public methods. Functions exported by "
"the shared library can be accessed as attributes or by index. Please note "
"that accessing the function through an attribute caches the result and "
"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 ""
#: ../Doc/library/ctypes.rst:1409
msgid ""
"The following public attributes are available, their name starts with an "
"underscore to not clash with exported function names:"
msgstr ""
"Les attributs publics suivants sont disponibles, leur nom commence par un "
"tiret bas pour éviter les conflits avec les noms des fonctions exportées :"
#: ../Doc/library/ctypes.rst:1415
msgid "The system handle used to access the library."
msgstr ""
#: ../Doc/library/ctypes.rst:1420
msgid "The name of the library passed in the constructor."
msgstr "Nom de la bibliothèque donné au constructeur."
#: ../Doc/library/ctypes.rst:1422
msgid ""
"Shared libraries can also be loaded by using one of the prefabricated "
"objects, which are instances of the :class:`LibraryLoader` class, either by "
"calling the :meth:`LoadLibrary` method, or by retrieving the library as "
"attribute of the loader instance."
msgstr ""
"Il est possible de charger une bibliothèque partagée soit en utilisant une "
"instance de la classe :class:`LibraryLoader`, soit en appelant la méthode :"
"meth:`LoadLibrary`, soit en récupérant la bibliothèque comme attribut de "
"l'instance du chargeur."
#: ../Doc/library/ctypes.rst:1430
msgid ""
"Class which loads shared libraries. *dlltype* should be one of the :class:"
"`CDLL`, :class:`PyDLL`, :class:`WinDLL`, or :class:`OleDLL` types."
msgstr ""
"Classe pour charger une bibliothèque partagée. *dlltype* doit être de type :"
"class:`CDLL`, :class:`PyDLL`, :class:`WinDLL` ou :class:`OleDLL`."
#: ../Doc/library/ctypes.rst:1433
msgid ""
":meth:`__getattr__` has special behavior: It allows loading a shared library "
"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__` a un comportement particulier : elle charge une "
"bibliothèque quand on accède à un attribut du chargeur. Le résultat est mis "
"en cache, donc des accès consécutifs renvoient la même bibliothèque à chaque "
"fois."
#: ../Doc/library/ctypes.rst:1439
msgid ""
"Load a shared library into the process and return it. This method always "
"returns a new instance of the library."
msgstr ""
"Charge une bibliothèque partagée dans le processus et la renvoie. Cette "
"méthode renvoie toujours une nouvelle instance de la bibliothèque."
#: ../Doc/library/ctypes.rst:1443
msgid "These prefabricated library loaders are available:"
msgstr "Plusieurs chargeurs sont fournis :"
#: ../Doc/library/ctypes.rst:1448
msgid "Creates :class:`CDLL` instances."
msgstr "Pour créer des instances de :class:`CDLL`."
#: ../Doc/library/ctypes.rst:1454
msgid "Windows only: Creates :class:`WinDLL` instances."
msgstr "Pour créer des instances de :class:`WinDLL` (uniquement en Windows)."
#: ../Doc/library/ctypes.rst:1460
msgid "Windows only: Creates :class:`OleDLL` instances."
msgstr "Pour créer des instances de :class:`OleDLL` (uniquement en Windows)."
#: ../Doc/library/ctypes.rst:1466
msgid "Creates :class:`PyDLL` instances."
msgstr "Pour créer des instances de :class:`PyDLL`."
#: ../Doc/library/ctypes.rst:1469
msgid ""
"For accessing the C Python api directly, a ready-to-use Python shared "
"library object is available:"
msgstr "Il existe un moyen rapide d'accéder directement à l'API C Python :"
#: ../Doc/library/ctypes.rst:1475
msgid ""
"An instance of :class:`PyDLL` that exposes Python C API functions as "
"attributes. Note that all these functions are assumed to return C :c:type:"
"`int`, which is of course not always the truth, so you have to assign the "
"correct :attr:`restype` attribute to use these functions."
msgstr ""
"Une instance de :class:`PyDLL` dont les attributs sont les fonctions "
"exportées par l'API C Python. Toutes ces fonctions sont supposées renvoyer "
"un :c:type:`int` C, ce qui n'est bien entendu pas toujours le cas. Il faut "
"donc définir vous-même le bon attribut :attr:`restype` pour pouvoir les "
"utiliser."
#: ../Doc/library/ctypes.rst:1484
msgid "Foreign functions"
msgstr "Fonctions externes"
#: ../Doc/library/ctypes.rst:1486
msgid ""
"As explained in the previous section, foreign functions can be accessed as "
"attributes of loaded shared libraries. The function objects created in this "
"way by default accept any number of arguments, accept any ctypes data "
"instances as arguments, and return the default result type specified by the "
"library loader. They are instances of a private class:"
msgstr ""
"Comme expliqué dans la section précédente, on peut accéder aux fonctions "
"externes au travers des attributs des bibliothèques partagées. Un objet "
"fonction créé de cette façon accepte par défaut un nombre quelconque "
"d'arguments qui peuvent être de n'importe quel type de données *ctypes*. Il "
"renvoie le type par défaut du chargeur de la bibliothèque. Ce sont des "
"instances de la classe privée :"
#: ../Doc/library/ctypes.rst:1495
msgid "Base class for C callable foreign functions."
msgstr "Classe de base pour les fonctions externes C."
#: ../Doc/library/ctypes.rst:1497
msgid ""
"Instances of foreign functions are also C compatible data types; they "
"represent C function pointers."
msgstr ""
"Une instance de fonction externe est également un type de donnée compatible "
"avec le C ; elle représente un pointeur vers une fonction."
#: ../Doc/library/ctypes.rst:1500
msgid ""
"This behavior can be customized by assigning to special attributes of the "
"foreign function object."
msgstr ""
"Son comportement peut-être personnalisé en réaffectant les attributs "
"spécifiques de l'objet représentant la fonction externe."
#: ../Doc/library/ctypes.rst:1505
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 ""
"Fait correspondre le type de retour de la fonction externe à un type "
"*ctypes*. Dans le cas où la fonction ne renvoie rien (:c:type:`void`), "
"utilisez ``None``."
#: ../Doc/library/ctypes.rst:1508
msgid ""
"It is possible to assign a callable Python object that is not a ctypes type, "
"in this case the function is assumed to return a C :c:type:`int`, and the "
"callable will be called with this integer, allowing further processing or "
"error checking. Using this is deprecated, for more flexible post processing "
"or error checking use a ctypes data type as :attr:`restype` and assign a "
"callable to the :attr:`errcheck` attribute."
msgstr ""
"Il est aussi possible de passer n'importe quel un objet Python qui n'est pas "
"un type *ctypes* pourvu qu'il soit appelable. Dans ce cas, la fonction est "
"censée renvoyer un :c:type:`int` C et l'appelable sera appelé avec cet "
"entier, ce qui permet ainsi de faire des actions supplémentaires comme "
"vérifier un code d'erreur. Ce mécanisme est obsolète ; une façon plus souple "
"de faire des actions supplémentaires ou de la vérification consiste à "
"affecter un type *ctypes* à :attr:`restype` et à affecter un appelable à "
"l'attribut :attr:`errcheck`."
#: ../Doc/library/ctypes.rst:1517
msgid ""
"Assign a tuple of ctypes types to specify the argument types that the "
"function accepts. Functions using the ``stdcall`` calling convention can "
"only be called with the same number of arguments as the length of this "
"tuple; functions using the C calling convention accept additional, "
"unspecified arguments as well."
msgstr ""
"Fait correspondre le type des arguments que la fonction accepte avec un *n*-"
"uplet de types *ctypes*. Les fonctions qui utilisent la convention d'appel "
"``stdcall`` ne peuvent être appelées qu'avec le même nombre d'arguments que "
"la taille du *n*-uplet mais les fonctions qui utilisent la convention "
"d'appel C acceptent aussi des arguments additionnels non-définis."
#: ../Doc/library/ctypes.rst:1523
msgid ""
"When a foreign function is called, each actual argument is passed to the :"
"meth:`from_param` class method of the items in the :attr:`argtypes` tuple, "
"this method allows adapting the actual argument to an object that the "
"foreign function accepts. For example, a :class:`c_char_p` item in the :"
"attr:`argtypes` tuple will convert a string passed as argument into a bytes "
"object using ctypes conversion rules."
msgstr ""
"À l'appel d'une fonction externe, chaque argument est passé à la méthode de "
"classe :meth:`from_param` de l'élément correspondant dans le *n*-uplet des :"
"attr:`argtypes`. Cette méthode convertit l'argument initial en un objet que "
"la fonction externe peut comprendre. Par exemple, un :class:`c_char_p` dans "
"le *n*-uplet des :attr:`argtypes` va transformer la chaîne de caractères "
"passée en argument en un objet chaîne d'octets selon les règles de "
"conversion *ctypes*."
#: ../Doc/library/ctypes.rst:1530
msgid ""
"New: It is now possible to put items in argtypes which are not ctypes types, "
"but each item must have a :meth:`from_param` method which returns a value "
"usable as argument (integer, string, ctypes instance). This allows defining "
"adapters that can adapt custom objects as function parameters."
msgstr ""
"Nouveau : il est maintenant possible de mettre des objets qui ne sont pas "
"des types de *ctypes* dans les *argtypes*, mais ceux-ci doivent avoir une "
"méthode :meth:`from_param` renvoyant une valeur qui peut être utilisée comme "
"un argument (entier, chaîne de caractères ou instance *ctypes*). Ceci permet "
"de créer des adaptateurs qui convertissent des objets arbitraires en des "
"paramètres de fonction."
#: ../Doc/library/ctypes.rst:1537
msgid ""
"Assign a Python function or another callable to this attribute. The callable "
"will be called with three or more arguments:"
msgstr ""
"Définit une fonction Python ou tout autre appelable qui sera appelé avec "
"trois arguments ou plus :"
#: ../Doc/library/ctypes.rst:1544
msgid ""
"*result* is what the foreign function returns, as specified by the :attr:"
"`restype` attribute."
msgstr ""
"*result* est la valeur de retour de la fonction externe, comme défini par "
"l'attribut :attr:`restype`."
#: ../Doc/library/ctypes.rst:1547
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* est l'objet représentant la fonction externe elle-même. Cet accesseur "
"permet de réutiliser le même appelable pour vérifier le résultat de "
"plusieurs fonctions ou de faire des actions supplémentaires après leur "
"exécution."
#: ../Doc/library/ctypes.rst:1551
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* est le *n*-uplet qui contient les paramètres initiaux passés à "
"la fonction, ceci permet de spécialiser le comportement des arguments "
"utilisés."
#: ../Doc/library/ctypes.rst:1555
msgid ""
"The object that this function returns will be returned from the foreign "
"function call, but it can also check the result value and raise an exception "
"if the foreign function call failed."
msgstr ""
"L'objet renvoyé par cette fonction est celui renvoyé par l'appel de la "
"fonction externe, mais il peut aussi vérifier la valeur du résultat et lever "
"une exception si l'appel a échoué."
#: ../Doc/library/ctypes.rst:1562
msgid ""
"This exception is raised when a foreign function call cannot convert one of "
"the passed arguments."
msgstr ""
"Exception levée quand un appel à la fonction externe ne peut pas convertir "
"un des arguments qu'elle a reçus."
#: ../Doc/library/ctypes.rst:1569
msgid "Function prototypes"
msgstr "Prototypes de fonction"
#: ../Doc/library/ctypes.rst:1571
msgid ""
"Foreign functions can also be created by instantiating function prototypes. "
"Function prototypes are similar to function prototypes in C; they describe a "
"function (return type, argument types, calling convention) without defining "
"an implementation. The factory functions must be called with the desired "
"result type and the argument types of the function."
msgstr ""
#: ../Doc/library/ctypes.rst:1580
msgid ""
"The returned function prototype creates functions that use the standard C "
"calling convention. The function will release the GIL during the call. If "
"*use_errno* is set to true, the ctypes private copy of the system :data:"
"`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 ""
#: ../Doc/library/ctypes.rst:1590
msgid ""
"Windows only: The returned function prototype creates functions that use the "
"``stdcall`` calling convention, except on Windows CE where :func:"
"`WINFUNCTYPE` is the same as :func:`CFUNCTYPE`. The function will release "
"the GIL during the call. *use_errno* and *use_last_error* have the same "
"meaning as above."
msgstr ""
#: ../Doc/library/ctypes.rst:1599
msgid ""
"The returned function prototype creates functions that use the Python "
"calling convention. The function will *not* release the GIL during the call."
msgstr ""
#: ../Doc/library/ctypes.rst:1602
msgid ""
"Function prototypes created by these factory functions can be instantiated "
"in different ways, depending on the type and number of the parameters in the "
"call:"
msgstr ""
#: ../Doc/library/ctypes.rst:1610
msgid ""
"Returns a foreign function at the specified address which must be an integer."
msgstr ""
#: ../Doc/library/ctypes.rst:1617
msgid ""
"Create a C callable function (a callback function) from a Python *callable*."
msgstr ""
#: ../Doc/library/ctypes.rst:1624
msgid ""
"Returns a foreign function exported by a shared library. *func_spec* must be "
"a 2-tuple ``(name_or_ordinal, library)``. The first item is the name of the "
"exported function as string, or the ordinal of the exported function as "
"small integer. The second item is the shared library instance."
msgstr ""
#: ../Doc/library/ctypes.rst:1634
msgid ""
"Returns a foreign function that will call a COM method. *vtbl_index* is the "
"index into the virtual function table, a small non-negative integer. *name* "
"is name of the COM method. *iid* is an optional pointer to the interface "
"identifier which is used in extended error reporting."
msgstr ""
#: ../Doc/library/ctypes.rst:1639
msgid ""
"COM methods use a special calling convention: They require a pointer to the "
"COM interface as first argument, in addition to those parameters that are "
"specified in the :attr:`argtypes` tuple."
msgstr ""
#: ../Doc/library/ctypes.rst:1643
msgid ""
"The optional *paramflags* parameter creates foreign function wrappers with "
"much more functionality than the features described above."
msgstr ""
#: ../Doc/library/ctypes.rst:1646
msgid "*paramflags* must be a tuple of the same length as :attr:`argtypes`."
msgstr ""
#: ../Doc/library/ctypes.rst:1648
msgid ""
"Each item in this tuple contains further information about a parameter, it "
"must be a tuple containing one, two, or three items."
msgstr ""
#: ../Doc/library/ctypes.rst:1651
msgid ""
"The first item is an integer containing a combination of direction flags for "
"the parameter:"
msgstr ""
#: ../Doc/library/ctypes.rst:1655
msgid "1"
msgstr "1"
#: ../Doc/library/ctypes.rst:1655
msgid "Specifies an input parameter to the function."
msgstr ""
#: ../Doc/library/ctypes.rst:1658
msgid "2"
msgstr "2"
#: ../Doc/library/ctypes.rst:1658
msgid "Output parameter. The foreign function fills in a value."
msgstr ""
#: ../Doc/library/ctypes.rst:1661
msgid "4"
msgstr "4"
#: ../Doc/library/ctypes.rst:1661
msgid "Input parameter which defaults to the integer zero."
msgstr ""
#: ../Doc/library/ctypes.rst:1663
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 ""
#: ../Doc/library/ctypes.rst:1666
msgid "The optional third item is the default value for this parameter."
msgstr ""
#: ../Doc/library/ctypes.rst:1668
msgid ""
"This example demonstrates how to wrap the Windows ``MessageBoxW`` function "
"so that it supports default parameters and named arguments. The C "
"declaration from the windows header file is this::"
msgstr ""
#: ../Doc/library/ctypes.rst:1679 ../Doc/library/ctypes.rst:1702
msgid "Here is the wrapping with :mod:`ctypes`::"
msgstr ""
#: ../Doc/library/ctypes.rst:1687
msgid "The ``MessageBox`` foreign function can now be called in these ways::"
msgstr ""
#: ../Doc/library/ctypes.rst:1693
msgid ""
"A second example demonstrates output parameters. The win32 "
"``GetWindowRect`` function retrieves the dimensions of a specified window by "
"copying them into ``RECT`` structure that the caller has to supply. Here is "
"the C declaration::"
msgstr ""
#: ../Doc/library/ctypes.rst:1711
msgid ""
"Functions with output parameters will automatically return the output "
"parameter value if there is a single one, or a tuple containing the output "
"parameter values when there are more than one, so the GetWindowRect function "
"now returns a RECT instance, when called."
msgstr ""
#: ../Doc/library/ctypes.rst:1716
msgid ""
"Output parameters can be combined with the :attr:`errcheck` protocol to do "
"further output processing and error checking. The win32 ``GetWindowRect`` "
"api function returns a ``BOOL`` to signal success or failure, so this "
"function could do the error checking, and raises an exception when the api "
"call failed::"
msgstr ""
#: ../Doc/library/ctypes.rst:1729
msgid ""
"If the :attr:`errcheck` function returns the argument tuple it receives "
"unchanged, :mod:`ctypes` continues the normal processing it does on the "
"output parameters. If you want to return a tuple of window coordinates "
"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 ""
#: ../Doc/library/ctypes.rst:1748
msgid "Utility functions"
msgstr "Fonctions utilitaires"
#: ../Doc/library/ctypes.rst:1752
msgid ""
"Returns the address of the memory buffer as integer. *obj* must be an "
"instance of a ctypes type."
msgstr ""
#: ../Doc/library/ctypes.rst:1758
msgid ""
"Returns the alignment requirements of a ctypes type. *obj_or_type* must be a "
"ctypes type or instance."
msgstr ""
#: ../Doc/library/ctypes.rst:1764
msgid ""
"Returns a light-weight pointer to *obj*, which must be an instance of a "
"ctypes type. *offset* defaults to zero, and must be an integer that will be "
"added to the internal pointer value."
msgstr ""
#: ../Doc/library/ctypes.rst:1768
msgid "``byref(obj, offset)`` corresponds to this C code::"
msgstr ""
#: ../Doc/library/ctypes.rst:1772
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 ""
#: ../Doc/library/ctypes.rst:1778
msgid ""
"This function is similar to the cast operator in C. It returns a new "
"instance of *type* which points to the same memory block as *obj*. *type* "
"must be a pointer type, and *obj* must be an object that can be interpreted "
"as a pointer."
msgstr ""
#: ../Doc/library/ctypes.rst:1786
msgid ""
"This function creates a mutable character buffer. The returned object is a "
"ctypes array of :class:`c_char`."
msgstr ""
#: ../Doc/library/ctypes.rst:1789
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 ""
#: ../Doc/library/ctypes.rst:1792
msgid ""
"If a bytes object is specified as first argument, the buffer is made one "
"item larger than its length so that the last element in the array is a NUL "
"termination character. An integer can be passed as second argument which "
"allows specifying the size of the array if the length of the bytes should "
"not be used."
msgstr ""
#: ../Doc/library/ctypes.rst:1801
msgid ""
"This function creates a mutable unicode character buffer. The returned "
"object is a ctypes array of :class:`c_wchar`."
msgstr ""
#: ../Doc/library/ctypes.rst:1804
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 ""
#: ../Doc/library/ctypes.rst:1807
msgid ""
"If a string is specified as first argument, the buffer is made one item "
"larger than the length of the string so that the last element in the array "
"is a NUL termination character. An integer can be passed as second argument "
"which allows specifying the size of the array if the length of the string "
"should not be used."
msgstr ""
#: ../Doc/library/ctypes.rst:1817
msgid ""
"Windows only: This function is a hook which allows implementing in-process "
"COM servers with ctypes. It is called from the DllCanUnloadNow function "
"that the _ctypes extension dll exports."
msgstr ""
#: ../Doc/library/ctypes.rst:1824
msgid ""
"Windows only: This function is a hook which allows implementing in-process "
"COM servers with ctypes. It is called from the DllGetClassObject function "
"that the ``_ctypes`` extension dll exports."
msgstr ""
#: ../Doc/library/ctypes.rst:1832
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``."
msgstr ""
#: ../Doc/library/ctypes.rst:1843
msgid ""
"Windows only: return the filename of the VC runtime library used by Python, "
"and by the extension modules. If the name of the library cannot be "
"determined, ``None`` is returned."
msgstr ""
#: ../Doc/library/ctypes.rst:1847
msgid ""
"If you need to free memory, for example, allocated by an extension module "
"with a call to the ``free(void *)``, it is important that you use the "
"function in the same library that allocated the memory."
msgstr ""
#: ../Doc/library/ctypes.rst:1854
msgid ""
"Windows only: Returns a textual description of the error code *code*. If no "
"error code is specified, the last error code is used by calling the Windows "
"api function GetLastError."
msgstr ""
#: ../Doc/library/ctypes.rst:1861
msgid ""
"Windows only: Returns the last error code set by Windows in the calling "
"thread. This function calls the Windows `GetLastError()` function directly, "
"it does not return the ctypes-private copy of the error code."
msgstr ""
#: ../Doc/library/ctypes.rst:1867
msgid ""
"Returns the current value of the ctypes-private copy of the system :data:"
"`errno` variable in the calling thread."
msgstr ""
#: ../Doc/library/ctypes.rst:1872
msgid ""
"Windows only: returns the current value of the ctypes-private copy of the "
"system :data:`LastError` variable in the calling thread."
msgstr ""
#: ../Doc/library/ctypes.rst:1877
msgid ""
"Same as the standard C memmove library function: copies *count* bytes from "
"*src* to *dst*. *dst* and *src* must be integers or ctypes instances that "
"can be converted to pointers."
msgstr ""
#: ../Doc/library/ctypes.rst:1884
msgid ""
"Same as the standard C memset library function: fills the memory block at "
"address *dst* with *count* bytes of value *c*. *dst* must be an integer "
"specifying an address, or a ctypes instance."
msgstr ""
#: ../Doc/library/ctypes.rst:1891
msgid ""
"This factory function creates and returns a new ctypes pointer type. Pointer "
"types are cached and reused internally, so calling this function repeatedly "
"is cheap. *type* must be a ctypes type."
msgstr ""
#: ../Doc/library/ctypes.rst:1898
msgid ""
"This function creates a new pointer instance, pointing to *obj*. The "
"returned object is of the type ``POINTER(type(obj))``."
msgstr ""
#: ../Doc/library/ctypes.rst:1901
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 ""
#: ../Doc/library/ctypes.rst:1907
msgid ""
"This function resizes the internal memory buffer of *obj*, which must be an "
"instance of a ctypes type. It is not possible to make the buffer smaller "
"than the native size of the objects type, as given by ``sizeof(type(obj))``, "
"but it is possible to enlarge the buffer."
msgstr ""
#: ../Doc/library/ctypes.rst:1915
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 ""
#: ../Doc/library/ctypes.rst:1922
msgid ""
"Windows only: set the current value of the ctypes-private copy of the "
"system :data:`LastError` variable in the calling thread to *value* and "
"return the previous value."
msgstr ""
#: ../Doc/library/ctypes.rst:1930
msgid ""
"Returns the size in bytes of a ctypes type or instance memory buffer. Does "
"the same as the C ``sizeof`` operator."
msgstr ""
#: ../Doc/library/ctypes.rst:1936
msgid ""
"This function returns the C string starting at memory address *address* as a "
"bytes object. If size is specified, it is used as size, otherwise the string "
"is assumed to be zero-terminated."
msgstr ""
#: ../Doc/library/ctypes.rst:1943
msgid ""
"Windows only: this function is probably the worst-named thing in ctypes. It "
"creates an instance of OSError. If *code* is not specified, "
"``GetLastError`` is called to determine the error code. If *descr* is not "
"specified, :func:`FormatError` is called to get a textual description of the "
"error."
msgstr ""
#: ../Doc/library/ctypes.rst:1949
msgid "An instance of :exc:`WindowsError` used to be created."
msgstr ""
#: ../Doc/library/ctypes.rst:1955
msgid ""
"This function returns the wide character string starting at memory address "
"*address* as a string. If *size* is specified, it is used as the number of "
"characters of the string, otherwise the string is assumed to be zero-"
"terminated."
msgstr ""
#: ../Doc/library/ctypes.rst:1964
msgid "Data types"
msgstr "Types de données"
#: ../Doc/library/ctypes.rst:1969
msgid ""
"This non-public class is the common base class of all ctypes data types. "
"Among other things, all ctypes type instances contain a memory block that "
"hold C compatible data; the address of the memory block is returned by the :"
"func:`addressof` helper function. Another instance variable is exposed as :"
"attr:`_objects`; this contains other Python objects that need to be kept "
"alive in case the memory block contains pointers."
msgstr ""
#: ../Doc/library/ctypes.rst:1976
msgid ""
"Common methods of ctypes data types, these are all class methods (to be "
"exact, they are methods of the :term:`metaclass`):"
msgstr ""
#: ../Doc/library/ctypes.rst:1981
msgid ""
"This method returns a ctypes instance that shares the buffer of the *source* "
"object. The *source* object must support the writeable buffer interface. "
"The optional *offset* parameter 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 ""
#: ../Doc/library/ctypes.rst:1990
msgid ""
"This method creates a ctypes instance, copying the buffer from the *source* "
"object buffer which must be readable. The optional *offset* parameter "
"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 ""
#: ../Doc/library/ctypes.rst:1998
msgid ""
"This method returns a ctypes type instance using the memory specified by "
"*address* which must be an integer."
msgstr ""
#: ../Doc/library/ctypes.rst:2003
msgid ""
"This method adapts *obj* to a ctypes type. It is called with the actual "
"object used in a foreign function call when the type is present in the "
"foreign function's :attr:`argtypes` tuple; it must return an object that can "
"be used as a function call parameter."
msgstr ""
#: ../Doc/library/ctypes.rst:2008
msgid ""
"All ctypes data types have a default implementation of this classmethod that "
"normally returns *obj* if that is an instance of the type. Some types "
"accept other objects as well."
msgstr ""
#: ../Doc/library/ctypes.rst:2014
msgid ""
"This method returns a ctypes type instance exported by a shared library. "
"*name* is the name of the symbol that exports the data, *library* is the "
"loaded shared library."
msgstr ""
#: ../Doc/library/ctypes.rst:2018
msgid "Common instance variables of ctypes data types:"
msgstr ""
#: ../Doc/library/ctypes.rst:2022
msgid ""
"Sometimes ctypes data instances do not own the memory block they contain, "
"instead they share part of the memory block of a base object. The :attr:"
"`_b_base_` read-only member is the root ctypes object that owns the memory "
"block."
msgstr ""
#: ../Doc/library/ctypes.rst:2029
msgid ""
"This read-only variable is true when the ctypes data instance has allocated "
"the memory block itself, false otherwise."
msgstr ""
#: ../Doc/library/ctypes.rst:2034
msgid ""
"This member is either ``None`` or a dictionary containing Python objects "
"that need to be kept alive so that the memory block contents is kept valid. "
"This object is only exposed for debugging; never modify the contents of this "
"dictionary."
msgstr ""
#: ../Doc/library/ctypes.rst:2047
msgid ""
"This non-public class is the base class of all fundamental ctypes data "
"types. It is mentioned here because it contains the common attributes of the "
"fundamental ctypes data types. :class:`_SimpleCData` is a subclass of :"
"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 ""
#: ../Doc/library/ctypes.rst:2053
msgid "Instances have a single attribute:"
msgstr ""
#: ../Doc/library/ctypes.rst:2057
msgid ""
"This attribute contains the actual value of the instance. For integer and "
"pointer types, it is an integer, for character types, it is a single "
"character bytes object or string, for character pointer types it is a Python "
"bytes object or string."
msgstr ""
#: ../Doc/library/ctypes.rst:2062
msgid ""
"When the ``value`` attribute is retrieved from a ctypes instance, usually a "
"new object is returned each time. :mod:`ctypes` does *not* implement "
"original object return, always a new object is constructed. The same is "
"true for all other ctypes object instances."
msgstr ""
#: ../Doc/library/ctypes.rst:2068
msgid ""
"Fundamental data types, when returned as foreign function call results, or, "
"for example, by retrieving structure field members or array items, are "
"transparently converted to native Python types. In other words, if a "
"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 ""
#: ../Doc/library/ctypes.rst:2076
msgid ""
"Subclasses of fundamental data types do *not* inherit this behavior. So, if "
"a foreign functions :attr:`restype` is a subclass of :class:`c_void_p`, you "
"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 ""
#: ../Doc/library/ctypes.rst:2081
msgid "These are the fundamental ctypes data types:"
msgstr ""
#: ../Doc/library/ctypes.rst:2085
msgid ""
"Represents the C :c:type:`signed char` datatype, and interprets the value as "
"small integer. The constructor accepts an optional integer initializer; no "
"overflow checking is done."
msgstr ""
#: ../Doc/library/ctypes.rst:2092
msgid ""
"Represents the C :c:type:`char` datatype, and interprets the value as a "
"single character. The constructor accepts an optional string initializer, "
"the length of the string must be exactly one character."
msgstr ""
#: ../Doc/library/ctypes.rst:2099
msgid ""
"Represents the C :c:type:`char *` datatype when it points to a zero-"
"terminated string. For a general character pointer that may also point to "
"binary data, ``POINTER(c_char)`` must be used. The constructor accepts an "
"integer address, or a bytes object."
msgstr ""
#: ../Doc/library/ctypes.rst:2107
msgid ""
"Represents the C :c:type:`double` datatype. The constructor accepts an "
"optional float initializer."
msgstr ""
#: ../Doc/library/ctypes.rst:2113
msgid ""
"Represents the C :c:type:`long double` datatype. The constructor accepts an "
"optional float initializer. On platforms where ``sizeof(long double) == "
"sizeof(double)`` it is an alias to :class:`c_double`."
msgstr ""
#: ../Doc/library/ctypes.rst:2119
msgid ""
"Represents the C :c:type:`float` datatype. The constructor accepts an "
"optional float initializer."
msgstr ""
#: ../Doc/library/ctypes.rst:2125
msgid ""
"Represents the C :c:type:`signed int` datatype. The constructor accepts an "
"optional integer initializer; no overflow checking is done. On platforms "
"where ``sizeof(int) == sizeof(long)`` it is an alias to :class:`c_long`."
msgstr ""
#: ../Doc/library/ctypes.rst:2132
msgid ""
"Represents the C 8-bit :c:type:`signed int` datatype. Usually an alias for :"
"class:`c_byte`."
msgstr ""
#: ../Doc/library/ctypes.rst:2138
msgid ""
"Represents the C 16-bit :c:type:`signed int` datatype. Usually an alias "
"for :class:`c_short`."
msgstr ""
#: ../Doc/library/ctypes.rst:2144
msgid ""
"Represents the C 32-bit :c:type:`signed int` datatype. Usually an alias "
"for :class:`c_int`."
msgstr ""
#: ../Doc/library/ctypes.rst:2150
msgid ""
"Represents the C 64-bit :c:type:`signed int` datatype. Usually an alias "
"for :class:`c_longlong`."
msgstr ""
#: ../Doc/library/ctypes.rst:2156
msgid ""
"Represents the C :c:type:`signed long` datatype. The constructor accepts an "
"optional integer initializer; no overflow checking is done."
msgstr ""
#: ../Doc/library/ctypes.rst:2162
msgid ""
"Represents the C :c:type:`signed long long` datatype. The constructor "
"accepts an optional integer initializer; no overflow checking is done."
msgstr ""
#: ../Doc/library/ctypes.rst:2168
msgid ""
"Represents the C :c:type:`signed short` datatype. The constructor accepts "
"an optional integer initializer; no overflow checking is done."
msgstr ""
#: ../Doc/library/ctypes.rst:2174
msgid "Represents the C :c:type:`size_t` datatype."
msgstr ""
#: ../Doc/library/ctypes.rst:2179
msgid "Represents the C :c:type:`ssize_t` datatype."
msgstr ""
#: ../Doc/library/ctypes.rst:2186
msgid ""
"Represents the C :c:type:`unsigned char` datatype, it interprets the value "
"as small integer. The constructor accepts an optional integer initializer; "
"no overflow checking is done."
msgstr ""
#: ../Doc/library/ctypes.rst:2193
msgid ""
"Represents the C :c:type:`unsigned int` datatype. The constructor accepts "
"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 ""
#: ../Doc/library/ctypes.rst:2200
msgid ""
"Represents the C 8-bit :c:type:`unsigned int` datatype. Usually an alias "
"for :class:`c_ubyte`."
msgstr ""
#: ../Doc/library/ctypes.rst:2206
msgid ""
"Represents the C 16-bit :c:type:`unsigned int` datatype. Usually an alias "
"for :class:`c_ushort`."
msgstr ""
#: ../Doc/library/ctypes.rst:2212
msgid ""
"Represents the C 32-bit :c:type:`unsigned int` datatype. Usually an alias "
"for :class:`c_uint`."
msgstr ""
#: ../Doc/library/ctypes.rst:2218
msgid ""
"Represents the C 64-bit :c:type:`unsigned int` datatype. Usually an alias "
"for :class:`c_ulonglong`."
msgstr ""
#: ../Doc/library/ctypes.rst:2224
msgid ""
"Represents the C :c:type:`unsigned long` datatype. The constructor accepts "
"an optional integer initializer; no overflow checking is done."
msgstr ""
#: ../Doc/library/ctypes.rst:2230
msgid ""
"Represents the C :c:type:`unsigned long long` datatype. The constructor "
"accepts an optional integer initializer; no overflow checking is done."
msgstr ""
#: ../Doc/library/ctypes.rst:2236
msgid ""
"Represents the C :c:type:`unsigned short` datatype. The constructor accepts "
"an optional integer initializer; no overflow checking is done."
msgstr ""
#: ../Doc/library/ctypes.rst:2242
msgid ""
"Represents the C :c:type:`void *` type. The value is represented as "
"integer. The constructor accepts an optional integer initializer."
msgstr ""
#: ../Doc/library/ctypes.rst:2248
msgid ""
"Represents the C :c:type:`wchar_t` datatype, and interprets the value as a "
"single character unicode string. The constructor accepts an optional string "
"initializer, the length of the string must be exactly one character."
msgstr ""
#: ../Doc/library/ctypes.rst:2255
msgid ""
"Represents the C :c:type:`wchar_t *` datatype, which must be a pointer to a "
"zero-terminated wide character string. The constructor accepts an integer "
"address, or a string."
msgstr ""
#: ../Doc/library/ctypes.rst:2262
msgid ""
"Represent the C :c:type:`bool` datatype (more accurately, :c:type:`_Bool` "
"from C99). Its value can be ``True`` or ``False``, and the constructor "
"accepts any object that has a truth value."
msgstr ""
#: ../Doc/library/ctypes.rst:2269
msgid ""
"Windows only: Represents a :c:type:`HRESULT` value, which contains success "
"or error information for a function or method call."
msgstr ""
#: ../Doc/library/ctypes.rst:2275
msgid ""
"Represents the C :c:type:`PyObject *` datatype. Calling this without an "
"argument creates a ``NULL`` :c:type:`PyObject *` pointer."
msgstr ""
#: ../Doc/library/ctypes.rst:2278
msgid ""
"The :mod:`ctypes.wintypes` module provides quite some other Windows specific "
"data types, for example :c:type:`HWND`, :c:type:`WPARAM`, or :c:type:"
"`DWORD`. Some useful structures like :c:type:`MSG` or :c:type:`RECT` are "
"also defined."
msgstr ""
#: ../Doc/library/ctypes.rst:2286
msgid "Structured data types"
msgstr "Types de données dérivés de Structure"
#: ../Doc/library/ctypes.rst:2291
msgid "Abstract base class for unions in native byte order."
msgstr ""
#: ../Doc/library/ctypes.rst:2296
msgid "Abstract base class for structures in *big endian* byte order."
msgstr ""
#: ../Doc/library/ctypes.rst:2301
msgid "Abstract base class for structures in *little endian* byte order."
msgstr ""
#: ../Doc/library/ctypes.rst:2303
msgid ""
"Structures with non-native byte order cannot contain pointer type fields, or "
"any other data types containing pointer type fields."
msgstr ""
#: ../Doc/library/ctypes.rst:2309
msgid "Abstract base class for structures in *native* byte order."
msgstr ""
#: ../Doc/library/ctypes.rst:2311
msgid ""
"Concrete structure and union types must be created by subclassing one of "
"these types, and at least define a :attr:`_fields_` class variable. :mod:"
"`ctypes` will create :term:`descriptor`\\s which allow reading and writing "
"the fields by direct attribute accesses. These are the"
msgstr ""
#: ../Doc/library/ctypes.rst:2319
msgid ""
"A sequence defining the structure fields. The items must be 2-tuples or 3-"
"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 ""
#: ../Doc/library/ctypes.rst:2323
msgid ""
"For integer type fields like :class:`c_int`, a third optional item can be "
"given. It must be a small positive integer defining the bit width of the "
"field."
msgstr ""
#: ../Doc/library/ctypes.rst:2327
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 ""
#: ../Doc/library/ctypes.rst:2330
msgid ""
"It is possible to define the :attr:`_fields_` class variable *after* the "
"class statement that defines the Structure subclass, this allows creating "
"data types that directly or indirectly reference themselves::"
msgstr ""
#: ../Doc/library/ctypes.rst:2340
msgid ""
"The :attr:`_fields_` class variable must, however, be defined before the "
"type is first used (an instance is created, :func:`sizeof` is called on it, "
"and so on). Later assignments to the :attr:`_fields_` class variable will "
"raise an AttributeError."
msgstr ""
#: ../Doc/library/ctypes.rst:2345
msgid ""
"It is possible to defined sub-subclasses of structure types, they inherit "
"the fields of the base class plus the :attr:`_fields_` defined in the sub-"
"subclass, if any."
msgstr ""
#: ../Doc/library/ctypes.rst:2352
msgid ""
"An optional small integer that allows overriding the alignment of structure "
"fields in the instance. :attr:`_pack_` must already be defined when :attr:"
"`_fields_` is assigned, otherwise it will have no effect."
msgstr ""
#: ../Doc/library/ctypes.rst:2359
msgid ""
"An optional sequence that lists the names of unnamed (anonymous) fields. :"
"attr:`_anonymous_` must be already defined when :attr:`_fields_` is "
"assigned, otherwise it will have no effect."
msgstr ""
#: ../Doc/library/ctypes.rst:2363
msgid ""
"The fields listed in this variable must be structure or union type fields. :"
"mod:`ctypes` will create descriptors in the structure type that allows "
"accessing the nested fields directly, without the need to create the "
"structure or union field."
msgstr ""
#: ../Doc/library/ctypes.rst:2368
msgid "Here is an example type (Windows)::"
msgstr ""
#: ../Doc/library/ctypes.rst:2381
msgid ""
"The ``TYPEDESC`` structure describes a COM data type, the ``vt`` field "
"specifies which one of the union fields is valid. Since the ``u`` field is "
"defined as anonymous field, it is now possible to access the members "
"directly off the TYPEDESC instance. ``td.lptdesc`` and ``td.u.lptdesc`` are "
"equivalent, but the former is faster since it does not need to create a "
"temporary union instance::"
msgstr ""
#: ../Doc/library/ctypes.rst:2393
msgid ""
"It is possible to defined sub-subclasses of structures, they inherit the "
"fields of the base class. If the subclass definition has a separate :attr:"
"`_fields_` variable, the fields specified in this are appended to the fields "
"of the base class."
msgstr ""
#: ../Doc/library/ctypes.rst:2398
msgid ""
"Structure and union constructors accept both positional and keyword "
"arguments. Positional arguments are used to initialize member fields in the "
"same order as they are appear in :attr:`_fields_`. Keyword arguments in the "
"constructor are interpreted as attribute assignments, so they will "
"initialize :attr:`_fields_` with the same name, or create new attributes for "
"names not present in :attr:`_fields_`."
msgstr ""
#: ../Doc/library/ctypes.rst:2409
msgid "Arrays and pointers"
msgstr "Tableaux et pointeurs"
#: ../Doc/library/ctypes.rst:2413
msgid "Abstract base class for arrays."
msgstr "Classe de base abstraite pour les *arrays*."
#: ../Doc/library/ctypes.rst:2415
msgid ""
"The recommended way to create concrete array types is by multiplying any :"
"mod:`ctypes` data type with a positive integer. Alternatively, you can "
"subclass this type and define :attr:`_length_` and :attr:`_type_` class "
"variables. Array elements can be read and written using standard subscript "
"and slice accesses; for slice reads, the resulting object is *not* itself "
"an :class:`Array`."
msgstr ""
#: ../Doc/library/ctypes.rst:2425
msgid ""
"A positive integer specifying the number of elements in the array. Out-of-"
"range subscripts result in an :exc:`IndexError`. Will be returned by :func:"
"`len`."
msgstr ""
#: ../Doc/library/ctypes.rst:2432
msgid "Specifies the type of each element in the array."
msgstr "Spécifie le type de chaque élément de l'*array*."
#: ../Doc/library/ctypes.rst:2435
msgid ""
"Array subclass constructors accept positional arguments, used to initialize "
"the elements in order."
msgstr ""
#: ../Doc/library/ctypes.rst:2441
msgid "Private, abstract base class for pointers."
msgstr ""
#: ../Doc/library/ctypes.rst:2443
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 ""
#: ../Doc/library/ctypes.rst:2447
msgid ""
"If a pointer points to an array, its elements can be read and written using "
"standard subscript and slice accesses. Pointer objects have no size, so :"
"func:`len` will raise :exc:`TypeError`. Negative subscripts will read from "
"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 ""
#: ../Doc/library/ctypes.rst:2457
msgid "Specifies the type pointed to."
msgstr ""
#: ../Doc/library/ctypes.rst:2461
msgid ""
"Returns the object to which to pointer points. Assigning to this attribute "
"changes the pointer to point to the assigned object."
msgstr ""