-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathintro.po
More file actions
965 lines (748 loc) · 109 KB
/
Copy pathintro.po
File metadata and controls
965 lines (748 loc) · 109 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
# SOME DESCRIPTIVE TITLE.
# Copyright (C) 2001 Python Software Foundation
# This file is distributed under the same license as the Python package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
# Translators:
# Alireza Shabani (Revisto) <theRevisto@gmail.com>, 2025
# Danial Behzadi <dani.behzi@ubuntu.com>, 2025
# Rafael Fontenelle <rffontenelle@gmail.com>, 2025
# Sepehr Rasouli <sepehrrasouli06@gmail.com>, 2026
#
msgid ""
msgstr ""
"Project-Id-Version: Python 3.14\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2026-09-16 12:56+0000\n"
"PO-Revision-Date: 2021-06-28 00:49+0000\n"
"Last-Translator: Sepehr Rasouli <sepehrrasouli06@gmail.com>, 2026\n"
"Language-Team: Persian (https://github.com/python/python-docs-fa/)\n"
"Language: fa\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
msgid "Introduction"
msgstr "مقدمه"
msgid "The Application Programmer's Interface to Python gives C and C++ programmers access to the Python interpreter at a variety of levels. The API is equally usable from C++, but for brevity it is generally referred to as the Python/C API. There are two fundamentally different reasons for using the Python/C API. The first reason is to write *extension modules* for specific purposes; these are C modules that extend the Python interpreter. This is probably the most common use. The second reason is to use Python as a component in a larger application; this technique is generally referred to as :dfn:`embedding` Python in an application."
msgstr "رابط برنامهنویسی کاربردی پایتون، دسترسی به مفسر پایتون را در سطوح گوناگون در اختیار برنامهنویسان C و C++ قرار میدهد. این API از C++ نیز به همان اندازه قابل استفاده است، اما برای اختصار، معمولاً از آن با عنوان Python/C API یاد میشود. دو دلیل اساساً متفاوت برای استفاده از Python/C API وجود دارد. دلیل اول، نوشتن *ماژولهای توسعهای* برای مقاصد خاص است؛ اینها ماژولهای C هستند که مفسر پایتون را توسعه میدهند. این احتمالاً رایجترین کاربرد است. دلیل دوم، استفاده از پایتون بهعنوان یک جزء در یک برنامه بزرگتر است؛ به این تکنیک عموماً :dfn:`تعبیه (embedding)` پایتون در یک برنامه گفته میشود."
msgid "Writing an extension module is a relatively well-understood process, where a \"cookbook\" approach works well. There are several tools that automate the process to some extent. While people have embedded Python in other applications since its early existence, the process of embedding Python is less straightforward than writing an extension."
msgstr "نوشتن یک ماژول توسعهای فرایندی نسبتاً شناختهشده است که در آن رویکرد «کتاب آشپزی» بهخوبی کار میکند. چندین ابزار وجود دارند که این فرایند را تا حدی خودکار میکنند. هرچند مردم از همان اوایل پیدایش پایتون، آن را در برنامههای دیگر تعبیه کردهاند، اما فرایند تعبیه پایتون نسبت به نوشتن یک ماژول توسعهای کمتر سرراست است."
msgid "Many API functions are useful independent of whether you're embedding or extending Python; moreover, most applications that embed Python will need to provide a custom extension as well, so it's probably a good idea to become familiar with writing an extension before attempting to embed Python in a real application."
msgstr "بسیاری از توابع API صرفنظر از اینکه در حال تعبیه کردن یا توسعه دادن پایتون هستید، مفید هستند؛ علاوه بر این، بیشتر برنامههایی که پایتون را تعبیه میکنند، به ارائه یک توسعه سفارشی نیز نیاز خواهند داشت، بنابراین احتمالاً ایده خوبی است که پیش از تلاش برای تعبیه پایتون در یک برنامه واقعی، با نوشتن یک توسعه آشنا شوید."
msgid "Language version compatibility"
msgstr "سازگاری نسخههای زبان"
msgid "Python's C API is compatible with C11 and C++11 versions of C and C++."
msgstr "API زبان C پایتون با نسخههای C11 و C++11 از زبانهای C و C++ سازگار است."
msgid "This is a lower limit: the C API does not require features from later C/C++ versions. You do *not* need to enable your compiler's \"c11 mode\"."
msgstr "این یک حد پایین است: API زبان C به ویژگیهای نسخههای بعدی C/C++ نیازی ندارد. شما نیازی *ندارید* که حالت \"c11\" کامپایلر خود را فعال کنید."
msgid "Coding standards"
msgstr "استانداردهای کدنویسی"
msgid "If you're writing C code for inclusion in CPython, you **must** follow the guidelines and standards defined in :PEP:`7`. These guidelines apply regardless of the version of Python you are contributing to. Following these conventions is not necessary for your own third party extension modules, unless you eventually expect to contribute them to Python."
msgstr "اگر در حال نوشتن کد C برای گنجاندن در سیپایتون هستید، **باید** از دستورالعملها و استانداردهای تعریفشده در :PEP:`7` پیروی کنید. این دستورالعملها صرفنظر از نسخهی پایتونی که در آن مشارکت میکنید، اعمال میشوند. پیروی از این قراردادها برای ماژولهای توسعهای شخص ثالث خودتان ضروری نیست، مگر آنکه در نهایت انتظار داشته باشید آنها را به پایتون مشارکت دهید."
msgid "Include Files"
msgstr "پروندههای include"
msgid "All function, type and macro definitions needed to use the Python/C API are included in your code by the following line::"
msgstr "تمام تعریفهای تابع، نوع و ماکروی مورد نیاز برای استفاده از Python/C API، با سطر زیر در کد شما گنجانده میشوند::"
msgid ""
"#define PY_SSIZE_T_CLEAN\n"
"#include <Python.h>"
msgstr ""
"#define PY_SSIZE_T_CLEAN\n"
"#include <Python.h>"
msgid "This implies inclusion of the following standard headers: ``<stdio.h>``, ``<string.h>``, ``<errno.h>``, ``<limits.h>``, ``<assert.h>`` and ``<stdlib.h>`` (if available)."
msgstr "این به معنای گنجاندهشدن سرآیندهای استاندارد زیر است: ``<stdio.h>``، ``<string.h>``، ``<errno.h>``، ``<limits.h>``، ``<assert.h>`` و ``<stdlib.h>`` (در صورت وجود)."
msgid "Since Python may define some pre-processor definitions which affect the standard headers on some systems, you *must* include :file:`Python.h` before any standard headers are included."
msgstr "از آنجا که پایتون ممکن است برخی تعریفهای پیشپردازنده را تعریف کند که در برخی سیستمها بر سرآیندهای استاندارد تأثیر میگذارند، شما *باید* پیش از گنجاندن هر سرآیند استانداردی، :file:`Python.h` را بگنجانید."
msgid "It is recommended to always define ``PY_SSIZE_T_CLEAN`` before including ``Python.h``. See :ref:`arg-parsing` for a description of this macro."
msgstr "توصیه میشود که همیشه ``PY_SSIZE_T_CLEAN`` را پیش از گنجاندن ``Python.h`` تعریف کنید. برای توضیح این ماکرو، :ref:`arg-parsing` را ببینید."
msgid "All user visible names defined by Python.h (except those defined by the included standard headers) have one of the prefixes ``Py`` or ``_Py``. Names beginning with ``_Py`` are for internal use by the Python implementation and should not be used by extension writers. Structure member names do not have a reserved prefix."
msgstr "همهی نامهای قابل مشاهده برای کاربر که توسط Python.h تعریف شدهاند (بهجز نامهایی که توسط سرآیندهای استانداردِ گنجاندهشده تعریف شدهاند) یکی از پیشوندهای ``Py`` یا ``_Py`` را دارند. نامهایی که با ``_Py`` آغاز میشوند برای استفادهی داخلی پیادهسازی پایتون هستند و نباید توسط نویسندگان ماژولهای توسعهای استفاده شوند. نامهای اعضای ساختار پیشوند رزروشدهای ندارند."
msgid "User code should never define names that begin with ``Py`` or ``_Py``. This confuses the reader, and jeopardizes the portability of the user code to future Python versions, which may define additional names beginning with one of these prefixes."
msgstr "کد کاربر هرگز نباید نامهایی تعریف کند که با ``Py`` یا ``_Py`` آغاز میشوند. این امر خواننده را سردرگم میکند و قابلیت حمل کد کاربر به نسخههای آینده پایتون را به خطر میاندازد؛ چرا که این نسخهها ممکن است نامهای دیگری تعریف کنند که با یکی از این پیشوندها آغاز میشوند."
msgid "The header files are typically installed with Python. On Unix, these are located in the directories :file:`{prefix}/include/pythonversion/` and :file:`{exec_prefix}/include/pythonversion/`, where :option:`prefix <--prefix>` and :option:`exec_prefix <--exec-prefix>` are defined by the corresponding parameters to Python's :program:`configure` script and *version* is ``'%d.%d' % sys.version_info[:2]``. On Windows, the headers are installed in :file:`{prefix}/include`, where ``prefix`` is the installation directory specified to the installer."
msgstr "پروندههای سرآیند معمولاً همراه با پایتون نصب میشوند. در یونیکس، این پروندهها در پوشههای :file:`{prefix}/include/pythonversion/` و :file:`{exec_prefix}/include/pythonversion/` قرار دارند؛ جایی که :option:`prefix <--prefix>` و :option:`exec_prefix <--exec-prefix>` توسط پارامترهای متناظرِ اسکریپت :program:`configure` پایتون تعریف میشوند و *نسخه* برابر ``'%d.%d' % sys.version_info[:2]`` است. در ویندوز، سرآیندها در :file:`{prefix}/include` نصب میشوند که در آن ``prefix`` پوشهی نصب مشخصشده به نصبکننده است."
msgid "To include the headers, place both directories (if different) on your compiler's search path for includes. Do *not* place the parent directories on the search path and then use ``#include <pythonX.Y/Python.h>``; this will break on multi-platform builds since the platform independent headers under :option:`prefix <--prefix>` include the platform specific headers from :option:`exec_prefix <--exec-prefix>`."
msgstr "برای گنجاندن سرآیندها، هر دو پوشه (در صورت تفاوت) را در مسیر جستجوی کامپایلر خودتان برای سرآیندها قرار دهید. پوشههای والد را در مسیر جستجو قرار داده و سپس از ``#include <pythonX.Y/Python.h>`` استفاده *نکنید*؛ این کار در ساختهای چندسکویی خراب میشود، زیرا سرآیندهای مستقل از سکو که در :option:`prefix <--prefix>` قرار دارند، سرآیندهای وابسته به سکو از :option:`exec_prefix <--exec-prefix>` را دربر میگیرند."
msgid "C++ users should note that although the API is defined entirely using C, the header files properly declare the entry points to be ``extern \"C\"``. As a result, there is no need to do anything special to use the API from C++."
msgstr "کاربران C++ باید توجه داشته باشند که اگرچه API کاملاً با استفاده از C تعریف شده است، پروندههای سرآیند نقاط ورود را بهدرستی بهصورت ``extern \"C\"`` اعلام میکنند. در نتیجه، برای استفاده از API در C++ نیازی به انجام کار خاصی نیست."
msgid "Useful macros"
msgstr "ماکروهای مفید"
msgid "Several useful macros are defined in the Python header files. Many are defined closer to where they are useful (for example, :c:macro:`Py_RETURN_NONE`, :c:macro:`PyMODINIT_FUNC`). Others of a more general utility are defined here. This is not necessarily a complete listing."
msgstr "چندین ماکروی مفید در پروندههای سرآیند پایتون تعریف شدهاند. بسیاری از آنها نزدیکتر به جایی که به کار میآیند تعریف شدهاند (برای مثال، :c:macro:`Py_RETURN_NONE` و :c:macro:`PyMODINIT_FUNC`). ماکروهای دیگر که کاربرد عمومیتری دارند، در اینجا تعریف شدهاند. این فهرست لزوماً کامل نیست."
msgid "If this macro is defined, then the current system is able to start threads."
msgstr "اگر این ماکرو تعریفشده باشد، سیستم فعلی میتواند نخها را آغاز کند."
msgid "Currently, all systems supported by CPython (per :pep:`11`), with the exception of some WebAssembly platforms, support starting threads."
msgstr "در حال حاضر، همه سیستمهای پشتیبانیشده توسط سیپایتون (طبق :pep:`11`)، به استثنای برخی پلتفرمهای WebAssembly، از راهاندازی نخها پشتیبانی میکنند."
msgid "Like :samp:`getenv({s})`, but returns ``NULL`` if :option:`-E` was passed on the command line (see :c:member:`PyConfig.use_environment`)."
msgstr "مانند :samp:`getenv({s})`، اما اگر :option:`-E` در خط فرمان گذرانده شده باشد، ``NULL`` برمیگرداند (نگاه کنید به :c:member:`PyConfig.use_environment`)."
msgid "Docstring macros"
msgstr "ماکروهای رشته مستند"
msgid "Creates a variable with name *name* that can be used in docstrings. If Python is built without docstrings (:option:`--without-doc-strings`), the value will be an empty string."
msgstr "یک متغیر با نام *name* ایجاد میکند که میتوان از آن در رشتههای مستند استفاده کرد. اگر پایتون بدون رشتههای مستند ساخته شود (:option:`--without-doc-strings`)، مقدار آن یک رشته خالی خواهد بود."
msgid "Example::"
msgstr "مثال::"
msgid ""
"PyDoc_STRVAR(pop_doc, \"Remove and return the rightmost element.\");\n"
"\n"
"static PyMethodDef deque_methods[] = {\n"
" // ...\n"
" {\"pop\", (PyCFunction)deque_pop, METH_NOARGS, pop_doc},\n"
" // ...\n"
"}"
msgstr ""
"PyDoc_STRVAR(pop_doc, \"راستترین عنصر را حذف کرده و برمیگرداند.\");\n"
"\n"
"static PyMethodDef deque_methods[] = {\n"
" // ...\n"
" {\"pop\", (PyCFunction)deque_pop, METH_NOARGS, pop_doc},\n"
" // ...\n"
"}"
msgid "Expands to :samp:`PyDoc_VAR({name}) = PyDoc_STR({str})`."
msgstr "به :samp:`PyDoc_VAR({name}) = PyDoc_STR({str})` بسط مییابد."
msgid "Expands to the given input string, or an empty string if docstrings are disabled (:option:`--without-doc-strings`)."
msgstr "به رشته ورودی دادهشده بسط مییابد، یا اگر رشتههای مستند غیرفعال باشند (:option:`--without-doc-strings`)، به رشته خالی."
msgid ""
"static PyMethodDef pysqlite_row_methods[] = {\n"
" {\"keys\", (PyCFunction)pysqlite_row_keys, METH_NOARGS,\n"
" PyDoc_STR(\"Returns the keys of the row.\")},\n"
" {NULL, NULL}\n"
"};"
msgstr ""
"static PyMethodDef pysqlite_row_methods[] = {\n"
" {\"keys\", (PyCFunction)pysqlite_row_keys, METH_NOARGS,\n"
" PyDoc_STR(\"Returns the keys of the row.\")},\n"
" {NULL, NULL}\n"
"};"
msgid "Declares a static character array variable with the given *name*. Expands to :samp:`static const char {name}[]`"
msgstr "یک متغیر آرایهی نویسهای ایستا با *نام* دادهشده اعلان میکند. به :samp:`static const char {name}[]` بسط مییابد"
msgid "For example::"
msgstr "برای مثال::"
msgid ""
"PyDoc_VAR(python_doc) = PyDoc_STR(\n"
" \"A genus of constricting snakes in the Pythonidae family native \"\n"
" \"to the tropics and subtropics of the Eastern Hemisphere.\");"
msgstr ""
"PyDoc_VAR(python_doc) = PyDoc_STR(\n"
" \"سردهای از مارهای فشارنده در خانوادهی Pythonidae بومی \"\n"
" \"مناطق حاره و نیمهحارهی نیمکره شرقی.\");"
msgid "General utility macros"
msgstr "ماکروهای کاربردی عمومی"
msgid "The following macros are for common tasks not specific to Python."
msgstr "ماکروهای زیر برای کارهای رایجی هستند که مخصوص پایتون نیستند."
msgid "Use this for unused arguments in a function definition to silence compiler warnings. Example: ``int func(int a, int Py_UNUSED(b)) { return a; }``."
msgstr "از این برای آرگومانهای استفادهنشده در تعریف تابع استفاده کنید تا هشدارهای کامپایلر سرکوب شوند. مثال: ``int func(int a, int Py_UNUSED(b)) { return a; }``."
msgid "Use a GCC attribute *name*, hiding it from compilers that don't support GCC attributes (such as MSVC)."
msgstr "از صفت GCC با نام *name* استفاده کنید تا از کامپایلرهایی که صفات GCC را پشتیبانی نمیکنند (مانند MSVC) پنهان بماند."
msgid "This expands to :samp:`__attribute__(({name)})` on a GCC compiler, and expands to nothing on compilers that don't support GCC attributes."
msgstr "این در کامپایلر GCC به :samp:`__attribute__(({name)})` بسط مییابد و در کامپایلرهایی که از ویژگیهای GCC پشتیبانی نمیکنند، به هیچچیز بسط نمییابد."
msgid "Numeric utilities"
msgstr "ابزارهای عددی"
msgid "Return the absolute value of ``x``."
msgstr "مقدار مطلق ``x`` را برمیگرداند."
msgid "The argument may be evaluated more than once. Consequently, do not pass an expression with side-effects directly to this macro."
msgstr "آرگومان ممکن است بیش از یک بار ارزیابی شود. در نتیجه، عبارتی با اثر جانبی را مستقیماً به این ماکرو ندهید."
msgid "If the result cannot be represented (for example, if ``x`` has :c:macro:`!INT_MIN` value for :c:expr:`int` type), the behavior is undefined."
msgstr "اگر نتوان نتیجه را نمایش داد (برای مثال، اگر ``x`` برای نوع :c:expr:`int` مقدار :c:macro:`!INT_MIN` داشته باشد)، رفتار تعریفنشده است."
msgid "Corresponds roughly to :samp:`(({x}) < 0 ? -({x}) : ({x}))`"
msgstr "تقریباً معادل :samp:`(({x}) < 0 ? -({x}) : ({x}))` است"
msgid "Return the larger or smaller of the arguments, respectively."
msgstr "بازگرداندن بزرگتر یا کوچکتر آرگومانها، به ترتیب."
msgid "Any arguments may be evaluated more than once. Consequently, do not pass an expression with side-effects directly to this macro."
msgstr "ممکن است هر یک از آرگومانها بیش از یک بار ارزیابی شود. در نتیجه، عبارتی با اثرات جانبی را مستقیماً به این ماکرو پاس ندهید."
msgid ":c:macro:`!Py_MAX` corresponds roughly to :samp:`((({x}) > ({y})) ? ({x}) : ({y}))`."
msgstr ":c:macro:`!Py_MAX` تقریباً معادل :samp:`((({x}) > ({y})) ? ({x}) : ({y}))` است."
msgid "Similar to :samp:`{integer} >> {positions}`, but forces sign extension, as the C standard does not define whether a right-shift of a signed integer will perform sign extension or a zero-fill."
msgstr "مشابه :samp:`{integer} >> {positions}` است، اما گسترش علامت را اجباری میکند، زیرا استاندارد C تعریف نمیکند که آیا شیفت به راست یک عدد صحیح علامتدار، گسترش علامت انجام میدهد یا با صفر پر میکند."
msgid "*integer* should be any signed integer type. *positions* is the number of positions to shift to the right."
msgstr "*integer* میتواند از هر نوع عدد صحیح علامتدار باشد. *positions* تعداد جایگاههایی است که باید به سمت راست شیفت شوند."
msgid "Both *integer* and *positions* can be evaluated more than once; consequently, avoid directly passing a function call or some other operation with side-effects to this macro. Instead, store the result as a variable and then pass it."
msgstr "هر دو *integer* و *positions* ممکن است بیش از یک بار ارزیابی شوند؛ در نتیجه، از عبور دادن مستقیم یک فراخوانی تابع یا هر عملیات دیگری با عوارض جانبی به این ماکرو خودداری کنید. در عوض، نتیجه را در یک متغیر ذخیره کنید و سپس آن را عبور دهید."
msgid "*type* is unused and only kept for backwards compatibility. Historically, *type* was used to cast *integer*."
msgstr "*type* استفاده نمیشود و تنها برای سازگاری با نسخههای پیشین نگه داشته شده است. در گذشته، *type* برای تبدیل نوع *integer* استفاده میشد."
msgid "This macro is now valid for all signed integer types, not just those for which ``unsigned type`` is legal. As a result, *type* is no longer used."
msgstr "این ماکرو اکنون برای همهی نوعهای عدد صحیح علامتدار معتبر است، نه فقط برای نوعهایی که ``unsigned type`` برایشان مجاز است. در نتیجه، *type* دیگر استفاده نمیشود."
msgid "Argument must be a character or an integer in the range [-128, 127] or [0, 255]. This macro returns ``c`` cast to an ``unsigned char``."
msgstr "آرگومان باید یک نویسه یا یک عدد صحیح در محدودهی [-128, 127] یا [0, 255] باشد. این ماکرو ``c`` را پس از تبدیل نوع به ``unsigned char`` برمیگرداند."
msgid "Assertion utilities"
msgstr "ابزارهای ادعا"
msgid "Use this when you have a code path that cannot be reached by design. For example, in the ``default:`` clause in a ``switch`` statement for which all possible values are covered in ``case`` statements. Use this in places where you might be tempted to put an ``assert(0)`` or ``abort()`` call."
msgstr "از این زمانی استفاده کنید که مسیر کدی دارید که بر اساس طراحی هرگز نمیتوان به آن رسید. برای مثال، در بند ``default:`` در یک دستور ``switch`` که تمام مقادیر ممکن آن در دستورهای ``case`` پوشش داده شدهاند. از این در جاهایی استفاده کنید که ممکن است وسوسه شوید که فراخوانی ``assert(0)`` یا ``abort()`` قرار دهید."
msgid "In release mode, the macro helps the compiler to optimize the code, and avoids a warning about unreachable code. For example, the macro is implemented with ``__builtin_unreachable()`` on GCC in release mode."
msgstr "در حالت انتشار، این ماکرو به کامپایلر کمک میکند تا کد را بهینهسازی کند و از هشدار دربارهی کد غیرقابلدسترسی جلوگیری میکند. برای مثال، این ماکرو در حالت انتشار روی GCC با ``__builtin_unreachable()`` پیادهسازی شده است."
msgid "In debug mode, and on unsupported compilers, the macro expands to a call to :c:func:`Py_FatalError`."
msgstr "در حالت اشکالزدایی و روی کامپایلرهای پشتیبانینشده، ماکرو به فراخوانی :c:func:`Py_FatalError` بسط مییابد."
msgid "A use for ``Py_UNREACHABLE()`` is following a call to a function that never returns but that is not declared ``_Noreturn``."
msgstr "یکی از کاربردهای ``Py_UNREACHABLE()`` استفاده از آن پس از فراخوانی تابعی است که هرگز باز نمیگردد اما با ``_Noreturn`` اعلان نشده است."
msgid "If a code path is very unlikely code but can be reached under exceptional case, this macro must not be used. For example, under low memory condition or if a system call returns a value out of the expected range. In this case, it's better to report the error to the caller. If the error cannot be reported to caller, :c:func:`Py_FatalError` can be used."
msgstr "اگر مسیری از کد بسیار نامحتمل باشد اما در حالتهای استثنایی بتوان به آن رسید، نباید از این ماکرو استفاده کرد. برای مثال، در وضعیت کمبود حافظه یا زمانی که یک فراخوانی سیستمی مقداری خارج از محدودهی مورد انتظار برمیگرداند. در این حالت، بهتر است خطا به فراخواننده گزارش شود. اگر نتوان خطا را به فراخواننده گزارش داد، میتوان از :c:func:`Py_FatalError` استفاده کرد."
msgid "Cast *value* to type *smaller* from type *larger*, validating that no information was lost."
msgstr "*value* را از نوع *larger* به نوع *smaller* قالبریزی میکند و اعتبارسنجی میکند که هیچ اطلاعاتی از دست نرفته باشد."
msgid "On release builds of Python, this is roughly equivalent to :samp:`(({smaller}) {value})` (in C++, :samp:`static_cast<{smaller}>({value})` will be used instead)."
msgstr "در ساختهای انتشار پایتون، این تقریباً معادل :samp:`(({smaller}) {value})` است (در C++، بهجای آن از :samp:`static_cast<{smaller}>({value})` استفاده میشود)."
msgid "On debug builds (implying that :c:macro:`Py_DEBUG` is defined), this asserts that no information was lost with the cast from *larger* to *smaller*."
msgstr "در ساختهای اشکالزدایی (به این معنا که :c:macro:`Py_DEBUG` تعریف شده است)، این ادعا میکند که با تبدیل نوع از *بزرگتر* به *کوچکتر*، هیچ اطلاعاتی از دست نرفته است."
msgid "*value*, *larger*, and *smaller* may all be evaluated more than once in the expression; consequently, do not pass an expression with side-effects directly to this macro."
msgstr "*value*، *larger* و *smaller* ممکن است هر سه بیش از یک بار در عبارت ارزیابی شوند؛ در نتیجه، عبارتی با عوارض جانبی را مستقیماً به این ماکرو نگذرانید."
msgid "Asserts a compile-time condition *cond*, as a statement. The build will fail if the condition is false or cannot be evaluated at compile time."
msgstr "یک شرط زمان کامپایل *cond* را بهصورت یک دستور ادعا میکند. اگر شرط نادرست باشد یا نتوان آن را در زمان کامپایل ارزیابی کرد، ساخت با شکست مواجه خواهد شد."
msgid "Corresponds roughly to :samp:`static_assert({cond})` on C23 and above."
msgstr "تقریباً معادل :samp:`static_assert({cond})` در C23 و بالاتر است."
msgid "Py_BUILD_ASSERT(sizeof(PyTime_t) == sizeof(int64_t));"
msgstr "Py_BUILD_ASSERT(sizeof(PyTime_t) == sizeof(int64_t));"
msgid "Asserts a compile-time condition *cond*, as an expression that evaluates to ``0``. The build will fail if the condition is false or cannot be evaluated at compile time."
msgstr "یک شرط زمان کامپایل *cond* را بهعنوان عبارتی که به ``0`` ارزیابی میشود، ادعا میکند. اگر شرط نادرست باشد یا نتوان آن را در زمان کامپایل ارزیابی کرد، ساخت شکست میخورد."
msgid ""
"#define foo_to_char(foo) \\\n"
" ((char *)(foo) + Py_BUILD_ASSERT_EXPR(offsetof(struct foo, string) == 0))"
msgstr ""
"#define foo_to_char(foo) \\\n"
" ((char *)(foo) + Py_BUILD_ASSERT_EXPR(offsetof(struct foo, string) == 0))"
msgid "Type size utilities"
msgstr "ابزارهای اندازهی نوع"
msgid "Compute the length of a statically allocated C array at compile time."
msgstr "طول یک آرایهی C با تخصیص ایستا را در زمان کامپایل محاسبه میکند."
msgid "The *array* argument must be a C array with a size known at compile time. Passing an array with an unknown size, such as a heap-allocated array, will result in a compilation error on some compilers, or otherwise produce incorrect results."
msgstr "آرگومان *array* باید یک آرایهی C با اندازهی معلوم در زمان کامپایل باشد. پاس دادن آرایهای با اندازهی نامعلوم، مانند آرایهی تخصیصیافته در هیپ، در برخی کامپایلرها منجر به خطای کامپایل میشود یا در غیر این صورت، نتایج نادرستی تولید میکند."
msgid "This is roughly equivalent to::"
msgstr "این تقریباً معادل است با::"
msgid "sizeof(array) / sizeof((array)[0])"
msgstr "sizeof(array) / sizeof((array)[0])"
msgid "Return the size of a structure (*type*) *member* in bytes."
msgstr "اندازهی یک *عضو* ساختار (*نوع*) را به بایت برمیگرداند."
msgid "Corresponds roughly to :samp:`sizeof((({type} *)NULL)->{member})`."
msgstr "تقریباً معادل :samp:`sizeof((({type} *)NULL)->{member})` است."
msgid "Macro definition utilities"
msgstr "ابزارهای تعریف ماکرو"
msgid "This is equivalent to :samp:`{X}`, which is useful for token-pasting in macros, as macro expansions in *X* are forcefully evaluated by the preprocessor."
msgstr "این معادل :samp:`{X}` است که برای چسباندن توکنها (token-pasting) در ماکروها مفید است، زیرا بسطهای ماکرو در *X* بهاجبار توسط پیشپردازنده ارزیابی میشوند."
msgid "Convert ``x`` to a C string. For example, ``Py_STRINGIFY(123)`` returns ``\"123\"``."
msgstr "تبدیل ``x`` به یک رشتهی C. برای مثال، ``Py_STRINGIFY(123)`` مقدار ``\"123\"`` را برمیگرداند."
msgid "Declaration utilities"
msgstr "ابزارهای اعلان"
msgid "The following macros can be used in declarations. They are most useful for defining the C API itself, and have limited use for extension authors. Most of them expand to compiler-specific spellings of common extensions to the C language."
msgstr "از ماکروهای زیر میتوان در اعلانها استفاده کرد. این ماکروها بیشترین کاربرد را در تعریف خودِ C API دارند و برای نویسندگان ماژولهای توسعهای کاربرد محدودی دارند. بیشتر آنها به نوشتارهای مخصوص کامپایلر برای توسعههای رایج زبان C بسط مییابند."
msgid "Ask the compiler to always inline a static inline function. The compiler can ignore it and decide to not inline the function."
msgstr "از کامپایلر میخواهد که یک تابع ایستای درونخطی (static inline) را همیشه درونخطی کند. کامپایلر میتواند آن را نادیده بگیرد و تصمیم بگیرد که تابع را درونخطی نکند."
msgid "Corresponds to ``always_inline`` attribute in GCC and ``__forceinline`` in MSVC."
msgstr "معادل ویژگی ``always_inline`` در GCC و ``__forceinline`` در MSVC است."
msgid "It can be used to inline performance critical static inline functions when building Python in debug mode with function inlining disabled. For example, MSC disables function inlining when building in debug mode."
msgstr "از آن میتوان برای درونخطی کردن توابع static inline حیاتی از نظر کارایی استفاده کرد، زمانی که پایتون در حالت اشکالزدایی و با درونخطیسازی توابع غیرفعال ساخته میشود. برای مثال، MSC هنگام ساخت در حالت اشکالزدایی، درونخطیسازی توابع را غیرفعال میکند."
msgid "Marking blindly a static inline function with Py_ALWAYS_INLINE can result in worse performances (due to increased code size for example). The compiler is usually smarter than the developer for the cost/benefit analysis."
msgstr "علامتگذاری کورکورانهی یک تابع ایستای درونخطی (static inline) با Py_ALWAYS_INLINE میتواند به عملکرد بدتری منجر شود (برای مثال، به دلیل افزایش حجم کد). کامپایلر معمولاً در تحلیل هزینه/فایده از توسعهدهنده هوشمندتر است."
msgid "If Python is :ref:`built in debug mode <debug-build>` (if the :c:macro:`Py_DEBUG` macro is defined), the :c:macro:`Py_ALWAYS_INLINE` macro does nothing."
msgstr "اگر پایتون :ref:`در حالت اشکالزدایی ساختهشده باشد <debug-build>` (اگر ماکروی :c:macro:`Py_DEBUG` تعریفشده باشد)، ماکروی :c:macro:`Py_ALWAYS_INLINE` هیچ کاری انجام نمیدهد."
msgid "It must be specified before the function return type. Usage::"
msgstr "آن باید پیش از نوع بازگشتی تابع مشخص شود. کاربرد::"
msgid "static inline Py_ALWAYS_INLINE int random(void) { return 4; }"
msgstr "static inline Py_ALWAYS_INLINE int random(void) { return 4; }"
msgid "Disable inlining on a function. For example, it reduces the C stack consumption: useful on LTO+PGO builds which heavily inline code (see :issue:`33720`)."
msgstr "درونخطیسازی (inlining) را روی یک تابع غیرفعال میکند. برای مثال، مصرف پشتهی C را کاهش میدهد: در ساختهای LTO+PGO که کد را بهشدت درونخطی میکنند، مفید است (نگاه کنید به :issue:`33720`)."
msgid "Corresponds to the ``noinline`` attribute/specification on GCC and MSVC."
msgstr "معادل ویژگی/مشخصهی ``noinline`` در GCC و MSVC است."
msgid "Usage::"
msgstr "کاربرد::"
msgid "Py_NO_INLINE static int random(void) { return 4; }"
msgstr "Py_NO_INLINE static int random(void) { return 4; }"
msgid "Use this to declare APIs that were deprecated in a specific CPython version. The macro must be placed before the symbol name."
msgstr "از این برای اعلام APIهایی که در نسخهی مشخصی از سیپایتون منسوخ شدهاند، استفاده کنید. ماکرو باید پیش از نام نماد قرار گیرد."
msgid "Py_DEPRECATED(3.8) PyAPI_FUNC(int) Py_OldFunction(void);"
msgstr "Py_DEPRECATED(3.8) PyAPI_FUNC(int) Py_OldFunction(void);"
msgid "MSVC support was added."
msgstr "پشتیبانی از MSVC اضافه شد."
msgid "Declare a function returning the specified *type* using a fast-calling qualifier for functions that are local to the current file. Semantically, this is equivalent to :samp:`static {type}`."
msgstr "برای توابعی که محلی به پرونده جاری هستند، تابعی را که *نوع* مشخصشده را برمیگرداند، با استفاده از مشخصکننده فراخوانی سریع (fast-calling qualifier) اعلان میکند. از نظر معنایی، این معادل :samp:`static {type}` است."
msgid "Equivalent to :c:macro:`Py_LOCAL` but additionally requests the function be inlined."
msgstr "معادل :c:macro:`Py_LOCAL` است، اما علاوه بر آن درخواست میکند که تابع بهصورت درونخطی شود."
msgid "Macro used to declare a symbol as local to the shared library (hidden). On supported platforms, it ensures the symbol is not exported."
msgstr "ماکرویی که برای اعلام نماد بهعنوان محلیِ کتابخانه اشتراکی (مخفی) استفاده میشود. در پلتفرمهای پشتیبانیشده، تضمین میکند که نماد اکسپورت نشود."
msgid "On compatible versions of GCC/Clang, it expands to ``__attribute__((visibility(\"hidden\")))``."
msgstr "در نسخههای سازگار GCC/Clang، این به ``__attribute__((visibility(\"hidden\")))`` بسط مییابد."
msgid "Macro used to declare a symbol (function or data) as exported. On Windows, this expands to ``__declspec(dllexport)``. On compatible versions of GCC/Clang, it expands to ``__attribute__((visibility(\"default\")))``. This macro is for defining the C API itself; extension modules should not use it."
msgstr "ماکرویی که برای اعلام یک نماد (تابع یا داده) بهعنوان اکسپورتشده به کار میرود. در ویندوز، این ماکرو به ``__declspec(dllexport)`` بسط مییابد. در نسخههای سازگار GCC/Clang، به ``__attribute__((visibility(\"default\")))`` بسط مییابد. این ماکرو برای تعریف خودِ C API است؛ ماژولهای توسعهای نباید از آن استفاده کنند."
msgid "Macro used to declare a symbol as imported. On Windows, this expands to ``__declspec(dllimport)``. This macro is for defining the C API itself; extension modules should not use it."
msgstr "ماکرویی که برای اعلام یک نماد بهعنوان ایمپورتشده به کار میرود. در ویندوز، این ماکرو به ``__declspec(dllimport)`` بسط مییابد. این ماکرو برای تعریف خودِ C API است؛ ماژولهای توسعهای نباید از آن استفاده کنند."
msgid "Macro used by CPython to declare a function as part of the C API. Its expansion depends on the platform and build configuration. This macro is intended for defining CPython's C API itself; extension modules should not use it for their own symbols."
msgstr "ماکرویی که توسط سیپایتون برای اعلان یک تابع بهعنوان بخشی از C API استفاده میشود. بسط آن به پلتفرم و پیکربندی ساخت بستگی دارد. این ماکرو برای تعریف خودِ C API سیپایتون در نظر گرفتهشده است؛ ماژولهای توسعهای نباید از آن برای نمادهای خودشان استفاده کنند."
msgid "Macro used by CPython to declare a public global variable as part of the C API. Its expansion depends on the platform and build configuration. This macro is intended for defining CPython's C API itself; extension modules should not use it for their own symbols."
msgstr "ماکرویی که توسط سیپایتون برای اعلان یک متغیر سراسری عمومی بهعنوان بخشی از C API استفاده میشود. بسط آن به پلتفرم و پیکربندی ساخت بستگی دارد. این ماکرو برای تعریف خودِ C API سیپایتون در نظر گرفته شده است؛ ماژولهای توسعهای نباید از آن برای نمادهای خودشان استفاده کنند."
msgid "Outdated macros"
msgstr "ماکروهای منسوخ"
msgid "The following macros have been used to features that have been standardized in C11."
msgstr "از ماکروهای زیر برای ویژگیهایی که در C11 استاندارد شدهاند استفاده شده است."
msgid "Specify alignment to *num* bytes on compilers that support it."
msgstr "در کامپایلرهایی که از آن پشتیبانی میکنند، همترازی را به *num* بایت مشخص کنید."
msgid "Consider using the C11 standard ``_Alignas`` specifier over this macro."
msgstr "استفاده از مشخصکنندهی ``_Alignas`` استاندارد C11 را به جای این ماکرو در نظر بگیرید."
msgid "Use *number* as a ``long long`` or ``unsigned long long`` integer literal, respectively."
msgstr "از *number* به ترتیب به عنوان لفظی عدد صحیح ``long long`` یا ``unsigned long long`` استفاده کنید."
msgid "Expands to *number* followed by ``LL`` or ``LLU``, respectively, but will expand to some compiler-specific suffixes on some older compilers."
msgstr "به *number* و به ترتیب پس از آن ``LL`` یا ``LLU`` گسترش مییابد، اما در برخی کامپایلرهای قدیمیتر به برخی پسوندهای خاص کامپایلر گسترش مییابد."
msgid "Consider using the C99 standard suffixes ``LL`` and ``LLU`` directly."
msgstr "در نظر بگیرید که مستقیماً از پسوندهای استاندارد C99 یعنی ``LL`` و ``LLU`` استفاده کنید."
msgid "This is an alias to :c:func:`!memcpy`."
msgstr "این یک نام مستعار برای :c:func:`!memcpy` است."
msgid "Use :c:func:`!memcpy` directly instead."
msgstr "بهجای آن، مستقیماً از :c:func:`!memcpy` استفاده کنید."
msgid "This is an alias to the C99-standard ``va_copy`` function."
msgstr "این یک ناممستعار برای تابع ``va_copy`` مطابق با استاندارد C99 است."
msgid "Historically, this would use a compiler-specific method to copy a ``va_list``."
msgstr "از نظر تاریخی، این کار از روشی وابسته به کامپایلر برای کپی کردن ``va_list`` استفاده میکرد."
msgid "This is now an alias to ``va_copy``."
msgstr "این اکنون یک نام مستعار برای ``va_copy`` است."
msgid "Objects, Types and Reference Counts"
msgstr "شیءها، نوعها و شمارش ارجاع"
msgid "Most Python/C API functions have one or more arguments as well as a return value of type :c:expr:`PyObject*`. This type is a pointer to an opaque data type representing an arbitrary Python object. Since all Python object types are treated the same way by the Python language in most situations (e.g., assignments, scope rules, and argument passing), it is only fitting that they should be represented by a single C type. Almost all Python objects live on the heap: you never declare an automatic or static variable of type :c:type:`PyObject`, only pointer variables of type :c:expr:`PyObject*` can be declared. The sole exception are the type objects; since these must never be deallocated, they are typically static :c:type:`PyTypeObject` objects."
msgstr "بیشتر توابع Python/C API یک یا چند آرگومان و همچنین مقدار بازگشتیای از نوع :c:expr:`PyObject*` دارند. این نوع، اشارهگر به یک نوع دادهی مبهم است که نمایانگر یک شیء پایتونی دلخواه است. از آنجا که زبان پایتون در بیشتر موقعیتها (مانند انتسابها، قواعد محدوده و ارسال آرگومان) با همهی نوعهای شیء پایتون به یک شکل رفتار میکند، بجاست که همهی آنها با یک نوع C واحد نمایش داده شوند. تقریباً همهی اشیای پایتون روی هیپ قرار دارند: شما هرگز متغیر خودکار یا ایستایی از نوع :c:type:`PyObject` تعریف نمیکنید؛ تنها متغیرهای اشارهگر از نوع :c:expr:`PyObject*` را میتوان تعریف کرد. تنها استثنا اشیای نوع هستند؛ از آنجا که این اشیا هرگز نباید آزادسازی شوند، معمولاً اشیای ایستای :c:type:`PyTypeObject` هستند."
msgid "All Python objects (even Python integers) have a :dfn:`type` and a :dfn:`reference count`. An object's type determines what kind of object it is (e.g., an integer, a list, or a user-defined function; there are many more as explained in :ref:`types`). For each of the well-known types there is a macro to check whether an object is of that type; for instance, ``PyList_Check(a)`` is true if (and only if) the object pointed to by *a* is a Python list."
msgstr "همهی اشیاء پایتون (حتی اعداد صحیح پایتون) یک :dfn:`نوع (type)` و یک :dfn:`شمارش ارجاع (reference count)` دارند. نوع یک شیء تعیین میکند که آن شیء از چه نوعی است (مثلاً یک عدد صحیح، یک فهرست یا یک تابع تعریفشده توسط کاربر؛ انواع بسیار بیشتری نیز وجود دارند که در :ref:`types` توضیح دادهشدهاند). برای هر یک از انواع شناختهشده، یک ماکرو وجود دارد که بررسی میکند آیا یک شیء از آن نوع است یا خیر؛ برای مثال، ``PyList_Check(a)`` درست است اگر (و تنها اگر) شیئی که *a* به آن اشاره میکند، یک فهرست پایتون باشد."
msgid "Reference Counts"
msgstr "شمارش ارجاع"
msgid "The reference count is important because today's computers have a finite (and often severely limited) memory size; it counts how many different places there are that have a :term:`strong reference` to an object. Such a place could be another object, or a global (or static) C variable, or a local variable in some C function. When the last :term:`strong reference` to an object is released (i.e. its reference count becomes zero), the object is deallocated. If it contains references to other objects, those references are released. Those other objects may be deallocated in turn, if there are no more references to them, and so on. (There's an obvious problem with objects that reference each other here; for now, the solution is \"don't do that.\")"
msgstr "شمارش ارجاع مهم است زیرا رایانههای امروزی اندازهی حافظهی محدودی (و اغلب بهشدت محدود) دارند؛ این شمارش، تعداد مکانهای مختلفی را میشمارد که :term:`ارجاع قوی <strong reference>` به یک شیء دارند. چنین مکانی میتواند یک شیء دیگر، یا یک متغیر سراسری (یا ایستا) در C، یا یک متغیر محلی در تابعی به زبان C باشد. وقتی آخرین :term:`ارجاع قوی <strong reference>` به یک شیء آزاد شود (یعنی شمارش ارجاع آن به صفر برسد)، آن شیء تخصیصزدایی میشود. اگر آن شیء شامل ارجاعهایی به اشیاء دیگر باشد، آن ارجاعها آزاد میشوند. آن اشیاء دیگر نیز ممکن است به نوبت خود تخصیصزدایی شوند، اگر ارجاع دیگری به آنها وجود نداشته باشد، و به همین ترتیب. (در اینجا یک مشکل آشکار با اشیائی که به یکدیگر ارجاع دارند وجود دارد؛ فعلاً راهحل این است: «این کار را نکنید.»)"
msgid "Reference counts are always manipulated explicitly. The normal way is to use the macro :c:func:`Py_INCREF` to take a new reference to an object (i.e. increment its reference count by one), and :c:func:`Py_DECREF` to release that reference (i.e. decrement the reference count by one). The :c:func:`Py_DECREF` macro is considerably more complex than the incref one, since it must check whether the reference count becomes zero and then cause the object's deallocator to be called. The deallocator is a function pointer contained in the object's type structure. The type-specific deallocator takes care of releasing references for other objects contained in the object if this is a compound object type, such as a list, as well as performing any additional finalization that's needed. There's no chance that the reference count can overflow; at least as many bits are used to hold the reference count as there are distinct memory locations in virtual memory (assuming ``sizeof(Py_ssize_t) >= sizeof(void*)``). Thus, the reference count increment is a simple operation."
msgstr "شمارش ارجاع همیشه بهطور صریح دستکاری میشود. روش معمول این است که از ماکرو :c:func:`Py_INCREF` برای گرفتن ارجاعی جدید به یک شیء (یعنی شمارش ارجاع آن یکی افزایش مییابد) و از :c:func:`Py_DECREF` برای آزاد کردن آن ارجاع (یعنی شمارش ارجاع یکی کاهش مییابد) استفاده شود. ماکرو :c:func:`Py_DECREF` بهمراتب پیچیدهتر از ماکرو incref است، زیرا باید بررسی کند که آیا شمارش ارجاع به صفر میرسد و سپس باعث شود آزادساز حافظهی شیء فراخوانی شود. آزادساز حافظه، اشارهگری به تابع است که در ساختار نوع شیء قرار دارد. آزادساز حافظه مخصوص هر نوع، اگر نوع مربوطه یک نوع شیء مرکب مانند فهرست باشد، آزاد کردن ارجاعهای مربوط به سایر اشیاء موجود در شیء را بر عهده دارد و همچنین هرگونه نهاییسازی اضافی لازم را انجام میدهد. هیچ احتمالی وجود ندارد که شمارش ارجاع سرریز کند؛ برای نگهداشتن شمارش ارجاع، دستکم بهاندازهی تعداد مکانهای متمایز حافظه در حافظهی مجازی بیت استفاده میشود (با فرض ``sizeof(Py_ssize_t) >= sizeof(void*)``). بنابراین، افزایش شمارش ارجاع یک عملیات ساده است."
msgid "It is not necessary to hold a :term:`strong reference` (i.e. increment the reference count) for every local variable that contains a pointer to an object. In theory, the object's reference count goes up by one when the variable is made to point to it and it goes down by one when the variable goes out of scope. However, these two cancel each other out, so at the end the reference count hasn't changed. The only real reason to use the reference count is to prevent the object from being deallocated as long as our variable is pointing to it. If we know that there is at least one other reference to the object that lives at least as long as our variable, there is no need to take a new :term:`strong reference` (i.e. increment the reference count) temporarily. An important situation where this arises is in objects that are passed as arguments to C functions in an extension module that are called from Python; the call mechanism guarantees to hold a reference to every argument for the duration of the call."
msgstr "لازم نیست برای هر متغیر محلی که حاوی اشارهگری به یک شیء است، یک :term:`strong reference` (یعنی افزایش دادن شمارش ارجاع) نگه دارید. از نظر تئوری، شمارش ارجاع شیء هنگامی که متغیر به آن اشاره میکند، یک واحد افزایش مییابد و هنگامی که متغیر از محدوده خارج میشود، یک واحد کاهش مییابد. اما این دو، اثر یکدیگر را خنثی میکنند، بنابراین در نهایت شمارش ارجاع تغییری نکرده است. تنها دلیل واقعی برای استفاده از شمارش ارجاع، جلوگیری از آزاد شدن شیء در طول مدتی است که متغیر ما به آن اشاره میکند. اگر بدانیم که حداقل یک ارجاع دیگر به شیء وجود دارد که دستکم به اندازهی متغیر ما عمر میکند، نیازی نیست موقتاً یک :term:`strong reference` جدید (یعنی افزایش دادن شمارش ارجاع) بگیریم. یک موقعیت مهم که این موضوع در آن پیش میآید، هنگامی است که اشیایی بهعنوان آرگومان به توابع C در یک ماژول توسعهای که از پایتون فراخوانی میشوند، پاس داده میشوند؛ سازوکار فراخوانی تضمین میکند که در طول مدت فراخوانی، به هر آرگومان ارجاعی نگه دارد."
msgid "However, a common pitfall is to extract an object from a list and hold on to it for a while without taking a new reference. Some other operation might conceivably remove the object from the list, releasing that reference, and possibly deallocating it. The real danger is that innocent-looking operations may invoke arbitrary Python code which could do this; there is a code path which allows control to flow back to the user from a :c:func:`Py_DECREF`, so almost any operation is potentially dangerous."
msgstr "با این حال، یک دام رایج این است که شیئی را از یک فهرست استخراج کنید و برای مدتی آن را نگه دارید، بدون اینکه ارجاع جدیدی بگیرید. ممکن است عملیات دیگری شیء را از فهرست حذف کند، آن ارجاع را آزاد کند و شاید حافظهی آن را آزادسازی کند. خطر واقعی این است که عملیاتهای بهظاهر بیضرر ممکن است کد دلخواه پایتون را فراخوانی کنند که بتواند این کار را انجام دهد؛ مسیری در کد وجود دارد که اجازه میدهد کنترل از :c:func:`Py_DECREF` به کاربر بازگردد، بنابراین تقریباً هر عملیاتی بهطور بالقوه خطرناک است."
msgid "A safe approach is to always use the generic operations (functions whose name begins with ``PyObject_``, ``PyNumber_``, ``PySequence_`` or ``PyMapping_``). These operations always create a new :term:`strong reference` (i.e. increment the reference count) of the object they return. This leaves the caller with the responsibility to call :c:func:`Py_DECREF` when they are done with the result; this soon becomes second nature."
msgstr "یک رویکرد امن این است که همیشه از عملیات عام استفاده کنید (توابعی که نامشان با ``PyObject_``، ``PyNumber_``، ``PySequence_`` یا ``PyMapping_`` آغاز میشود). این عملیاتها همیشه یک :term:`ارجاع قوی <strong reference>` جدید (یعنی شمارش ارجاع را افزایش میدهند) برای شیءای که برمیگردانند ایجاد میکنند. این امر مسئولیت فراخوانی :c:func:`Py_DECREF` را پس از پایان کار با نتیجه بر عهدهی فراخوانکننده میگذارد؛ این کار بهزودی به عادت دوم تبدیل میشود."
msgid "Reference Count Details"
msgstr "جزئیات شمارش ارجاع"
msgid "The reference count behavior of functions in the Python/C API is best explained in terms of *ownership of references*. Ownership pertains to references, never to objects (objects are not owned: they are always shared). \"Owning a reference\" means being responsible for calling Py_DECREF on it when the reference is no longer needed. Ownership can also be transferred, meaning that the code that receives ownership of the reference then becomes responsible for eventually releasing it by calling :c:func:`Py_DECREF` or :c:func:`Py_XDECREF` when it's no longer needed---or passing on this responsibility (usually to its caller). When a function passes ownership of a reference on to its caller, the caller is said to receive a *new* reference. When no ownership is transferred, the caller is said to *borrow* the reference. Nothing needs to be done for a :term:`borrowed reference`."
msgstr "رفتار شمارش ارجاع توابع در Python/C API به بهترین وجه بر حسب *مالکیت ارجاعها* توضیح داده میشود. مالکیت به ارجاعها مربوط است، هرگز به اشیاء (اشیاء در مالکیت کسی نیستند: آنها همیشه مشترکاند). «مالک بودن یک ارجاع» به این معناست که مسئول فراخواندن Py_DECREF روی آن هستید وقتی که دیگر به آن ارجاع نیازی نیست. مالکیت همچنین میتواند منتقل شود، به این معنا که کدی که مالکیت ارجاع را دریافت میکند، از آن پس مسئول خواهد بود که سرانجام آن را با فراخوانی :c:func:`Py_DECREF` یا :c:func:`Py_XDECREF` وقتی دیگر مورد نیاز نیست آزاد کند---یا این مسئولیت را (معمولاً به فراخوانکننده خود) واگذار کند. وقتی تابعی مالکیت یک ارجاع را به فراخوانکننده خود منتقل میکند، گفته میشود فراخوانکننده ارجاع *جدید* دریافت کرده است. وقتی هیچ مالکیتی منتقل نمیشود، گفته میشود فراخوانکننده ارجاع را *امانت* گرفته است. برای :term:`borrowed reference` هیچ کاری لازم نیست انجام شود."
msgid "Conversely, when a calling function passes in a reference to an object, there are two possibilities: the function *steals* a reference to the object, or it does not."
msgstr "برعکس، وقتی یک تابع فراخواننده ارجاعی به یک شیء را ارسال میکند، دو احتمال وجود دارد: تابع ارجاعی به آن شیء را *میدزدد*، یا نمیدزدد."
msgid "*Stealing a reference* means that when you pass a reference to a function, that function assumes that it now owns that reference. Since the new owner can use :c:func:`!Py_DECREF` at its discretion, you (the caller) must not use that reference after the call."
msgstr "*دزدیدن ارجاع* به این معناست که وقتی ارجاعی را به تابعی پاس میدهید، آن تابع فرض میکند که اکنون مالک آن ارجاع است. از آنجا که مالک جدید میتواند به صلاحدید خود از :c:func:`!Py_DECREF` استفاده کند، شما (فراخواننده) نباید پس از فراخوانی از آن ارجاع استفاده کنید."
msgid "Few functions steal references; the two notable exceptions are :c:func:`PyList_SetItem` and :c:func:`PyTuple_SetItem`, which steal a reference to the item (but not to the tuple or list into which the item is put!). These functions were designed to steal a reference because of a common idiom for populating a tuple or list with newly created objects; for example, the code to create the tuple ``(1, 2, \"three\")`` could look like this (forgetting about error handling for the moment; a better way to code this is shown below)::"
msgstr "تعداد کمی از توابع ارجاع میدزدند؛ دو استثنای قابلتوجه :c:func:`PyList_SetItem` و :c:func:`PyTuple_SetItem` هستند که ارجاع به آیتم را میدزدند (اما نه ارجاع به تاپل یا فهرستی که آیتم در آن قرار میگیرد!). این توابع به دلیل یک الگوی رایج برای پر کردن تاپل یا فهرست با اشیاء تازهایجادشده، به گونهای طراحی شدهاند که ارجاعی را بدزدند؛ برای مثال، کد ایجاد تاپل ``(1, 2, \"three\")`` میتواند چیزی شبیه این باشد (فعلاً از مدیریت خطا صرفنظر کنید؛ روش بهتری برای کدنویسی این مورد در ادامه نشان داده شده است)::"
msgid ""
"PyObject *t;\n"
"\n"
"t = PyTuple_New(3);\n"
"PyTuple_SetItem(t, 0, PyLong_FromLong(1L));\n"
"PyTuple_SetItem(t, 1, PyLong_FromLong(2L));\n"
"PyTuple_SetItem(t, 2, PyUnicode_FromString(\"three\"));"
msgstr ""
"PyObject *t;\n"
"\n"
"t = PyTuple_New(3);\n"
"PyTuple_SetItem(t, 0, PyLong_FromLong(1L));\n"
"PyTuple_SetItem(t, 1, PyLong_FromLong(2L));\n"
"PyTuple_SetItem(t, 2, PyUnicode_FromString(\"three\"));"
msgid "Here, :c:func:`PyLong_FromLong` returns a new reference which is immediately stolen by :c:func:`PyTuple_SetItem`. When you want to keep using an object although the reference to it will be stolen, use :c:func:`Py_INCREF` to grab another reference before calling the reference-stealing function."
msgstr "در اینجا، :c:func:`PyLong_FromLong` ارجاع جدیدی برمیگرداند که بلافاصله توسط :c:func:`PyTuple_SetItem` دزدیده میشود. هرگاه بخواهید با اینکه ارجاع به یک شیء دزدیده خواهد شد، همچنان از آن استفاده کنید، پیش از فراخوانی تابع دزدندهی ارجاع، از :c:func:`Py_INCREF` برای گرفتن ارجاع دیگری استفاده کنید."
msgid "Incidentally, :c:func:`PyTuple_SetItem` is the *only* way to set tuple items; :c:func:`PySequence_SetItem` and :c:func:`PyObject_SetItem` refuse to do this since tuples are an immutable data type. You should only use :c:func:`PyTuple_SetItem` for tuples that you are creating yourself."
msgstr "ضمناً، :c:func:`PyTuple_SetItem` *تنها* راه تنظیم آیتمهای تاپل است؛ :c:func:`PySequence_SetItem` و :c:func:`PyObject_SetItem` از انجام این کار امتناع میورزند، زیرا تاپلها نوع دادهای تغییرناپذیر هستند. شما باید :c:func:`PyTuple_SetItem` را تنها برای تاپلهایی که خودتان ایجاد میکنید استفاده کنید."
msgid "Equivalent code for populating a list can be written using :c:func:`PyList_New` and :c:func:`PyList_SetItem`."
msgstr "میتوان کد معادل برای پر کردن یک فهرست را با استفاده از :c:func:`PyList_New` و :c:func:`PyList_SetItem` نوشت."
msgid "However, in practice, you will rarely use these ways of creating and populating a tuple or list. There's a generic function, :c:func:`Py_BuildValue`, that can create most common objects from C values, directed by a :dfn:`format string`. For example, the above two blocks of code could be replaced by the following (which also takes care of the error checking)::"
msgstr "با این حال، در عمل، شما بهندرت از این روشها برای ایجاد و پر کردن یک تاپل یا فهرست استفاده خواهید کرد. یک تابع عام وجود دارد، :c:func:`Py_BuildValue`، که میتواند با هدایت یک :dfn:`رشته قالب (format string)`، بیشتر اشیاء رایج را از مقادیر C ایجاد کند. برای مثال، دو بلوک کد بالا را میتوان با کد زیر جایگزین کرد (که بررسی خطا را نیز انجام میدهد)::"
msgid ""
"PyObject *tuple, *list;\n"
"\n"
"tuple = Py_BuildValue(\"(iis)\", 1, 2, \"three\");\n"
"list = Py_BuildValue(\"[iis]\", 1, 2, \"three\");"
msgstr ""
"PyObject *tuple, *list;\n"
"\n"
"tuple = Py_BuildValue(\"(iis)\", 1, 2, \"three\");\n"
"list = Py_BuildValue(\"[iis]\", 1, 2, \"three\");"
msgid "It is much more common to use :c:func:`PyObject_SetItem` and friends with items whose references you are only borrowing, like arguments that were passed in to the function you are writing. In that case, their behaviour regarding references is much saner, since you don't have to take a new reference just so you can give that reference away (\"have it be stolen\"). For example, this function sets all items of a list (actually, any mutable sequence) to a given item::"
msgstr "بسیار رایجتر است که از :c:func:`PyObject_SetItem` و توابع مشابه آن با آیتمهایی استفاده کنید که ارجاعهایشان را صرفاً به امانت دارید، مانند آرگومانهایی که به تابعی که در حال نوشتن آن هستید ارسال شدهاند. در چنین حالتی، رفتار این توابع در مورد ارجاعها بسیار منطقیتر است، زیرا لازم نیست صرفاً برای اینکه بتوانید آن ارجاع را واگذار کنید (بگذارید آن «دزدیده» شود)، ارجاع جدیدی بگیرید. برای مثال، این تابع همهی آیتمهای یک فهرست (در واقع، هر دنبالهی تغییرپذیری) را برابر یک آیتم دادهشده قرار میدهد::"
msgid ""
"int\n"
"set_all(PyObject *target, PyObject *item)\n"
"{\n"
" Py_ssize_t i, n;\n"
"\n"
" n = PyObject_Length(target);\n"
" if (n < 0)\n"
" return -1;\n"
" for (i = 0; i < n; i++) {\n"
" PyObject *index = PyLong_FromSsize_t(i);\n"
" if (!index)\n"
" return -1;\n"
" if (PyObject_SetItem(target, index, item) < 0) {\n"
" Py_DECREF(index);\n"
" return -1;\n"
" }\n"
" Py_DECREF(index);\n"
" }\n"
" return 0;\n"
"}"
msgstr ""
"int\n"
"set_all(PyObject *target, PyObject *item)\n"
"{\n"
" Py_ssize_t i, n;\n"
"\n"
" n = PyObject_Length(target);\n"
" if (n < 0)\n"
" return -1;\n"
" for (i = 0; i < n; i++) {\n"
" PyObject *index = PyLong_FromSsize_t(i);\n"
" if (!index)\n"
" return -1;\n"
" if (PyObject_SetItem(target, index, item) < 0) {\n"
" Py_DECREF(index);\n"
" return -1;\n"
" }\n"
" Py_DECREF(index);\n"
" }\n"
" return 0;\n"
"}"
msgid "The situation is slightly different for function return values. While passing a reference to most functions does not change your ownership responsibilities for that reference, many functions that return a reference to an object give you ownership of the reference. The reason is simple: in many cases, the returned object is created on the fly, and the reference you get is the only reference to the object. Therefore, the generic functions that return object references, like :c:func:`PyObject_GetItem` and :c:func:`PySequence_GetItem`, always return a new reference (the caller becomes the owner of the reference)."
msgstr "وضعیت برای مقادیر بازگشتی توابع کمی متفاوت است. در حالی که گذراندن ارجاع به بیشتر توابع، مسئولیتهای مالکیت شما نسبت به آن ارجاع را تغییر نمیدهد، بسیاری از توابعی که ارجاعی به یک شیء را برمیگردانند، مالکیت آن ارجاع را به شما میدهند. دلیل این امر ساده است: در بسیاری از موارد، شیء بازگرداندهشده در لحظه ایجاد میشود و ارجاعی که دریافت میکنید تنها ارجاع به آن شیء است. بنابراین، توابع عمومیای که ارجاعهای شیء را برمیگردانند، مانند :c:func:`PyObject_GetItem` و :c:func:`PySequence_GetItem`، همیشه یک ارجاع جدید برمیگردانند (فراخوانکننده مالک ارجاع میشود)."
msgid "It is important to realize that whether you own a reference returned by a function depends on which function you call only --- *the plumage* (the type of the object passed as an argument to the function) *doesn't enter into it!* Thus, if you extract an item from a list using :c:func:`PyList_GetItem`, you don't own the reference --- but if you obtain the same item from the same list using :c:func:`PySequence_GetItem` (which happens to take exactly the same arguments), you do own a reference to the returned object."
msgstr "مهم است بدانید که اینکه شما مالک ارجاعی هستید که یک تابع برمیگرداند یا نه، تنها به تابعی که فراخوانی میکنید بستگی دارد --- *پر و بال* (نوع شیئی که بهعنوان آرگومان به تابع داده میشود) *در این میان نقشی ندارد!* بنابراین، اگر آیتمی را از یک فهرست با استفاده از :c:func:`PyList_GetItem` استخراج کنید، مالک ارجاع نیستید --- اما اگر همان آیتم را از همان فهرست با استفاده از :c:func:`PySequence_GetItem` (که اتفاقاً دقیقاً همان آرگومانها را میگیرد) به دست آورید، مالک ارجاعی به شیء برگرداندهشده هستید."
msgid "Here is an example of how you could write a function that computes the sum of the items in a list of integers; once using :c:func:`PyList_GetItem`, and once using :c:func:`PySequence_GetItem`. ::"
msgstr "در اینجا مثالی از نحوهی نوشتن تابعی که مجموع آیتمهای فهرستی از اعداد صحیح را محاسبه میکند آورده شده است؛ یک بار با استفاده از :c:func:`PyList_GetItem` و یک بار با استفاده از :c:func:`PySequence_GetItem`. ::"
msgid ""
"long\n"
"sum_list(PyObject *list)\n"
"{\n"
" Py_ssize_t i, n;\n"
" long total = 0, value;\n"
" PyObject *item;\n"
"\n"
" n = PyList_Size(list);\n"
" if (n < 0)\n"
" return -1; /* Not a list */\n"
" for (i = 0; i < n; i++) {\n"
" item = PyList_GetItem(list, i); /* Can't fail */\n"
" if (!PyLong_Check(item)) continue; /* Skip non-integers */\n"
" value = PyLong_AsLong(item);\n"
" if (value == -1 && PyErr_Occurred())\n"
" /* Integer too big to fit in a C long, bail out */\n"
" return -1;\n"
" total += value;\n"
" }\n"
" return total;\n"
"}"
msgstr ""
"long\n"
"sum_list(PyObject *list)\n"
"{\n"
" Py_ssize_t i, n;\n"
" long total = 0, value;\n"
" PyObject *item;\n"
"\n"
" n = PyList_Size(list);\n"
" if (n < 0)\n"
" return -1; /* Not a list */\n"
" for (i = 0; i < n; i++) {\n"
" item = PyList_GetItem(list, i); /* Can't fail */\n"
" if (!PyLong_Check(item)) continue; /* Skip non-integers */\n"
" value = PyLong_AsLong(item);\n"
" if (value == -1 && PyErr_Occurred())\n"
" /* Integer too big to fit in a C long, bail out */\n"
" return -1;\n"
" total += value;\n"
" }\n"
" return total;\n"
"}"
msgid ""
"long\n"
"sum_sequence(PyObject *sequence)\n"
"{\n"
" Py_ssize_t i, n;\n"
" long total = 0, value;\n"
" PyObject *item;\n"
" n = PySequence_Length(sequence);\n"
" if (n < 0)\n"
" return -1; /* Has no length */\n"
" for (i = 0; i < n; i++) {\n"
" item = PySequence_GetItem(sequence, i);\n"
" if (item == NULL)\n"
" return -1; /* Not a sequence, or other failure */\n"
" if (PyLong_Check(item)) {\n"
" value = PyLong_AsLong(item);\n"
" Py_DECREF(item);\n"
" if (value == -1 && PyErr_Occurred())\n"
" /* Integer too big to fit in a C long, bail out */\n"
" return -1;\n"
" total += value;\n"
" }\n"
" else {\n"
" Py_DECREF(item); /* Discard reference ownership */\n"
" }\n"
" }\n"
" return total;\n"
"}"
msgstr ""
"long\n"
"sum_sequence(PyObject *sequence)\n"
"{\n"
" Py_ssize_t i, n;\n"
" long total = 0, value;\n"
" PyObject *item;\n"
" n = PySequence_Length(sequence);\n"
" if (n < 0)\n"
" return -1; /* Has no length */\n"
" for (i = 0; i < n; i++) {\n"
" item = PySequence_GetItem(sequence, i);\n"
" if (item == NULL)\n"
" return -1; /* Not a sequence, or other failure */\n"
" if (PyLong_Check(item)) {\n"
" value = PyLong_AsLong(item);\n"
" Py_DECREF(item);\n"
" if (value == -1 && PyErr_Occurred())\n"
" /* Integer too big to fit in a C long, bail out */\n"
" return -1;\n"
" total += value;\n"
" }\n"
" else {\n"
" Py_DECREF(item); /* Discard reference ownership */\n"
" }\n"
" }\n"
" return total;\n"
"}"
msgid "Types"
msgstr "نوعها"
msgid "There are few other data types that play a significant role in the Python/C API; most are simple C types such as :c:expr:`int`, :c:expr:`long`, :c:expr:`double` and :c:expr:`char*`. A few structure types are used to describe static tables used to list the functions exported by a module or the data attributes of a new object type, and another is used to describe the value of a complex number. These will be discussed together with the functions that use them."
msgstr "چند نوع دادهی دیگر نیز نقش مهمی در Python/C API ایفا میکنند؛ بیشتر آنها نوعهای سادهی C مانند :c:expr:`int`، :c:expr:`long`، :c:expr:`double` و :c:expr:`char*` هستند. چند نوع ساختاری برای توصیف جدولهای ایستایی که توابع اکسپورتشده توسط یک ماژول یا ویژگیهای دادهی یک نوع شیء جدید را فهرست میکنند، به کار میروند، و نوع دیگری برای توصیف مقدار یک عدد مختلط استفاده میشود. این موارد همراه با توابعی که از آنها استفاده میکنند بحث خواهند شد."
msgid "A signed integral type such that ``sizeof(Py_ssize_t) == sizeof(size_t)``. C99 doesn't define such a thing directly (size_t is an unsigned integral type). See :pep:`353` for details. ``PY_SSIZE_T_MAX`` is the largest positive value of type :c:type:`Py_ssize_t`."
msgstr "یک نوع صحیح علامتدار بهگونهای که ``sizeof(Py_ssize_t) == sizeof(size_t)`` باشد. استاندارد C99 چنین چیزی را مستقیماً تعریف نمیکند (size_t یک نوع صحیح بدون علامت است). برای جزئیات به :pep:`353` مراجعه کنید. ``PY_SSIZE_T_MAX`` بزرگترین مقدار مثبت از نوع :c:type:`Py_ssize_t` است."
msgid "Exceptions"
msgstr "استثناها"
msgid "The Python programmer only needs to deal with exceptions if specific error handling is required; unhandled exceptions are automatically propagated to the caller, then to the caller's caller, and so on, until they reach the top-level interpreter, where they are reported to the user accompanied by a stack traceback."
msgstr "برنامهنویس پایتون تنها در صورتی نیاز به رسیدگی به استثناها دارد که مدیریت خطای خاصی لازم باشد؛ استثناهای مدیریتنشده بهطور خودکار به فراخواننده منتشر میشوند، سپس به فراخوانندهی فراخواننده، و به همین ترتیب، تا اینکه به مفسر سطح بالا برسند، جایی که همراه با یک ردگیری پشته به کاربر گزارش میشوند."
msgid "For C programmers, however, error checking always has to be explicit. All functions in the Python/C API can raise exceptions, unless an explicit claim is made otherwise in a function's documentation. In general, when a function encounters an error, it sets an exception, discards any object references that it owns, and returns an error indicator. If not documented otherwise, this indicator is either ``NULL`` or ``-1``, depending on the function's return type. A few functions return a Boolean true/false result, with false indicating an error. Very few functions return no explicit error indicator or have an ambiguous return value, and require explicit testing for errors with :c:func:`PyErr_Occurred`. These exceptions are always explicitly documented."
msgstr "اما برای برنامهنویسان C، بررسی خطا همیشه باید صریح باشد. همهی توابع در Python/C API میتوانند استثنا ایجاد کنند، مگر آنکه در مستندات یک تابع، خلاف آن بهطور صریح ادعا شده باشد. بهطور کلی، وقتی تابعی با خطا مواجه میشود، یک استثنا را تنظیم میکند، ارجاعهای شیءای را که مالک آنهاست دور میریزد و یک نشانگر خطا برمیگرداند. اگر خلاف آن مستند نشده باشد، این نشانگر یا ``NULL`` است یا ``-1``، بسته به نوع بازگشتی تابع. چند تابع نتیجهی بولی درست/غلط برمیگردانند که در آنها مقدار غلط نشاندهندهی خطا است. تعداد بسیار کمی از توابع هیچ نشانگر خطای صریحی برنمیگردانند یا مقدار بازگشتی مبهمی دارند و نیازمند آزمون صریح خطاها با :c:func:`PyErr_Occurred` هستند. این استثناها همیشه بهطور صریح مستند میشوند."
msgid "Exception state is maintained in per-thread storage (this is equivalent to using global storage in an unthreaded application). A thread can be in one of two states: an exception has occurred, or not. The function :c:func:`PyErr_Occurred` can be used to check for this: it returns a borrowed reference to the exception type object when an exception has occurred, and ``NULL`` otherwise. There are a number of functions to set the exception state: :c:func:`PyErr_SetString` is the most common (though not the most general) function to set the exception state, and :c:func:`PyErr_Clear` clears the exception state."
msgstr "وضعیت استثنا در ذخیرهگاه اختصاصی هر نخ نگهداری میشود (این معادل استفاده از ذخیرهگاه سراسری در یک برنامهی بدون نخ است). یک نخ میتواند در یکی از دو وضعیت باشد: استثنایی رخ داده است یا نه. میتوان از تابع :c:func:`PyErr_Occurred` برای بررسی این موضوع استفاده کرد: این تابع هنگامی که استثنایی رخ داده باشد، یک ارجاع امانتی به شیء نوع استثنا برمیگرداند و در غیر این صورت ``NULL`` را برمیگرداند. توابع متعددی برای تنظیم وضعیت استثنا وجود دارند: :c:func:`PyErr_SetString` رایجترین (هرچند نه عامترین) تابع برای تنظیم وضعیت استثنا است و :c:func:`PyErr_Clear` وضعیت استثنا را پاک میکند."
msgid "The full exception state consists of three objects (all of which can be ``NULL``): the exception type, the corresponding exception value, and the traceback. These have the same meanings as the Python result of ``sys.exc_info()``; however, they are not the same: the Python objects represent the last exception being handled by a Python :keyword:`try` ... :keyword:`except` statement, while the C level exception state only exists while an exception is being passed on between C functions until it reaches the Python bytecode interpreter's main loop, which takes care of transferring it to ``sys.exc_info()`` and friends."
msgstr "وضعیت کامل استثنا از سه شیء تشکیل شده است (که هر سه میتوانند ``NULL`` باشند): نوع استثنا، مقدار متناظر استثنا، و ردگیری. اینها همان معانی نتیجهی پایتونی ``sys.exc_info()`` را دارند؛ با این حال، یکسان نیستند: اشیاء پایتونی آخرین استثنایی را نشان میدهند که توسط یک دستور :keyword:`try` ... :keyword:`except` پایتونی در حال مدیریت است، در حالی که وضعیت استثنا در سطح C تنها زمانی وجود دارد که استثنایی بین توابع C در حال انتقال باشد تا اینکه به حلقهی اصلی مفسر بایتکد پایتون برسد؛ حلقهای که کار انتقال آن به ``sys.exc_info()`` و توابع مشابه را بر عهده دارد."
msgid "Note that starting with Python 1.5, the preferred, thread-safe way to access the exception state from Python code is to call the function :func:`sys.exc_info`, which returns the per-thread exception state for Python code. Also, the semantics of both ways to access the exception state have changed so that a function which catches an exception will save and restore its thread's exception state so as to preserve the exception state of its caller. This prevents common bugs in exception handling code caused by an innocent-looking function overwriting the exception being handled; it also reduces the often unwanted lifetime extension for objects that are referenced by the stack frames in the traceback."
msgstr "توجه داشته باشید که از پایتون 1.5 به بعد، روش ترجیحی و نخایمن برای دسترسی به وضعیت استثنا از درون کد پایتون، فراخوانی تابع :func:`sys.exc_info` است که وضعیت استثنای هر نخ را برای کد پایتون برمیگرداند. همچنین، معناشناسی هر دو روش دسترسی به وضعیت استثنا تغییر کرده است، بهطوری که تابعی که استثنایی را میگیرد، وضعیت استثنای نخ خود را ذخیره و بازیابی میکند تا وضعیت استثنای فراخوانندهاش حفظ شود. این امر از اشکالهای رایج در کد مدیریت استثنا که ناشی از بازنویسی استثنای در حال مدیریت توسط تابعی بهظاهر بیآزار هستند جلوگیری میکند؛ همچنین تمدیدِ اغلب ناخواستهی طول عمر اشیایی را که فریمهای پشته در ردگیری به آنها ارجاع میدهند، کاهش میدهد."
msgid "As a general principle, a function that calls another function to perform some task should check whether the called function raised an exception, and if so, pass the exception state on to its caller. It should discard any object references that it owns, and return an error indicator, but it should *not* set another exception --- that would overwrite the exception that was just raised, and lose important information about the exact cause of the error."
msgstr "بهعنوان یک اصل کلی، تابعی که برای انجام کاری تابع دیگری را فراخوانی میکند، باید بررسی کند که آیا تابع فراخوانیشده استثنایی ایجاد کرده است یا خیر، و در این صورت، وضعیت استثنا را به فراخواننده خود منتقل کند. این تابع باید هر ارجاع شیءای را که مالک آن است دور بریزد و یک نشانگر خطا برگرداند، اما *نباید* استثنای دیگری تنظیم کند --- زیرا این کار باعث میشد که استثنایی که بهتازگی ایجاد شده بازنویسی شود و اطلاعات مهمی دربارهی علت دقیق خطا از دست برود."
msgid "A simple example of detecting exceptions and passing them on is shown in the :c:func:`!sum_sequence` example above. It so happens that this example doesn't need to clean up any owned references when it detects an error. The following example function shows some error cleanup. First, to remind you why you like Python, we show the equivalent Python code::"
msgstr "یک مثال ساده از تشخیص استثناها و عبور دادن آنها در مثال :c:func:`!sum_sequence` بالا نشان دادهشده است. اتفاقاً این مثال هنگام تشخیص خطا نیازی به پاکسازی هیچیک از ارجاعهای مالکیتشده ندارد. تابع مثال زیر مقداری پاکسازی خطا را نشان میدهد. ابتدا، برای یادآوری اینکه چرا پایتون را دوست دارید، کد معادل پایتون را نشان میدهیم::"
msgid ""
"def incr_item(dict, key):\n"
" try:\n"
" item = dict[key]\n"
" except KeyError:\n"
" item = 0\n"
" dict[key] = item + 1"
msgstr ""
"def incr_item(dict, key):\n"
" try:\n"
" item = dict[key]\n"
" except KeyError:\n"
" item = 0\n"
" dict[key] = item + 1"
msgid "Here is the corresponding C code, in all its glory::"
msgstr "در اینجا کد C مربوطه، در تمام شکوهش، آمده است::"
msgid ""
"int\n"
"incr_item(PyObject *dict, PyObject *key)\n"
"{\n"
" /* Objects all initialized to NULL for Py_XDECREF */\n"
" PyObject *item = NULL, *const_one = NULL, *incremented_item = NULL;\n"
" int rv = -1; /* Return value initialized to -1 (failure) */\n"
"\n"
" item = PyObject_GetItem(dict, key);\n"
" if (item == NULL) {\n"
" /* Handle KeyError only: */\n"
" if (!PyErr_ExceptionMatches(PyExc_KeyError))\n"
" goto error;\n"
"\n"
" /* Clear the error and use zero: */\n"
" PyErr_Clear();\n"
" item = PyLong_FromLong(0L);\n"
" if (item == NULL)\n"
" goto error;\n"
" }\n"
" const_one = PyLong_FromLong(1L);\n"
" if (const_one == NULL)\n"
" goto error;\n"
"\n"
" incremented_item = PyNumber_Add(item, const_one);\n"
" if (incremented_item == NULL)\n"
" goto error;\n"
"\n"
" if (PyObject_SetItem(dict, key, incremented_item) < 0)\n"
" goto error;\n"
" rv = 0; /* Success */\n"
" /* Continue with cleanup code */\n"
"\n"
" error:\n"
" /* Cleanup code, shared by success and failure path */\n"
"\n"
" /* Use Py_XDECREF() to ignore NULL references */\n"
" Py_XDECREF(item);\n"
" Py_XDECREF(const_one);\n"
" Py_XDECREF(incremented_item);\n"
"\n"
" return rv; /* -1 for error, 0 for success */\n"
"}"
msgstr ""
"int\n"
"incr_item(PyObject *dict, PyObject *key)\n"
"{\n"
" /* Objects all initialized to NULL for Py_XDECREF */\n"
" PyObject *item = NULL, *const_one = NULL, *incremented_item = NULL;\n"
" int rv = -1; /* Return value initialized to -1 (failure) */\n"
"\n"
" item = PyObject_GetItem(dict, key);\n"
" if (item == NULL) {\n"
" /* Handle KeyError only: */\n"
" if (!PyErr_ExceptionMatches(PyExc_KeyError))\n"
" goto error;\n"
"\n"
" /* Clear the error and use zero: */\n"
" PyErr_Clear();\n"
" item = PyLong_FromLong(0L);\n"
" if (item == NULL)\n"
" goto error;\n"
" }\n"
" const_one = PyLong_FromLong(1L);\n"
" if (const_one == NULL)\n"
" goto error;\n"
"\n"
" incremented_item = PyNumber_Add(item, const_one);\n"
" if (incremented_item == NULL)\n"
" goto error;\n"
"\n"
" if (PyObject_SetItem(dict, key, incremented_item) < 0)\n"
" goto error;\n"
" rv = 0; /* Success */\n"
" /* Continue with cleanup code */\n"
"\n"
" error:\n"
" /* Cleanup code, shared by success and failure path */\n"
"\n"
" /* Use Py_XDECREF() to ignore NULL references */\n"
" Py_XDECREF(item);\n"
" Py_XDECREF(const_one);\n"
" Py_XDECREF(incremented_item);\n"
"\n"
" return rv; /* -1 for error, 0 for success */\n"
"}"
msgid "This example represents an endorsed use of the ``goto`` statement in C! It illustrates the use of :c:func:`PyErr_ExceptionMatches` and :c:func:`PyErr_Clear` to handle specific exceptions, and the use of :c:func:`Py_XDECREF` to dispose of owned references that may be ``NULL`` (note the ``'X'`` in the name; :c:func:`Py_DECREF` would crash when confronted with a ``NULL`` reference). It is important that the variables used to hold owned references are initialized to ``NULL`` for this to work; likewise, the proposed return value is initialized to ``-1`` (failure) and only set to success after the final call made is successful."
msgstr "این مثال، کاربردی مورد تأیید از دستور ``goto`` در C را به نمایش میگذارد! این مثال، استفاده از :c:func:`PyErr_ExceptionMatches` و :c:func:`PyErr_Clear` برای مدیریت استثناهای خاص و استفاده از :c:func:`Py_XDECREF` برای آزاد کردن ارجاعهای مالکیتدار (owned) که ممکن است ``NULL`` باشند را نشان میدهد (به ``'X'`` در نام توجه کنید؛ :c:func:`Py_DECREF` هنگام مواجهه با ارجاع ``NULL`` فروپاشی میکند). برای اینکه این کار کند، مهم است که متغیرهایی که برای نگهداشتن ارجاعهای مالکیتدار به کار میروند، به ``NULL`` مقداردهی اولیه شده باشند؛ به همین ترتیب، مقدار بازگشتی پیشنهادی نیز به ``-1`` (شکست) مقداردهی اولیه میشود و تنها پس از آنکه آخرین فراخوانی انجامشده موفق باشد، روی موفقیت تنظیم میشود."
msgid "Embedding Python"
msgstr "تعبیه پایتون"
msgid "The one important task that only embedders (as opposed to extension writers) of the Python interpreter have to worry about is the initialization, and possibly the finalization, of the Python interpreter. Most functionality of the interpreter can only be used after the interpreter has been initialized."
msgstr "تنها کار مهمی که فقط تعبیهکنندگان (embedders) مفسر پایتون — برخلاف نویسندگان ماژولهای توسعهای — باید نگران آن باشند، مقداردهی اولیه و احتمالاً نهاییسازی مفسر پایتون است. بیشترِ کارکردهای مفسر تنها پس از آنکه مفسر مقداردهی اولیه شده باشد، قابل استفادهاند."
msgid "The basic initialization function is :c:func:`Py_Initialize`. This initializes the table of loaded modules, and creates the fundamental modules :mod:`builtins`, :mod:`__main__`, and :mod:`sys`. It also initializes the module search path (``sys.path``)."
msgstr "تابع مقداردهی اولیهی پایه :c:func:`Py_Initialize` است. این تابع جدول ماژولهای بارگذاریشده را مقداردهی اولیه میکند و ماژولهای بنیادی :mod:`builtins`، :mod:`__main__` و :mod:`sys` را ایجاد میکند. همچنین مسیر جستجوی ماژول (``sys.path``) را مقداردهی اولیه میکند."
msgid ":c:func:`Py_Initialize` does not set the \"script argument list\" (``sys.argv``). If this variable is needed by Python code that will be executed later, setting :c:member:`PyConfig.argv` and :c:member:`PyConfig.parse_argv` must be set: see :ref:`Python Initialization Configuration <init-config>`."
msgstr ":c:func:`Py_Initialize` فهرست آرگومانهای اسکریپت (``sys.argv``) را تنظیم نمیکند. اگر این متغیر توسط کد پایتونی که بعداً اجرا خواهد شد مورد نیاز باشد، باید :c:member:`PyConfig.argv` و :c:member:`PyConfig.parse_argv` تنظیم شوند: به :ref:`پیکربندی مقداردهی اولیه پایتون <init-config>` مراجعه کنید."
msgid "On most systems (in particular, on Unix and Windows, although the details are slightly different), :c:func:`Py_Initialize` calculates the module search path based upon its best guess for the location of the standard Python interpreter executable, assuming that the Python library is found in a fixed location relative to the Python interpreter executable. In particular, it looks for a directory named :file:`lib/python{X.Y}` relative to the parent directory where the executable named :file:`python` is found on the shell command search path (the environment variable :envvar:`PATH`)."
msgstr "در بیشتر سیستمها (بهطور خاص در یونیکس و ویندوز، هرچند جزئیات اندکی متفاوت است)، :c:func:`Py_Initialize` مسیر جستجوی ماژول را بر اساس بهترین حدس خود برای مکان پروندهی اجرایی مفسر استاندارد پایتون محاسبه میکند، با این فرض که کتابخانهی پایتون در مکانی ثابت نسبت به پروندهی اجرایی مفسر پایتون قرار دارد. بهطور خاص، این تابع به دنبال پوشهای با نام :file:`lib/python{X.Y}` نسبت به پوشهی والدِ مکانی میگردد که پروندهی اجرایی با نام :file:`python` در مسیر جستجوی فرمان پوسته (متغیر محیط :envvar:`PATH`) در آن یافت میشود."
msgid "For instance, if the Python executable is found in :file:`/usr/local/bin/python`, it will assume that the libraries are in :file:`/usr/local/lib/python{X.Y}`. (In fact, this particular path is also the \"fallback\" location, used when no executable file named :file:`python` is found along :envvar:`PATH`.) The user can override this behavior by setting the environment variable :envvar:`PYTHONHOME`, or insert additional directories in front of the standard path by setting :envvar:`PYTHONPATH`."
msgstr "برای نمونه، اگر پرونده اجرایی پایتون در :file:`/usr/local/bin/python` یافت شود، فرض میکند که کتابخانهها در :file:`/usr/local/lib/python{X.Y}` قرار دارند. (در واقع، این مسیر خاص همچنین مکان «جایگزین» است که زمانی استفاده میشود که هیچ پرونده اجراییای با نام :file:`python` در :envvar:`PATH` یافت نشود.) کاربر میتواند این رفتار را با تنظیم متغیر محیطی :envvar:`PYTHONHOME` بازتعریف کند، یا با تنظیم :envvar:`PYTHONPATH` پوشههای اضافی را در ابتدای مسیر استاندارد درج کند."
msgid "The embedding application can steer the search by setting :c:member:`PyConfig.program_name` *before* calling :c:func:`Py_InitializeFromConfig`. Note that :envvar:`PYTHONHOME` still overrides this and :envvar:`PYTHONPATH` is still inserted in front of the standard path. An application that requires total control has to provide its own implementation of :c:func:`Py_GetPath`, :c:func:`Py_GetPrefix`, :c:func:`Py_GetExecPrefix`, and :c:func:`Py_GetProgramFullPath` (all defined in :file:`Modules/getpath.c`)."
msgstr "برنامه جاسازنده میتواند با تنظیم :c:member:`PyConfig.program_name` *پیش از* فراخوانی :c:func:`Py_InitializeFromConfig` جستجو را هدایت کند. توجه داشته باشید که :envvar:`PYTHONHOME` همچنان این تنظیم را لغو میکند و :envvar:`PYTHONPATH` همچنان در ابتدای مسیر استاندارد درج میشود. برنامهای که به کنترل کامل نیاز دارد، باید پیادهسازی خودش از :c:func:`Py_GetPath`، :c:func:`Py_GetPrefix`، :c:func:`Py_GetExecPrefix` و :c:func:`Py_GetProgramFullPath` را فراهم کند (که همگی در :file:`Modules/getpath.c` تعریف شدهاند)."
msgid "Sometimes, it is desirable to \"uninitialize\" Python. For instance, the application may want to start over (make another call to :c:func:`Py_Initialize`) or the application is simply done with its use of Python and wants to free memory allocated by Python. This can be accomplished by calling :c:func:`Py_FinalizeEx`. The function :c:func:`Py_IsInitialized` returns true if Python is currently in the initialized state. More information about these functions is given in a later chapter. Notice that :c:func:`Py_FinalizeEx` does *not* free all memory allocated by the Python interpreter, e.g. memory allocated by extension modules currently cannot be released."
msgstr "گاهی مطلوب است که پایتون را «مقداردهیزدایی» (uninitialize) کنید. برای نمونه، ممکن است برنامه بخواهد از نو شروع کند (فراخوانی دوبارهی :c:func:`Py_Initialize`) یا اینکه کار برنامه با پایتون بهسادگی تمام شده باشد و بخواهد حافظهای را که پایتون تخصیص داده است آزاد کند. این کار را میتوان با فراخوانی :c:func:`Py_FinalizeEx` انجام داد. تابع :c:func:`Py_IsInitialized` در صورتی که پایتون در حال حاضر در وضعیت مقداردهیشده باشد، مقدار true برمیگرداند. اطلاعات بیشتر دربارهی این توابع در فصلی بعدی ارائه شده است. توجه داشته باشید که :c:func:`Py_FinalizeEx` تمام حافظهی تخصیصیافته توسط مفسر پایتون را آزاد *نمیکند*؛ مثلاً حافظهی تخصیصیافته توسط ماژولهای توسعهای در حال حاضر قابل آزادسازی نیست."
msgid "Debugging Builds"
msgstr "ساختهای اشکالزدایی"
msgid "Python can be built with several macros to enable extra checks of the interpreter and extension modules. These checks tend to add a large amount of overhead to the runtime so they are not enabled by default."
msgstr "پایتون را میتوان با چندین ماکرو ساخت تا بررسیهای اضافی مفسر و ماژولهای توسعهای فعال شوند. این بررسیها معمولاً سربار زیادی به رانتایم اضافه میکنند، بنابراین بهطور پیشفرض فعال نیستند."
msgid "A full list of the various types of debugging builds is in the file :file:`Misc/SpecialBuilds.txt` in the Python source distribution. Builds are available that support tracing of reference counts, debugging the memory allocator, or low-level profiling of the main interpreter loop. Only the most frequently used builds will be described in the remainder of this section."
msgstr "فهرست کامل انواع مختلف ساختهای اشکالزدایی در پرونده :file:`Misc/SpecialBuilds.txt` در توزیع کد منبع پایتون قرار دارد. ساختهایی در دسترس هستند که از ردگیری شمارش ارجاع، اشکالزدایی تخصیصدهنده حافظه یا پروفایلگیری سطح پایین حلقه اصلی مفسر پشتیبانی میکنند. در ادامه این بخش، تنها پرکاربردترین ساختها توضیح داده خواهند شد."
msgid "Compiling the interpreter with the :c:macro:`!Py_DEBUG` macro defined produces what is generally meant by :ref:`a debug build of Python <debug-build>`. :c:macro:`!Py_DEBUG` is enabled in the Unix build by adding :option:`--with-pydebug` to the :file:`./configure` command. It is also implied by the presence of the not-Python-specific :c:macro:`!_DEBUG` macro. When :c:macro:`!Py_DEBUG` is enabled in the Unix build, compiler optimization is disabled."
msgstr "کامپایل کردن مفسر در حالی که ماکروی :c:macro:`!Py_DEBUG` تعریفشده باشد، چیزی را تولید میکند که عموماً از :ref:`ساخت دیباگ پایتون <debug-build>` منظور میشود. ماکروی :c:macro:`!Py_DEBUG` در ساخت یونیکس با افزودن :option:`--with-pydebug` به دستور :file:`./configure` فعال میشود. این ماکرو همچنین با وجود ماکروی :c:macro:`!_DEBUG` که مختص پایتون نیست، بهطور ضمنی فعال میشود. هنگامی که :c:macro:`!Py_DEBUG` در ساخت یونیکس فعال باشد، بهینهسازی کامپایلر غیرفعال میشود."
msgid "In addition to the reference count debugging described below, extra checks are performed, see :ref:`Python Debug Build <debug-build>`."
msgstr "علاوه بر اشکالزدایی شمارش ارجاع که در زیر شرح داده شده، بررسیهای اضافی نیز انجام میشود؛ به :ref:`نسخه دیباگ پایتون <debug-build>` مراجعه کنید."
msgid "Defining ``Py_TRACE_REFS`` enables reference tracing (see the :option:`configure --with-trace-refs option <--with-trace-refs>`). When defined, a circular doubly linked list of active objects is maintained by adding two extra fields to every :c:type:`PyObject`. Total allocations are tracked as well. Upon exit, all existing references are printed. (In interactive mode this happens after every statement run by the interpreter.)"
msgstr "تعریف ``Py_TRACE_REFS`` ردگیری ارجاع را فعال میکند (به :option:`configure --with-trace-refs option <--with-trace-refs>` مراجعه کنید). هنگامی که تعریف شود، با افزودن دو فیلد اضافی به هر :c:type:`PyObject`، یک فهرست پیوندی دوطرفهی چرخهای از اشیاء فعال نگهداری میشود. مجموع تخصیصها نیز پیگیری میشود. هنگام خروج، تمام ارجاعهای موجود چاپ میشوند. (در حالت تعاملی، این کار پس از اجرای هر دستور توسط مفسر انجام میشود.)"
msgid "Please refer to :file:`Misc/SpecialBuilds.txt` in the Python source distribution for more detailed information."
msgstr "لطفاً برای اطلاعات مفصلتر به :file:`Misc/SpecialBuilds.txt` در توزیع منبع پایتون مراجعه کنید."
msgid "Recommended third party tools"
msgstr "ابزارهای شخص ثالث پیشنهادی"
msgid "The following third party tools offer both simpler and more sophisticated approaches to creating C, C++ and Rust extensions for Python:"
msgstr "ابزارهای شخص ثالث زیر رویکردهایی هم سادهتر و هم پیشرفتهتر برای ایجاد افزونههای C، C++ و Rust برای پایتون ارائه میدهند:"
msgid "`Cython <https://cython.org/>`_"
msgstr "`Cython <https://cython.org/>`_"
msgid "`cffi <https://cffi.readthedocs.io>`_"
msgstr "`cffi <https://cffi.readthedocs.io>`_"
msgid "`HPy <https://hpyproject.org/>`_"
msgstr "`HPy <https://hpyproject.org/>`_"
msgid "`nanobind <https://github.com/wjakob/nanobind>`_ (C++)"
msgstr "`nanobind <https://github.com/wjakob/nanobind>`_ (C++)"
msgid "`Numba <https://numba.pydata.org/>`_"
msgstr "`Numba <https://numba.pydata.org/>`_"
msgid "`pybind11 <https://pybind11.readthedocs.io/>`_ (C++)"
msgstr "`pybind11 <https://pybind11.readthedocs.io/>`_ (C++)"
msgid "`PyO3 <https://pyo3.rs/>`_ (Rust)"
msgstr "`PyO3 <https://pyo3.rs/>`_ (Rust)"
msgid "`SWIG <https://www.swig.org>`_"
msgstr "`SWIG <https://www.swig.org>`_"
msgid "Using tools such as these can help avoid writing code that is tightly bound to a particular version of CPython, avoid reference counting errors, and focus more on your own code than on using the CPython API. In general, new versions of Python can be supported by updating the tool, and your code will often use newer and more efficient APIs automatically. Some tools also support compiling for other implementations of Python from a single set of sources."
msgstr "استفاده از چنین ابزارهایی میتواند به شما کمک کند تا از نوشتن کدی که بهشدت به نسخهی خاصی از سیپایتون وابسته است، اجتناب کنید، از خطاهای شمارش ارجاع بپرهیزید و بیشتر بر کد خودتان تمرکز کنید تا بر استفاده از API سیپایتون. بهطور کلی، میتوان با بهروزرسانی ابزار، از نسخههای جدید پایتون پشتیبانی کرد و کد شما اغلب بهطور خودکار از APIهای جدیدتر و کارآمدتر استفاده خواهد کرد. برخی از ابزارها همچنین از کامپایل برای پیادهسازیهای دیگر پایتون با یک مجموعه واحد از کدهای منبع پشتیبانی میکنند."
msgid "These projects are not supported by the same people who maintain Python, and issues need to be raised with the projects directly. Remember to check that the project is still maintained and supported, as the list above may become outdated."
msgstr "این پروژهها توسط همان افرادی که پایتون را نگهداری میکنند، پشتیبانی نمیشوند و مشکلات باید مستقیماً با خود پروژهها مطرح شوند. به یاد داشته باشید که بررسی کنید پروژه هنوز نگهداری و پشتیبانی میشود، زیرا ممکن است فهرست بالا از تاریخ بیفتد."
msgid "`Python Packaging User Guide: Binary Extensions <https://packaging.python.org/guides/packaging-binary-extensions/>`_"
msgstr "`راهنمای کاربری بستهبندی پایتون: افزونههای دودویی <https://packaging.python.org/guides/packaging-binary-extensions/>`_"
msgid "The Python Packaging User Guide not only covers several available tools that simplify the creation of binary extensions, but also discusses the various reasons why creating an extension module may be desirable in the first place."
msgstr "راهنمای کاربر بستهبندی پایتون (Python Packaging User Guide) نهتنها چندین ابزار موجود را پوشش میدهد که ایجاد توسعههای دودویی را ساده میکنند، بلکه به دلایل مختلفی نیز میپردازد که چرا از اساس ایجاد یک ماژول توسعهای میتواند مطلوب باشد."
msgid "object"
msgstr "شیء"
msgid "type"
msgstr "نوع"
msgid "Py_INCREF (C function)"
msgstr "Py_INCREF (تابع C)"
msgid "Py_DECREF (C function)"
msgstr "Py_DECREF (تابع C)"
msgid "PyList_SetItem (C function)"
msgstr "PyList_SetItem (تابع C)"
msgid "PyTuple_SetItem (C function)"
msgstr "PyTuple_SetItem (تابع C)"
msgid "set_all()"
msgstr "set_all()"
msgid "PyList_GetItem (C function)"
msgstr "PyList_GetItem (تابع C)"
msgid "PySequence_GetItem (C function)"
msgstr "PySequence_GetItem (تابع C)"
msgid "sum_list()"
msgstr "sum_list()"
msgid "sum_sequence()"
msgstr "sum_sequence()"
msgid "PyErr_Occurred (C function)"
msgstr "PyErr_Occurred (تابع C)"
msgid "PyErr_SetString (C function)"
msgstr "PyErr_SetString (تابع C)"
msgid "PyErr_Clear (C function)"
msgstr "PyErr_Clear (تابع C)"
msgid "exc_info (in module sys)"
msgstr "exc_info (در ماژول sys)"
msgid "incr_item()"
msgstr "incr_item()"
msgid "PyErr_ExceptionMatches (C function)"
msgstr "PyErr_ExceptionMatches (تابع C)"
msgid "Py_XDECREF (C function)"
msgstr "Py_XDECREF (تابع C)"
msgid "Py_Initialize (C function)"
msgstr "Py_Initialize (تابع C)"
msgid "module"
msgstr "ماژول"
msgid "builtins"
msgstr "توکارها"
msgid "__main__"
msgstr "__main__"
msgid "sys"
msgstr "sys"
msgid "search"
msgstr "جستجو"
msgid "path"
msgstr "مسیر"
msgid "path (in module sys)"
msgstr "path (در ماژول sys)"
msgid "Py_GetPath (C function)"
msgstr "Py_GetPath (تابع C)"
msgid "Py_GetPrefix (C function)"
msgstr "Py_GetPrefix (تابع C)"
msgid "Py_GetExecPrefix (C function)"
msgstr "Py_GetExecPrefix (تابع C)"
msgid "Py_GetProgramFullPath (C function)"
msgstr "Py_GetProgramFullPath (تابع C)"
msgid "Py_IsInitialized (C function)"
msgstr "Py_IsInitialized (تابع C)"