forked from AFPy/python-docs-fr
merge pot files.
This commit is contained in:
parent 25ae2894e2
commit 03ab206a30
125 changed files with 10323 additions and 9950 deletions
| | @ -5,7 +5,7 @@ msgid "" | |||
msgstr "" | ||||
"Project-Id-Version: Python 3.6\n" | ||||
"Report-Msgid-Bugs-To: \n" | ||||
"POT-Creation-Date: 2018-06-28 15:29+0200\n" | ||||
"POT-Creation-Date: 2018-11-29 16:06+0100\n" | ||||
"PO-Revision-Date: 2018-10-04 16:18+0200\n" | ||||
"Last-Translator: Julien Palard <julien@palard.fr>\n" | ||||
"Language-Team: FRENCH <traductions@lists.afpy.org>\n" | ||||
| | @ -771,7 +771,7 @@ msgid "" | |||
"`Py_DECREF`\\ -ed immediately after the :c:func:`PyObject_CallObject` call." | ||||
msgstr "" | ||||
| ||||
#: ../Doc/extending/extending.rst:551 | ||||
#: ../Doc/extending/extending.rst:552 | ||||
msgid "" | ||||
"The return value of :c:func:`PyObject_CallObject` is \"new\": either it is a " | ||||
"brand new object, or it is an existing object whose reference count has been " | ||||
| | @ -780,7 +780,7 @@ msgid "" | |||
"not interested in its value." | ||||
msgstr "" | ||||
| ||||
#: ../Doc/extending/extending.rst:557 | ||||
#: ../Doc/extending/extending.rst:558 | ||||
msgid "" | ||||
"Before you do this, however, it is important to check that the return value " | ||||
"isn't *NULL*. If it is, the Python function terminated by raising an " | ||||
| | @ -791,7 +791,7 @@ msgid "" | |||
"should be cleared by calling :c:func:`PyErr_Clear`. For example::" | ||||
msgstr "" | ||||
| ||||
#: ../Doc/extending/extending.rst:570 | ||||
#: ../Doc/extending/extending.rst:571 | ||||
msgid "" | ||||
"Depending on the desired interface to the Python callback function, you may " | ||||
"also have to provide an argument list to :c:func:`PyObject_CallObject`. In " | ||||
| | @ -803,7 +803,7 @@ msgid "" | |||
"you want to pass an integral event code, you might use the following code::" | ||||
msgstr "" | ||||
| ||||
#: ../Doc/extending/extending.rst:589 | ||||
#: ../Doc/extending/extending.rst:590 | ||||
msgid "" | ||||
"Note the placement of ``Py_DECREF(arglist)`` immediately after the call, " | ||||
"before the error check! Also note that strictly speaking this code is not " | ||||
| | @ -811,22 +811,22 @@ msgid "" | |||
"checked." | ||||
msgstr "" | ||||
| ||||
#: ../Doc/extending/extending.rst:593 | ||||
#: ../Doc/extending/extending.rst:594 | ||||
msgid "" | ||||
"You may also call a function with keyword arguments by using :c:func:" | ||||
"`PyObject_Call`, which supports arguments and keyword arguments. As in the " | ||||
"above example, we use :c:func:`Py_BuildValue` to construct the dictionary. ::" | ||||
msgstr "" | ||||
| ||||
#: ../Doc/extending/extending.rst:611 | ||||
#: ../Doc/extending/extending.rst:612 | ||||
msgid "Extracting Parameters in Extension Functions" | ||||
msgstr "" | ||||
| ||||
#: ../Doc/extending/extending.rst:615 | ||||
#: ../Doc/extending/extending.rst:616 | ||||
msgid "The :c:func:`PyArg_ParseTuple` function is declared as follows::" | ||||
msgstr "" | ||||
| ||||
#: ../Doc/extending/extending.rst:619 | ||||
#: ../Doc/extending/extending.rst:620 | ||||
msgid "" | ||||
"The *arg* argument must be a tuple object containing an argument list passed " | ||||
"from Python to a C function. The *format* argument must be a format string, " | ||||
| | @ -835,7 +835,7 @@ msgid "" | |||
"whose type is determined by the format string." | ||||
msgstr "" | ||||
| ||||
#: ../Doc/extending/extending.rst:625 | ||||
#: ../Doc/extending/extending.rst:626 | ||||
msgid "" | ||||
"Note that while :c:func:`PyArg_ParseTuple` checks that the Python arguments " | ||||
"have the required types, it cannot check the validity of the addresses of C " | ||||
| | @ -843,7 +843,7 @@ msgid "" | |||
"probably crash or at least overwrite random bits in memory. So be careful!" | ||||
msgstr "" | ||||
| ||||
#: ../Doc/extending/extending.rst:630 | ||||
#: ../Doc/extending/extending.rst:631 | ||||
msgid "" | ||||
"Note that any Python object references which are provided to the caller are " | ||||
"*borrowed* references; do not decrement their reference count!" | ||||
| | @ -852,20 +852,20 @@ msgstr "" | |||
"à l'appelant sont des références *empruntées* ; ne décrémentez pas leur " | ||||
"compteur de références !" | ||||
| ||||
#: ../Doc/extending/extending.rst:633 | ||||
#: ../Doc/extending/extending.rst:634 | ||||
msgid "Some example calls::" | ||||
msgstr "" | ||||
| ||||
#: ../Doc/extending/extending.rst:703 | ||||
#: ../Doc/extending/extending.rst:704 | ||||
msgid "Keyword Parameters for Extension Functions" | ||||
msgstr "" | ||||
| ||||
#: ../Doc/extending/extending.rst:707 | ||||
#: ../Doc/extending/extending.rst:708 | ||||
msgid "" | ||||
"The :c:func:`PyArg_ParseTupleAndKeywords` function is declared as follows::" | ||||
msgstr "" | ||||
| ||||
#: ../Doc/extending/extending.rst:712 | ||||
#: ../Doc/extending/extending.rst:713 | ||||
msgid "" | ||||
"The *arg* and *format* parameters are identical to those of the :c:func:" | ||||
"`PyArg_ParseTuple` function. The *kwdict* parameter is the dictionary of " | ||||
| | @ -876,30 +876,30 @@ msgid "" | |||
"returns true, otherwise it returns false and raises an appropriate exception." | ||||
msgstr "" | ||||
| ||||
#: ../Doc/extending/extending.rst:722 | ||||
#: ../Doc/extending/extending.rst:723 | ||||
msgid "" | ||||
"Nested tuples cannot be parsed when using keyword arguments! Keyword " | ||||
"parameters passed in which are not present in the *kwlist* will cause :exc:" | ||||
"`TypeError` to be raised." | ||||
msgstr "" | ||||
| ||||
#: ../Doc/extending/extending.rst:728 | ||||
#: ../Doc/extending/extending.rst:729 | ||||
msgid "" | ||||
"Here is an example module which uses keywords, based on an example by Geoff " | ||||
"Philbrick (philbrick@hks.com)::" | ||||
msgstr "" | ||||
| ||||
#: ../Doc/extending/extending.rst:782 | ||||
#: ../Doc/extending/extending.rst:783 | ||||
msgid "Building Arbitrary Values" | ||||
msgstr "" | ||||
| ||||
#: ../Doc/extending/extending.rst:784 | ||||
#: ../Doc/extending/extending.rst:785 | ||||
msgid "" | ||||
"This function is the counterpart to :c:func:`PyArg_ParseTuple`. It is " | ||||
"declared as follows::" | ||||
msgstr "" | ||||
| ||||
#: ../Doc/extending/extending.rst:789 | ||||
#: ../Doc/extending/extending.rst:790 | ||||
msgid "" | ||||
"It recognizes a set of format units similar to the ones recognized by :c:" | ||||
"func:`PyArg_ParseTuple`, but the arguments (which are input to the function, " | ||||
| | @ -907,7 +907,7 @@ msgid "" | |||
"object, suitable for returning from a C function called from Python." | ||||
msgstr "" | ||||
| ||||
#: ../Doc/extending/extending.rst:794 | ||||
#: ../Doc/extending/extending.rst:795 | ||||
msgid "" | ||||
"One difference with :c:func:`PyArg_ParseTuple`: while the latter requires " | ||||
"its first argument to be a tuple (since Python argument lists are always " | ||||
| | @ -919,16 +919,16 @@ msgid "" | |||
"parenthesize the format string." | ||||
msgstr "" | ||||
| ||||
#: ../Doc/extending/extending.rst:802 | ||||
#: ../Doc/extending/extending.rst:803 | ||||
msgid "" | ||||
"Examples (to the left the call, to the right the resulting Python value):" | ||||
msgstr "" | ||||
| ||||
#: ../Doc/extending/extending.rst:828 | ||||
#: ../Doc/extending/extending.rst:829 | ||||
msgid "Reference Counts" | ||||
msgstr "" | ||||
| ||||
#: ../Doc/extending/extending.rst:830 | ||||
#: ../Doc/extending/extending.rst:831 | ||||
msgid "" | ||||
"In languages like C or C++, the programmer is responsible for dynamic " | ||||
"allocation and deallocation of memory on the heap. In C, this is done using " | ||||
| | @ -937,7 +937,7 @@ msgid "" | |||
"restrict the following discussion to the C case." | ||||
msgstr "" | ||||
| ||||
#: ../Doc/extending/extending.rst:836 | ||||
#: ../Doc/extending/extending.rst:837 | ||||
msgid "" | ||||
"Every block of memory allocated with :c:func:`malloc` should eventually be " | ||||
"returned to the pool of available memory by exactly one call to :c:func:" | ||||
| | @ -952,7 +952,7 @@ msgid "" | |||
"crashes." | ||||
msgstr "" | ||||
| ||||
#: ../Doc/extending/extending.rst:847 | ||||
#: ../Doc/extending/extending.rst:848 | ||||
msgid "" | ||||
"Common causes of memory leaks are unusual paths through the code. For " | ||||
"instance, a function may allocate a block of memory, do some calculation, " | ||||
| | @ -969,7 +969,7 @@ msgid "" | |||
"of errors." | ||||
msgstr "" | ||||
| ||||
#: ../Doc/extending/extending.rst:860 | ||||
#: ../Doc/extending/extending.rst:861 | ||||
msgid "" | ||||
"Since Python makes heavy use of :c:func:`malloc` and :c:func:`free`, it " | ||||
"needs a strategy to avoid memory leaks as well as the use of freed memory. " | ||||
| | @ -980,7 +980,7 @@ msgid "" | |||
"reference to the object has been deleted and the object is freed." | ||||
msgstr "" | ||||
| ||||
#: ../Doc/extending/extending.rst:868 | ||||
#: ../Doc/extending/extending.rst:869 | ||||
msgid "" | ||||
"An alternative strategy is called :dfn:`automatic garbage collection`. " | ||||
"(Sometimes, reference counting is also referred to as a garbage collection " | ||||
| | @ -996,7 +996,7 @@ msgid "" | |||
"with reference counts." | ||||
msgstr "" | ||||
| ||||
#: ../Doc/extending/extending.rst:880 | ||||
#: ../Doc/extending/extending.rst:881 | ||||
msgid "" | ||||
"While Python uses the traditional reference counting implementation, it also " | ||||
"offers a cycle detector that works to detect reference cycles. This allows " | ||||
| | @ -1010,7 +1010,7 @@ msgid "" | |||
"though there are no further references to the cycle itself." | ||||
msgstr "" | ||||
| ||||
#: ../Doc/extending/extending.rst:891 | ||||
#: ../Doc/extending/extending.rst:892 | ||||
msgid "" | ||||
"The cycle detector is able to detect garbage cycles and can reclaim them. " | ||||
"The :mod:`gc` module exposes a way to run the detector (the :func:`~gc." | ||||
| | @ -1022,11 +1022,11 @@ msgid "" | |||
"detector is disabled in this way, the :mod:`gc` module will not be available." | ||||
msgstr "" | ||||
| ||||
#: ../Doc/extending/extending.rst:905 | ||||
#: ../Doc/extending/extending.rst:906 | ||||
msgid "Reference Counting in Python" | ||||
msgstr "" | ||||
| ||||
#: ../Doc/extending/extending.rst:907 | ||||
#: ../Doc/extending/extending.rst:908 | ||||
msgid "" | ||||
"There are two macros, ``Py_INCREF(x)`` and ``Py_DECREF(x)``, which handle " | ||||
"the incrementing and decrementing of the reference count. :c:func:" | ||||
| | @ -1037,7 +1037,7 @@ msgid "" | |||
"object." | ||||
msgstr "" | ||||
| ||||
#: ../Doc/extending/extending.rst:914 | ||||
#: ../Doc/extending/extending.rst:915 | ||||
msgid "" | ||||
"The big question now remains: when to use ``Py_INCREF(x)`` and " | ||||
"``Py_DECREF(x)``? Let's first introduce some terms. Nobody \"owns\" an " | ||||
| | @ -1050,7 +1050,7 @@ msgid "" | |||
"reference creates a memory leak." | ||||
msgstr "" | ||||
| ||||
#: ../Doc/extending/extending.rst:923 | ||||
#: ../Doc/extending/extending.rst:924 | ||||
msgid "" | ||||
"It is also possible to :dfn:`borrow` [#]_ a reference to an object. The " | ||||
"borrower of a reference should not call :c:func:`Py_DECREF`. The borrower " | ||||
| | @ -1059,7 +1059,7 @@ msgid "" | |||
"risks using freed memory and should be avoided completely [#]_." | ||||
msgstr "" | ||||
| ||||
#: ../Doc/extending/extending.rst:929 | ||||
#: ../Doc/extending/extending.rst:930 | ||||
msgid "" | ||||
"The advantage of borrowing over owning a reference is that you don't need to " | ||||
"take care of disposing of the reference on all possible paths through the " | ||||
| | @ -1070,7 +1070,7 @@ msgid "" | |||
"borrowed has in fact disposed of it." | ||||
msgstr "" | ||||
| ||||
#: ../Doc/extending/extending.rst:937 | ||||
#: ../Doc/extending/extending.rst:938 | ||||
msgid "" | ||||
"A borrowed reference can be changed into an owned reference by calling :c:" | ||||
"func:`Py_INCREF`. This does not affect the status of the owner from which " | ||||
| | @ -1079,18 +1079,18 @@ msgid "" | |||
"properly, as well as the previous owner)." | ||||
msgstr "" | ||||
| ||||
#: ../Doc/extending/extending.rst:947 | ||||
#: ../Doc/extending/extending.rst:948 | ||||
msgid "Ownership Rules" | ||||
msgstr "" | ||||
| ||||
#: ../Doc/extending/extending.rst:949 | ||||
#: ../Doc/extending/extending.rst:950 | ||||
msgid "" | ||||
"Whenever an object reference is passed into or out of a function, it is part " | ||||
"of the function's interface specification whether ownership is transferred " | ||||
"with the reference or not." | ||||
msgstr "" | ||||
| ||||
#: ../Doc/extending/extending.rst:953 | ||||
#: ../Doc/extending/extending.rst:954 | ||||
msgid "" | ||||
"Most functions that return a reference to an object pass on ownership with " | ||||
"the reference. In particular, all functions whose function it is to create " | ||||
| | @ -1101,7 +1101,7 @@ msgid "" | |||
"reference to a cached item." | ||||
msgstr "" | ||||
| ||||
#: ../Doc/extending/extending.rst:961 | ||||
#: ../Doc/extending/extending.rst:962 | ||||
msgid "" | ||||
"Many functions that extract objects from other objects also transfer " | ||||
"ownership with the reference, for instance :c:func:" | ||||
| | @ -1112,14 +1112,14 @@ msgid "" | |||
"list or dictionary." | ||||
msgstr "" | ||||
| ||||
#: ../Doc/extending/extending.rst:968 | ||||
#: ../Doc/extending/extending.rst:969 | ||||
msgid "" | ||||
"The function :c:func:`PyImport_AddModule` also returns a borrowed reference, " | ||||
"even though it may actually create the object it returns: this is possible " | ||||
"because an owned reference to the object is stored in ``sys.modules``." | ||||
msgstr "" | ||||
| ||||
#: ../Doc/extending/extending.rst:972 | ||||
#: ../Doc/extending/extending.rst:973 | ||||
msgid "" | ||||
"When you pass an object reference into another function, in general, the " | ||||
"function borrows the reference from you --- if it needs to store it, it will " | ||||
| | @ -1130,7 +1130,7 @@ msgid "" | |||
"don't take over ownership --- they are \"normal.\")" | ||||
msgstr "" | ||||
| ||||
#: ../Doc/extending/extending.rst:980 | ||||
#: ../Doc/extending/extending.rst:981 | ||||
msgid "" | ||||
"When a C function is called from Python, it borrows references to its " | ||||
"arguments from the caller. The caller owns a reference to the object, so " | ||||
| | @ -1139,18 +1139,18 @@ msgid "" | |||
"turned into an owned reference by calling :c:func:`Py_INCREF`." | ||||
msgstr "" | ||||
| ||||
#: ../Doc/extending/extending.rst:986 | ||||
#: ../Doc/extending/extending.rst:987 | ||||
msgid "" | ||||
"The object reference returned from a C function that is called from Python " | ||||
"must be an owned reference --- ownership is transferred from the function to " | ||||
"its caller." | ||||
msgstr "" | ||||
| ||||
#: ../Doc/extending/extending.rst:994 | ||||
#: ../Doc/extending/extending.rst:995 | ||||
msgid "Thin Ice" | ||||
msgstr "" | ||||
| ||||
#: ../Doc/extending/extending.rst:996 | ||||
#: ../Doc/extending/extending.rst:997 | ||||
msgid "" | ||||
"There are a few situations where seemingly harmless use of a borrowed " | ||||
"reference can lead to problems. These all have to do with implicit " | ||||
| | @ -1158,21 +1158,21 @@ msgid "" | |||
"dispose of it." | ||||
msgstr "" | ||||
| ||||
#: ../Doc/extending/extending.rst:1000 | ||||
#: ../Doc/extending/extending.rst:1001 | ||||
msgid "" | ||||
"The first and most important case to know about is using :c:func:`Py_DECREF` " | ||||
"on an unrelated object while borrowing a reference to a list item. For " | ||||
"instance::" | ||||
msgstr "" | ||||
| ||||
#: ../Doc/extending/extending.rst:1012 | ||||
#: ../Doc/extending/extending.rst:1013 | ||||
msgid "" | ||||
"This function first borrows a reference to ``list[0]``, then replaces " | ||||
"``list[1]`` with the value ``0``, and finally prints the borrowed reference. " | ||||
"Looks harmless, right? But it's not!" | ||||
msgstr "" | ||||
| ||||
#: ../Doc/extending/extending.rst:1016 | ||||
#: ../Doc/extending/extending.rst:1017 | ||||
msgid "" | ||||
"Let's follow the control flow into :c:func:`PyList_SetItem`. The list owns " | ||||
"references to all its items, so when item 1 is replaced, it has to dispose " | ||||
| | @ -1182,7 +1182,7 @@ msgid "" | |||
"count of 1, disposing of it will call its :meth:`__del__` method." | ||||
msgstr "" | ||||
| ||||
#: ../Doc/extending/extending.rst:1023 | ||||
#: ../Doc/extending/extending.rst:1024 | ||||
msgid "" | ||||
"Since it is written in Python, the :meth:`__del__` method can execute " | ||||
"arbitrary Python code. Could it perhaps do something to invalidate the " | ||||
| | @ -1193,20 +1193,20 @@ msgid "" | |||
"associated with it, thereby invalidating ``item``." | ||||
msgstr "" | ||||
| ||||
#: ../Doc/extending/extending.rst:1031 | ||||
#: ../Doc/extending/extending.rst:1032 | ||||
msgid "" | ||||
"The solution, once you know the source of the problem, is easy: temporarily " | ||||
"increment the reference count. The correct version of the function reads::" | ||||
msgstr "" | ||||
| ||||
#: ../Doc/extending/extending.rst:1045 | ||||
#: ../Doc/extending/extending.rst:1046 | ||||
msgid "" | ||||
"This is a true story. An older version of Python contained variants of this " | ||||
"bug and someone spent a considerable amount of time in a C debugger to " | ||||
"figure out why his :meth:`__del__` methods would fail..." | ||||
msgstr "" | ||||
| ||||
#: ../Doc/extending/extending.rst:1049 | ||||
#: ../Doc/extending/extending.rst:1050 | ||||
msgid "" | ||||
"The second case of problems with a borrowed reference is a variant involving " | ||||
"threads. Normally, multiple threads in the Python interpreter can't get in " | ||||
| | @ -1219,11 +1219,11 @@ msgid "" | |||
"previous one::" | ||||
msgstr "" | ||||
| ||||
#: ../Doc/extending/extending.rst:1072 | ||||
#: ../Doc/extending/extending.rst:1073 | ||||
msgid "NULL Pointers" | ||||
msgstr "" | ||||
| ||||
#: ../Doc/extending/extending.rst:1074 | ||||
#: ../Doc/extending/extending.rst:1075 | ||||
msgid "" | ||||
"In general, functions that take object references as arguments do not expect " | ||||
"you to pass them *NULL* pointers, and will dump core (or cause later core " | ||||
| | @ -1235,21 +1235,21 @@ msgid "" | |||
"slowly." | ||||
msgstr "" | ||||
| ||||
#: ../Doc/extending/extending.rst:1082 | ||||
#: ../Doc/extending/extending.rst:1083 | ||||
msgid "" | ||||
"It is better to test for *NULL* only at the \"source:\" when a pointer that " | ||||
"may be *NULL* is received, for example, from :c:func:`malloc` or from a " | ||||
"function that may raise an exception." | ||||
msgstr "" | ||||
| ||||
#: ../Doc/extending/extending.rst:1086 | ||||
#: ../Doc/extending/extending.rst:1087 | ||||
msgid "" | ||||
"The macros :c:func:`Py_INCREF` and :c:func:`Py_DECREF` do not check for " | ||||
"*NULL* pointers --- however, their variants :c:func:`Py_XINCREF` and :c:func:" | ||||
"`Py_XDECREF` do." | ||||
msgstr "" | ||||
| ||||
#: ../Doc/extending/extending.rst:1090 | ||||
#: ../Doc/extending/extending.rst:1091 | ||||
msgid "" | ||||
"The macros for checking for a particular object type (``Pytype_Check()``) " | ||||
"don't check for *NULL* pointers --- again, there is much code that calls " | ||||
| | @ -1258,24 +1258,24 @@ msgid "" | |||
"variants with *NULL* checking." | ||||
msgstr "" | ||||
| ||||
#: ../Doc/extending/extending.rst:1096 | ||||
#: ../Doc/extending/extending.rst:1097 | ||||
msgid "" | ||||
"The C function calling mechanism guarantees that the argument list passed to " | ||||
"C functions (``args`` in the examples) is never *NULL* --- in fact it " | ||||
"guarantees that it is always a tuple [#]_." | ||||
msgstr "" | ||||
| ||||
#: ../Doc/extending/extending.rst:1100 | ||||
#: ../Doc/extending/extending.rst:1101 | ||||
msgid "" | ||||
"It is a severe error to ever let a *NULL* pointer \"escape\" to the Python " | ||||
"user." | ||||
msgstr "" | ||||
| ||||
#: ../Doc/extending/extending.rst:1111 | ||||
#: ../Doc/extending/extending.rst:1112 | ||||
msgid "Writing Extensions in C++" | ||||
msgstr "" | ||||
| ||||
#: ../Doc/extending/extending.rst:1113 | ||||
#: ../Doc/extending/extending.rst:1114 | ||||
msgid "" | ||||
"It is possible to write extension modules in C++. Some restrictions apply. " | ||||
"If the main program (the Python interpreter) is compiled and linked by the C " | ||||
| | @ -1288,11 +1288,11 @@ msgid "" | |||
"(all recent C++ compilers define this symbol)." | ||||
msgstr "" | ||||
| ||||
#: ../Doc/extending/extending.rst:1127 | ||||
#: ../Doc/extending/extending.rst:1128 | ||||
msgid "Providing a C API for an Extension Module" | ||||
msgstr "" | ||||
| ||||
#: ../Doc/extending/extending.rst:1132 | ||||
#: ../Doc/extending/extending.rst:1133 | ||||
msgid "" | ||||
"Many extension modules just provide new functions and types to be used from " | ||||
"Python, but sometimes the code in an extension module can be useful for " | ||||
| | @ -1303,7 +1303,7 @@ msgid "" | |||
"functions for direct manipulation from other extension modules." | ||||
msgstr "" | ||||
| ||||
#: ../Doc/extending/extending.rst:1140 | ||||
#: ../Doc/extending/extending.rst:1141 | ||||
msgid "" | ||||
"At first sight this seems easy: just write the functions (without declaring " | ||||
"them ``static``, of course), provide an appropriate header file, and " | ||||
| | @ -1319,7 +1319,7 @@ msgid "" | |||
"call might not have been loaded yet!" | ||||
msgstr "" | ||||
| ||||
#: ../Doc/extending/extending.rst:1152 | ||||
#: ../Doc/extending/extending.rst:1153 | ||||
msgid "" | ||||
"Portability therefore requires not to make any assumptions about symbol " | ||||
"visibility. This means that all symbols in extension modules should be " | ||||
| | @ -1329,7 +1329,7 @@ msgid "" | |||
"accessible from other extension modules must be exported in a different way." | ||||
msgstr "" | ||||
| ||||
#: ../Doc/extending/extending.rst:1159 | ||||
#: ../Doc/extending/extending.rst:1160 | ||||
msgid "" | ||||
"Python provides a special mechanism to pass C-level information (pointers) " | ||||
"from one extension module to another one: Capsules. A Capsule is a Python " | ||||
| | @ -1341,7 +1341,7 @@ msgid "" | |||
"the Capsule." | ||||
msgstr "" | ||||
| ||||
#: ../Doc/extending/extending.rst:1167 | ||||
#: ../Doc/extending/extending.rst:1168 | ||||
msgid "" | ||||
"There are many ways in which Capsules can be used to export the C API of an " | ||||
"extension module. Each function could get its own Capsule, or all C API " | ||||
| | @ -1351,7 +1351,7 @@ msgid "" | |||
"client modules." | ||||
msgstr "" | ||||
| ||||
#: ../Doc/extending/extending.rst:1173 | ||||
#: ../Doc/extending/extending.rst:1174 | ||||
msgid "" | ||||
"Whichever method you choose, it's important to name your Capsules properly. " | ||||
"The function :c:func:`PyCapsule_New` takes a name parameter (:c:type:`const " | ||||
| | @ -1361,13 +1361,13 @@ msgid "" | |||
"from another." | ||||
msgstr "" | ||||
| ||||
#: ../Doc/extending/extending.rst:1180 | ||||
#: ../Doc/extending/extending.rst:1181 | ||||
msgid "" | ||||
"In particular, Capsules used to expose C APIs should be given a name " | ||||
"following this convention::" | ||||
msgstr "" | ||||
| ||||
#: ../Doc/extending/extending.rst:1185 | ||||
#: ../Doc/extending/extending.rst:1186 | ||||
msgid "" | ||||
"The convenience function :c:func:`PyCapsule_Import` makes it easy to load a " | ||||
"C API provided via a Capsule, but only if the Capsule's name matches this " | ||||
| | @ -1375,7 +1375,7 @@ msgid "" | |||
"the Capsule they load contains the correct C API." | ||||
msgstr "" | ||||
| ||||
#: ../Doc/extending/extending.rst:1190 | ||||
#: ../Doc/extending/extending.rst:1191 | ||||
msgid "" | ||||
"The following example demonstrates an approach that puts most of the burden " | ||||
"on the writer of the exporting module, which is appropriate for commonly " | ||||
| | @ -1386,7 +1386,7 @@ msgid "" | |||
"modules only have to call this macro before accessing the C API." | ||||
msgstr "" | ||||
| ||||
#: ../Doc/extending/extending.rst:1198 | ||||
#: ../Doc/extending/extending.rst:1199 | ||||
msgid "" | ||||
"The exporting module is a modification of the :mod:`spam` module from " | ||||
"section :ref:`extending-simpleexample`. The function :func:`spam.system` " | ||||
| | @ -1396,25 +1396,25 @@ msgid "" | |||
"function :c:func:`PySpam_System` is also exported to other extension modules." | ||||
msgstr "" | ||||
| ||||
#: ../Doc/extending/extending.rst:1205 | ||||
#: ../Doc/extending/extending.rst:1206 | ||||
msgid "" | ||||
"The function :c:func:`PySpam_System` is a plain C function, declared " | ||||
"``static`` like everything else::" | ||||
msgstr "" | ||||
| ||||
#: ../Doc/extending/extending.rst:1214 | ||||
#: ../Doc/extending/extending.rst:1215 | ||||
msgid "The function :c:func:`spam_system` is modified in a trivial way::" | ||||
msgstr "" | ||||
| ||||
#: ../Doc/extending/extending.rst:1228 | ||||
#: ../Doc/extending/extending.rst:1229 | ||||
msgid "In the beginning of the module, right after the line ::" | ||||
msgstr "" | ||||
| ||||
#: ../Doc/extending/extending.rst:1232 | ||||
#: ../Doc/extending/extending.rst:1233 | ||||
msgid "two more lines must be added::" | ||||
msgstr "" | ||||
| ||||
#: ../Doc/extending/extending.rst:1237 | ||||
#: ../Doc/extending/extending.rst:1238 | ||||
msgid "" | ||||
"The ``#define`` is used to tell the header file that it is being included in " | ||||
"the exporting module, not a client module. Finally, the module's " | ||||
| | @ -1422,33 +1422,33 @@ msgid "" | |||
"array::" | ||||
msgstr "" | ||||
| ||||
#: ../Doc/extending/extending.rst:1263 | ||||
#: ../Doc/extending/extending.rst:1264 | ||||
msgid "" | ||||
"Note that ``PySpam_API`` is declared ``static``; otherwise the pointer array " | ||||
"would disappear when :func:`PyInit_spam` terminates!" | ||||
msgstr "" | ||||
| ||||
#: ../Doc/extending/extending.rst:1266 | ||||
#: ../Doc/extending/extending.rst:1267 | ||||
msgid "" | ||||
"The bulk of the work is in the header file :file:`spammodule.h`, which looks " | ||||
"like this::" | ||||
msgstr "" | ||||
| ||||
#: ../Doc/extending/extending.rst:1317 | ||||
#: ../Doc/extending/extending.rst:1318 | ||||
msgid "" | ||||
"All that a client module must do in order to have access to the function :c:" | ||||
"func:`PySpam_System` is to call the function (or rather macro) :c:func:" | ||||
"`import_spam` in its initialization function::" | ||||
msgstr "" | ||||
| ||||
#: ../Doc/extending/extending.rst:1335 | ||||
#: ../Doc/extending/extending.rst:1336 | ||||
msgid "" | ||||
"The main disadvantage of this approach is that the file :file:`spammodule.h` " | ||||
"is rather complicated. However, the basic structure is the same for each " | ||||
"function that is exported, so it has to be learned only once." | ||||
msgstr "" | ||||
| ||||
#: ../Doc/extending/extending.rst:1339 | ||||
#: ../Doc/extending/extending.rst:1340 | ||||
msgid "" | ||||
"Finally it should be mentioned that Capsules offer additional functionality, " | ||||
"which is especially useful for memory allocation and deallocation of the " | ||||
| | @ -1458,30 +1458,30 @@ msgid "" | |||
"in the Python source code distribution)." | ||||
msgstr "" | ||||
| ||||
#: ../Doc/extending/extending.rst:1347 | ||||
#: ../Doc/extending/extending.rst:1348 | ||||
msgid "Footnotes" | ||||
msgstr "Notes" | ||||
| ||||
#: ../Doc/extending/extending.rst:1348 | ||||
#: ../Doc/extending/extending.rst:1349 | ||||
msgid "" | ||||
"An interface for this function already exists in the standard module :mod:" | ||||
"`os` --- it was chosen as a simple and straightforward example." | ||||
msgstr "" | ||||
| ||||
#: ../Doc/extending/extending.rst:1351 | ||||
#: ../Doc/extending/extending.rst:1352 | ||||
msgid "" | ||||
"The metaphor of \"borrowing\" a reference is not completely correct: the " | ||||
"owner still has a copy of the reference." | ||||
msgstr "" | ||||
| ||||
#: ../Doc/extending/extending.rst:1354 | ||||
#: ../Doc/extending/extending.rst:1355 | ||||
msgid "" | ||||
"Checking that the reference count is at least 1 **does not work** --- the " | ||||
"reference count itself could be in freed memory and may thus be reused for " | ||||
"another object!" | ||||
msgstr "" | ||||
| ||||
#: ../Doc/extending/extending.rst:1358 | ||||
#: ../Doc/extending/extending.rst:1359 | ||||
msgid "" | ||||
"These guarantees don't hold when you use the \"old\" style calling " | ||||
"convention --- this is still found in much existing code." | ||||
| | | |||
Loading…
Add table
Add a link
Reference in a new issue