-
-
Notifications
You must be signed in to change notification settings - Fork 260
Expand file tree
/
Copy pathctypes.po
More file actions
3344 lines (2914 loc) · 133 KB
/
ctypes.po
File metadata and controls
3344 lines (2914 loc) · 133 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# Copyright (C) 2001-2018, Python Software Foundation
# For licence information, see README file.
#
msgid ""
msgstr ""
"Project-Id-Version: Python 3\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-03-22 22:16+0100\n"
"PO-Revision-Date: 2020-08-17 23:01+0200\n"
"Last-Translator: Antoine Wecxsteen\n"
"Language-Team: FRENCH <traductions@lists.afpy.org>\n"
"Language: fr\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 2.3\n"
#: library/ctypes.rst:2
msgid ":mod:`ctypes` --- A foreign function library for Python"
msgstr ":mod:`ctypes` — Bibliothèque Python d'appels à des fonctions externes"
#: 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."
#: library/ctypes.rst:19
msgid "ctypes tutorial"
msgstr "Didacticiel de *ctypes*"
#: 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 macOS, 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 macOS, ils "
"contiennent des directives *doctest* dans les commentaires."
#: 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."
#: library/ctypes.rst:33
msgid "Loading dynamic link libraries"
msgstr "Chargement des DLL"
#: 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)."
#: 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."
#: 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`."
#: 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* ::"
#: library/ctypes.rst:63
msgid "Windows appends the usual ``.dll`` file suffix automatically."
msgstr "Windows ajoute le suffixe habituel ``.dll`` automatiquement."
#: 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``."
#: 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 ::"
#: library/ctypes.rst:89
msgid "Accessing functions from loaded dlls"
msgstr "Accès aux fonctions des DLL chargées"
#: library/ctypes.rst:91
msgid "Functions are accessed as attributes of dll objects::"
msgstr "Les fonctions sont alors des attributs des objets DLL ::"
#: 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) ::"
#: 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."
#: 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 ::"
#: 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 ::"
#: library/ctypes.rst:148
msgid "Calling functions"
msgstr "Appel de fonctions"
#: 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*."
#: library/ctypes.rst:155
msgid ""
"This example calls both functions with a ``NULL`` pointer (``None`` should "
"be used as the ``NULL`` pointer)::"
msgstr ""
"Cet exemple appelle les deux fonctions avec un pointeur ``NULL`` (on utilise "
"``None`` pour passer un pointeur ``NULL``) ::"
#: library/ctypes.rst:164
msgid ""
":exc:`ValueError` is raised when you call an ``stdcall`` function with the "
"``cdecl`` calling convention, or vice versa::"
msgstr ""
"Une :exc:`ValueError` est levée quand on appelle une fonction ``stdcall`` "
"avec la convention d'appel ``cdecl`` et vice-versa ::"
#: library/ctypes.rst:179
msgid ""
"To find out the correct calling convention you have to look into the C "
"header file or the documentation for the function you want to call."
msgstr ""
"Pour déterminer la convention d'appel, il faut consulter l'en-tête C ou la "
"documentation de la fonction à appeler."
#: library/ctypes.rst:182
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 ::"
#: library/ctypes.rst:192
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)."
#: library/ctypes.rst:197
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."
#: library/ctypes.rst:204
msgid ""
"Before we move on calling functions with other parameter types, we have to "
"learn more about :mod:`ctypes` data types."
msgstr ""
"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`."
#: library/ctypes.rst:2138
msgid "Fundamental data types"
msgstr "Types de données de base"
#: library/ctypes.rst:213
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 :"
#: library/ctypes.rst:216
msgid "ctypes type"
msgstr "Types de *ctypes*"
#: library/ctypes.rst:216
msgid "C type"
msgstr "Type C"
#: library/ctypes.rst:216
msgid "Python type"
msgstr "Type Python"
#: library/ctypes.rst:218
msgid ":class:`c_bool`"
msgstr ":class:`c_bool`"
#: library/ctypes.rst:218
msgid ":c:type:`_Bool`"
msgstr ":c:type:`_Bool`"
#: library/ctypes.rst:218
msgid "bool (1)"
msgstr "*bool* (1)"
#: library/ctypes.rst:220
msgid ":class:`c_char`"
msgstr ":class:`c_char`"
#: library/ctypes.rst:224
msgid ":c:type:`char`"
msgstr ":c:type:`char`"
#: library/ctypes.rst:220
msgid "1-character bytes object"
msgstr "objet octet (*bytes*) de 1 caractère"
#: library/ctypes.rst:222
msgid ":class:`c_wchar`"
msgstr ":class:`c_wchar`"
#: library/ctypes.rst:222
msgid ":c:type:`wchar_t`"
msgstr ":c:type:`wchar_t`"
#: library/ctypes.rst:222
msgid "1-character string"
msgstr "chaîne de caractères (*string*) de longueur 1"
#: library/ctypes.rst:224
msgid ":class:`c_byte`"
msgstr ":class:`c_byte`"
#: library/ctypes.rst:226 library/ctypes.rst:230 library/ctypes.rst:234
#: library/ctypes.rst:238 library/ctypes.rst:242 library/ctypes.rst:247
msgid "int"
msgstr "*int*"
#: library/ctypes.rst:226
msgid ":class:`c_ubyte`"
msgstr ":class:`c_ubyte`"
#: library/ctypes.rst:226
msgid ":c:type:`unsigned char`"
msgstr ":c:type:`unsigned char`"
#: library/ctypes.rst:228
msgid ":class:`c_short`"
msgstr ":class:`c_short`"
#: library/ctypes.rst:228
msgid ":c:type:`short`"
msgstr ":c:type:`short`"
#: library/ctypes.rst:230
msgid ":class:`c_ushort`"
msgstr ":class:`c_ushort`"
#: library/ctypes.rst:230
msgid ":c:type:`unsigned short`"
msgstr ":c:type:`unsigned short`"
#: library/ctypes.rst:232
msgid ":class:`c_int`"
msgstr ":class:`c_int`"
#: library/ctypes.rst:232
msgid ":c:type:`int`"
msgstr ":c:type:`int`"
#: library/ctypes.rst:234
msgid ":class:`c_uint`"
msgstr ":class:`c_uint`"
#: library/ctypes.rst:234
msgid ":c:type:`unsigned int`"
msgstr ":c:type:`unsigned int`"
#: library/ctypes.rst:236
msgid ":class:`c_long`"
msgstr ":class:`c_long`"
#: library/ctypes.rst:236
msgid ":c:type:`long`"
msgstr ":c:type:`long`"
#: library/ctypes.rst:238
msgid ":class:`c_ulong`"
msgstr ":class:`c_ulong`"
#: library/ctypes.rst:238
msgid ":c:type:`unsigned long`"
msgstr ":c:type:`unsigned long`"
#: library/ctypes.rst:240
msgid ":class:`c_longlong`"
msgstr ":class:`c_longlong`"
#: library/ctypes.rst:240
msgid ":c:type:`__int64` or :c:type:`long long`"
msgstr ":c:type:`__int64` ou :c:type:`long long`"
#: library/ctypes.rst:242
msgid ":class:`c_ulonglong`"
msgstr ":class:`c_ulonglong`"
#: library/ctypes.rst:242
msgid ":c:type:`unsigned __int64` or :c:type:`unsigned long long`"
msgstr ":c:type:`unsigned __int64` ou :c:type:`unsigned long long`"
#: library/ctypes.rst:245
msgid ":class:`c_size_t`"
msgstr ":class:`c_size_t`"
#: library/ctypes.rst:245
msgid ":c:type:`size_t`"
msgstr ":c:type:`size_t`"
#: library/ctypes.rst:247
msgid ":class:`c_ssize_t`"
msgstr ":class:`c_ssize_t`"
#: library/ctypes.rst:247
msgid ":c:type:`ssize_t` or :c:type:`Py_ssize_t`"
msgstr ":c:type:`ssize_t` ou :c:type:`Py_ssize_t`"
#: library/ctypes.rst:250
msgid ":class:`c_float`"
msgstr ":class:`c_float`"
#: library/ctypes.rst:250
msgid ":c:type:`float`"
msgstr ":c:type:`float`"
#: library/ctypes.rst:252 library/ctypes.rst:254
msgid "float"
msgstr "*float*"
#: library/ctypes.rst:252
msgid ":class:`c_double`"
msgstr ":class:`c_double`"
#: library/ctypes.rst:252
msgid ":c:type:`double`"
msgstr ":c:type:`double`"
#: library/ctypes.rst:254
msgid ":class:`c_longdouble`"
msgstr ":class:`c_longdouble`"
#: library/ctypes.rst:254
msgid ":c:type:`long double`"
msgstr ":c:type:`long double`"
#: library/ctypes.rst:256
msgid ":class:`c_char_p`"
msgstr ":class:`c_char_p`"
#: library/ctypes.rst:256
msgid ":c:type:`char *` (NUL terminated)"
msgstr ":c:type:`char *` (terminé par NUL)"
#: library/ctypes.rst:256
msgid "bytes object or ``None``"
msgstr "objet octet (*bytes*) ou ``None``"
#: library/ctypes.rst:258
msgid ":class:`c_wchar_p`"
msgstr ":class:`c_wchar_p`"
#: library/ctypes.rst:258
msgid ":c:type:`wchar_t *` (NUL terminated)"
msgstr ":c:type:`wchar_t *` (terminé par NUL)"
#: library/ctypes.rst:258
msgid "string or ``None``"
msgstr "chaîne de caractères (*string*) ou ``None``"
#: library/ctypes.rst:260
msgid ":class:`c_void_p`"
msgstr ":class:`c_void_p`"
#: library/ctypes.rst:260
msgid ":c:type:`void *`"
msgstr ":c:type:`void *`"
#: library/ctypes.rst:260
msgid "int or ``None``"
msgstr "*int* ou ``None``"
#: library/ctypes.rst:264
msgid "The constructor accepts any object with a truth value."
msgstr "Le constructeur accepte n'importe quel objet convertible en booléen."
#: library/ctypes.rst:266
msgid ""
"All these types can be created by calling them with an optional initializer "
"of the correct type and value::"
msgstr ""
"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 ::"
#: library/ctypes.rst:277
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 ::"
#: library/ctypes.rst:289
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) ::"
#: library/ctypes.rst:309
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 ::"
#: library/ctypes.rst:333
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`."
#: library/ctypes.rst:343
msgid "Calling functions, continued"
msgstr "Appel de fonctions, suite"
#: library/ctypes.rst:345
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* ::"
#: library/ctypes.rst:365
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 ::"
#: library/ctypes.rst:378
msgid "Calling functions with your own custom data types"
msgstr "Appel de fonctions avec des types de données personnalisés"
#: library/ctypes.rst:380
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 ::"
#: library/ctypes.rst:395
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."
#: library/ctypes.rst:403
msgid "Specifying the required argument types (function prototypes)"
msgstr "Définition du type des arguments nécessaires (prototypes de fonction)"
#: library/ctypes.rst:405
msgid ""
"It is possible to specify the required argument types of functions exported "
"from DLLs by setting the :attr:`argtypes` attribute."
msgstr ""
"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`."
#: library/ctypes.rst:408
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é) ::"
#: library/ctypes.rst:419
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 ::"
#: library/ctypes.rst:431
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_`."
#: library/ctypes.rst:445
msgid "Return types"
msgstr "Types de sortie"
#: library/ctypes.rst:447
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."
#: library/ctypes.rst:451
msgid ""
"Here is a more advanced example, it uses the ``strchr`` function, which "
"expects a string pointer and a char, and returns a pointer to a string::"
msgstr ""
"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 ::"
#: library/ctypes.rst:464
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 ::"
#: library/ctypes.rst:482
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 ::"
#: library/ctypes.rst:505
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."
#: library/ctypes.rst:510
msgid ""
"Please note that a much more powerful error checking mechanism is available "
"through the :attr:`errcheck` attribute; see the reference manual for details."
msgstr ""
"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."
#: library/ctypes.rst:517
msgid "Passing pointers (or: passing parameters by reference)"
msgstr "Passage de pointeurs (passage de paramètres par référence)"
#: library/ctypes.rst:519
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*."
#: library/ctypes.rst:523
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 ::"
#: library/ctypes.rst:545
msgid "Structures and unions"
msgstr "Structures et unions"
#: library/ctypes.rst:547
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*."
#: library/ctypes.rst:552
msgid ""
"The field type must be a :mod:`ctypes` type like :class:`c_int`, or any "
"other derived :mod:`ctypes` type: structure, union, array, pointer."
msgstr ""
"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."
#: library/ctypes.rst:555
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 ::"
#: library/ctypes.rst:575
msgid ""
"You can, however, build much more complicated structures. A structure can "
"itself contain other structures by using a structure as a field type."
msgstr ""
"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."
#: library/ctypes.rst:578
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* ::"
#: library/ctypes.rst:592
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 ::"
#: library/ctypes.rst:597
msgid ""
"Field :term:`descriptor`\\s can be retrieved from the *class*, they are "
"useful for debugging because they can provide useful information::"
msgstr ""
"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 ::"
#: library/ctypes.rst:611
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."
#: library/ctypes.rst:617
msgid "Structure/union alignment and byte order"
msgstr "Alignement et boutisme des structures et des unions"
#: library/ctypes.rst:619
#, fuzzy
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 by 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 ""
"Par défaut les champs d'une *Structure* ou d'une *Union* sont alignés de la "
"même manière que le ferait un compilateur C. Ce comportement peut être "
"redéfini en définissant l'attribut :attr:`_pack_` dans la définition de la "
"sous-classe. Ce champ doit être un entier positif et vaut l'alignement "
"maximal des champs. C'est ce que fait ``#pragma pack(n)`` pour MSVC."
#: library/ctypes.rst:625
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."
#: library/ctypes.rst:635
msgid "Bit fields in structures and unions"
msgstr "Champs de bits dans les structures et les unions"
#: library/ctypes.rst:637
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_` ::"
#: library/ctypes.rst:655
msgid "Arrays"
msgstr "Tableaux"
#: library/ctypes.rst:657
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."
#: library/ctypes.rst:659
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 ::"
#: library/ctypes.rst:664
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 ::"
#: library/ctypes.rst:680
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 ::"
#: library/ctypes.rst:686
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."
#: library/ctypes.rst:689
msgid "Initializers of the correct type can also be specified::"
msgstr "Des valeurs d'initialisation du bon type peuvent être passées ::"
#: library/ctypes.rst:705
msgid "Pointers"
msgstr "Pointeurs"
#: library/ctypes.rst:707
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` ::"
#: library/ctypes.rst:715
msgid ""
"Pointer instances have a :attr:`~_Pointer.contents` attribute which returns "
"the object to which the pointer points, the ``i`` object above::"
msgstr ""
"Les instances de pointeurs ont un attribut :attr:`~_Pointer.contents` qui "
"renvoie l'objet pointé (l'objet ``i`` ci-dessus) ::"
#: library/ctypes.rst:722
msgid ""
"Note that :mod:`ctypes` does not have OOR (original object return), it "
"constructs a new, equivalent object each time you retrieve an attribute::"
msgstr ""
"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 ::"
#: library/ctypes.rst:731
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 ::"
#: library/ctypes.rst:743
msgid "Pointer instances can also be indexed with integers::"
msgstr "Il est possible d'indexer les pointeurs par des entiers ::"
#: library/ctypes.rst:749
msgid "Assigning to an integer index changes the pointed to value::"
msgstr "Affecter à travers un indice change la valeur pointée ::"