| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 247360b commit c9f2b76
41 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -8,7 +8,7 @@ msgid "" | |||
| 8 | 8 | msgstr "" | |
| 9 | 9 | "Project-Id-Version: Python 3.14\n" | |
| 10 | 10 | "Report-Msgid-Bugs-To: \n" | |
| 11 | - "POT-Creation-Date: 2025-05-16 14:19+0000\n" | ||
| 11 | + "POT-Creation-Date: 2025-05-23 14:20+0000\n" | ||
| 12 | 12 | "PO-Revision-Date: 2021-06-28 00:47+0000\n" | |
| 13 | 13 | "Language-Team: German (https://app.transifex.com/python-doc/teams/5390/de/)\n" | |
| 14 | 14 | "MIME-Version: 1.0\n" | |
@@ -23,7 +23,22 @@ msgstr "" | |||
| 23 | 23 | msgid "" | |
| 24 | 24 | "Initialize a newly allocated object *op* with its type and initial " | |
| 25 | 25 | "reference. Returns the initialized object. Other fields of the object are " | |
| 26 | - "not affected." | ||
| 26 | + "not initialized. Despite its name, this function is unrelated to the " | ||
| 27 | + "object's :meth:`~object.__init__` method (:c:member:`~PyTypeObject.tp_init` " | ||
| 28 | + "slot). Specifically, this function does **not** call the object's :meth:`!" | ||
| 29 | + "__init__` method." | ||
| 30 | + msgstr "" | ||
| 31 | + | ||
| 32 | + msgid "" | ||
| 33 | + "In general, consider this function to be a low-level routine. Use :c:member:" | ||
| 34 | + "`~PyTypeObject.tp_alloc` where possible. For implementing :c:member:`!" | ||
| 35 | + "tp_alloc` for your type, prefer :c:func:`PyType_GenericAlloc` or :c:func:" | ||
| 36 | + "`PyObject_New`." | ||
| 37 | + msgstr "" | ||
| 38 | + | ||
| 39 | + msgid "" | ||
| 40 | + "This function only initializes the object's memory corresponding to the " | ||
| 41 | + "initial :c:type:`PyObject` structure. It does not zero the rest." | ||
| 27 | 42 | msgstr "" | |
| 28 | 43 | ||
| 29 | 44 | msgid "" | |
@@ -32,36 +47,106 @@ msgid "" | |||
| 32 | 47 | msgstr "" | |
| 33 | 48 | ||
| 34 | 49 | msgid "" | |
| 35 | - "Allocate a new Python object using the C structure type *TYPE* and the " | ||
| 36 | - "Python type object *typeobj* (``PyTypeObject*``). Fields not defined by the " | ||
| 37 | - "Python object header are not initialized. The caller will own the only " | ||
| 38 | - "reference to the object (i.e. its reference count will be one). The size of " | ||
| 39 | - "the memory allocation is determined from the :c:member:`~PyTypeObject." | ||
| 40 | - "tp_basicsize` field of the type object." | ||
| 50 | + "This function only initializes some of the object's memory. It does not " | ||
| 51 | + "zero the rest." | ||
| 52 | + msgstr "" | ||
| 53 | + | ||
| 54 | + msgid "" | ||
| 55 | + "Allocates a new Python object using the C structure type *TYPE* and the " | ||
| 56 | + "Python type object *typeobj* (``PyTypeObject*``) by calling :c:func:" | ||
| 57 | + "`PyObject_Malloc` to allocate memory and initializing it like :c:func:" | ||
| 58 | + "`PyObject_Init`. The caller will own the only reference to the object (i.e. " | ||
| 59 | + "its reference count will be one)." | ||
| 60 | + msgstr "" | ||
| 61 | + | ||
| 62 | + msgid "" | ||
| 63 | + "Avoid calling this directly to allocate memory for an object; call the " | ||
| 64 | + "type's :c:member:`~PyTypeObject.tp_alloc` slot instead." | ||
| 65 | + msgstr "" | ||
| 66 | + | ||
| 67 | + msgid "" | ||
| 68 | + "When populating a type's :c:member:`~PyTypeObject.tp_alloc` slot, :c:func:" | ||
| 69 | + "`PyType_GenericAlloc` is preferred over a custom function that simply calls " | ||
| 70 | + "this macro." | ||
| 71 | + msgstr "" | ||
| 72 | + | ||
| 73 | + msgid "" | ||
| 74 | + "This macro does not call :c:member:`~PyTypeObject.tp_alloc`, :c:member:" | ||
| 75 | + "`~PyTypeObject.tp_new` (:meth:`~object.__new__`), or :c:member:" | ||
| 76 | + "`~PyTypeObject.tp_init` (:meth:`~object.__init__`)." | ||
| 77 | + msgstr "" | ||
| 78 | + | ||
| 79 | + msgid "" | ||
| 80 | + "This cannot be used for objects with :c:macro:`Py_TPFLAGS_HAVE_GC` set in :c:" | ||
| 81 | + "member:`~PyTypeObject.tp_flags`; use :c:macro:`PyObject_GC_New` instead." | ||
| 82 | + msgstr "" | ||
| 83 | + | ||
| 84 | + msgid "" | ||
| 85 | + "Memory allocated by this macro must be freed with :c:func:`PyObject_Free` " | ||
| 86 | + "(usually called via the object's :c:member:`~PyTypeObject.tp_free` slot)." | ||
| 87 | + msgstr "" | ||
| 88 | + | ||
| 89 | + msgid "" | ||
| 90 | + "The returned memory is not guaranteed to have been completely zeroed before " | ||
| 91 | + "it was initialized." | ||
| 92 | + msgstr "" | ||
| 93 | + | ||
| 94 | + msgid "" | ||
| 95 | + "This macro does not construct a fully initialized object of the given type; " | ||
| 96 | + "it merely allocates memory and prepares it for further initialization by :c:" | ||
| 97 | + "member:`~PyTypeObject.tp_init`. To construct a fully initialized object, " | ||
| 98 | + "call *typeobj* instead. For example::" | ||
| 99 | + msgstr "" | ||
| 100 | + | ||
| 101 | + msgid "PyObject *foo = PyObject_CallNoArgs((PyObject *)&PyFoo_Type);" | ||
| 102 | + msgstr "" | ||
| 103 | + | ||
| 104 | + msgid ":c:func:`PyObject_Free`" | ||
| 105 | + msgstr "" | ||
| 106 | + | ||
| 107 | + msgid ":c:macro:`PyObject_GC_New`" | ||
| 108 | + msgstr "" | ||
| 109 | + | ||
| 110 | + msgid ":c:func:`PyType_GenericAlloc`" | ||
| 111 | + msgstr "" | ||
| 112 | + | ||
| 113 | + msgid ":c:member:`~PyTypeObject.tp_alloc`" | ||
| 114 | + msgstr "" | ||
| 115 | + | ||
| 116 | + msgid "Like :c:macro:`PyObject_New` except:" | ||
| 117 | + msgstr "" | ||
| 118 | + | ||
| 119 | + msgid "" | ||
| 120 | + "It allocates enough memory for the *TYPE* structure plus *size* " | ||
| 121 | + "(``Py_ssize_t``) fields of the size given by the :c:member:`~PyTypeObject." | ||
| 122 | + "tp_itemsize` field of *typeobj*." | ||
| 123 | + msgstr "" | ||
| 124 | + | ||
| 125 | + msgid "The memory is initialized like :c:func:`PyObject_InitVar`." | ||
| 126 | + msgstr "" | ||
| 127 | + | ||
| 128 | + msgid "" | ||
| 129 | + "This is useful for implementing objects like tuples, which are able to " | ||
| 130 | + "determine their size at construction time. Embedding the array of fields " | ||
| 131 | + "into the same allocation decreases the number of allocations, improving the " | ||
| 132 | + "memory management efficiency." | ||
| 41 | 133 | msgstr "" | |
| 42 | 134 | ||
| 43 | 135 | msgid "" | |
| 44 | - "Note that this function is unsuitable if *typeobj* has :c:macro:" | ||
| 45 | - "`Py_TPFLAGS_HAVE_GC` set. For such objects, use :c:func:`PyObject_GC_New` " | ||
| 46 | - "instead." | ||
| 136 | + "This cannot be used for objects with :c:macro:`Py_TPFLAGS_HAVE_GC` set in :c:" | ||
| 137 | + "member:`~PyTypeObject.tp_flags`; use :c:macro:`PyObject_GC_NewVar` instead." | ||
| 47 | 138 | msgstr "" | |
| 48 | 139 | ||
| 49 | 140 | msgid "" | |
| 50 | - "Allocate a new Python object using the C structure type *TYPE* and the " | ||
| 51 | - "Python type object *typeobj* (``PyTypeObject*``). Fields not defined by the " | ||
| 52 | - "Python object header are not initialized. The allocated memory allows for " | ||
| 53 | - "the *TYPE* structure plus *size* (``Py_ssize_t``) fields of the size given " | ||
| 54 | - "by the :c:member:`~PyTypeObject.tp_itemsize` field of *typeobj*. This is " | ||
| 55 | - "useful for implementing objects like tuples, which are able to determine " | ||
| 56 | - "their size at construction time. Embedding the array of fields into the " | ||
| 57 | - "same allocation decreases the number of allocations, improving the memory " | ||
| 58 | - "management efficiency." | ||
| 141 | + "Memory allocated by this function must be freed with :c:func:`PyObject_Free` " | ||
| 142 | + "(usually called via the object's :c:member:`~PyTypeObject.tp_free` slot)." | ||
| 59 | 143 | msgstr "" | |
| 60 | 144 | ||
| 61 | 145 | msgid "" | |
| 62 | - "Note that this function is unsuitable if *typeobj* has :c:macro:" | ||
| 63 | - "`Py_TPFLAGS_HAVE_GC` set. For such objects, use :c:func:`PyObject_GC_NewVar` " | ||
| 64 | - "instead." | ||
| 146 | + "PyObject *list_instance = PyObject_CallNoArgs((PyObject *)&PyList_Type);" | ||
| 147 | + msgstr "" | ||
| 148 | + | ||
| 149 | + msgid ":c:macro:`PyObject_GC_NewVar`" | ||
| 65 | 150 | msgstr "" | |
| 66 | 151 | ||
| 67 | 152 | msgid "Same as :c:func:`PyObject_Free`." | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -8,7 +8,7 @@ msgid "" | |||
| 8 | 8 | msgstr "" | |
| 9 | 9 | "Project-Id-Version: Python 3.14\n" | |
| 10 | 10 | "Report-Msgid-Bugs-To: \n" | |
| 11 | - "POT-Creation-Date: 2025-05-16 14:19+0000\n" | ||
| 11 | + "POT-Creation-Date: 2025-05-23 14:20+0000\n" | ||
| 12 | 12 | "PO-Revision-Date: 2021-06-28 00:48+0000\n" | |
| 13 | 13 | "Language-Team: German (https://app.transifex.com/python-doc/teams/5390/de/)\n" | |
| 14 | 14 | "MIME-Version: 1.0\n" | |
@@ -94,11 +94,42 @@ msgid "" | |||
| 94 | 94 | "macro:`Py_TPFLAGS_HAVE_GC` flag set." | |
| 95 | 95 | msgstr "" | |
| 96 | 96 | ||
| 97 | + msgid "" | ||
| 98 | + "Do not call this directly to allocate memory for an object; call the type's :" | ||
| 99 | + "c:member:`~PyTypeObject.tp_alloc` slot instead." | ||
| 100 | + msgstr "" | ||
| 101 | + | ||
| 102 | + msgid "" | ||
| 103 | + "When populating a type's :c:member:`~PyTypeObject.tp_alloc` slot, :c:func:" | ||
| 104 | + "`PyType_GenericAlloc` is preferred over a custom function that simply calls " | ||
| 105 | + "this macro." | ||
| 106 | + msgstr "" | ||
| 107 | + | ||
| 108 | + msgid "" | ||
| 109 | + "Memory allocated by this macro must be freed with :c:func:`PyObject_GC_Del` " | ||
| 110 | + "(usually called via the object's :c:member:`~PyTypeObject.tp_free` slot)." | ||
| 111 | + msgstr "" | ||
| 112 | + | ||
| 113 | + msgid ":c:func:`PyObject_GC_Del`" | ||
| 114 | + msgstr "" | ||
| 115 | + | ||
| 116 | + msgid ":c:macro:`PyObject_New`" | ||
| 117 | + msgstr "" | ||
| 118 | + | ||
| 119 | + msgid ":c:func:`PyType_GenericAlloc`" | ||
| 120 | + msgstr "" | ||
| 121 | + | ||
| 122 | + msgid ":c:member:`~PyTypeObject.tp_alloc`" | ||
| 123 | + msgstr "" | ||
| 124 | + | ||
| 97 | 125 | msgid "" | |
| 98 | 126 | "Analogous to :c:macro:`PyObject_NewVar` but for container objects with the :" | |
| 99 | 127 | "c:macro:`Py_TPFLAGS_HAVE_GC` flag set." | |
| 100 | 128 | msgstr "" | |
| 101 | 129 | ||
| 130 | + msgid ":c:macro:`PyObject_NewVar`" | ||
| 131 | + msgstr "" | ||
| 132 | + | ||
| 102 | 133 | msgid "" | |
| 103 | 134 | "Analogous to :c:macro:`PyObject_GC_New` but allocates *extra_size* bytes at " | |
| 104 | 135 | "the end of the object (at offset :c:member:`~PyTypeObject.tp_basicsize`). " | |
@@ -111,6 +142,12 @@ msgid "" | |||
| 111 | 142 | "managed by Python." | |
| 112 | 143 | msgstr "" | |
| 113 | 144 | ||
| 145 | + msgid "" | ||
| 146 | + "Memory allocated by this function must be freed with :c:func:" | ||
| 147 | + "`PyObject_GC_Del` (usually called via the object's :c:member:`~PyTypeObject." | ||
| 148 | + "tp_free` slot)." | ||
| 149 | + msgstr "" | ||
| 150 | + | ||
| 114 | 151 | msgid "" | |
| 115 | 152 | "The function is marked as unstable because the final mechanism for reserving " | |
| 116 | 153 | "extra data after an instance is not yet decided. For allocating a variable " | |
@@ -168,6 +205,29 @@ msgid "" | |||
| 168 | 205 | "c:macro:`PyObject_GC_NewVar`." | |
| 169 | 206 | msgstr "" | |
| 170 | 207 | ||
| 208 | + msgid "" | ||
| 209 | + "Do not call this directly to free an object's memory; call the type's :c:" | ||
| 210 | + "member:`~PyTypeObject.tp_free` slot instead." | ||
| 211 | + msgstr "" | ||
| 212 | + | ||
| 213 | + msgid "" | ||
| 214 | + "Do not use this for memory allocated by :c:macro:`PyObject_New`, :c:macro:" | ||
| 215 | + "`PyObject_NewVar`, or related allocation functions; use :c:func:" | ||
| 216 | + "`PyObject_Free` instead." | ||
| 217 | + msgstr "" | ||
| 218 | + | ||
| 219 | + msgid ":c:func:`PyObject_Free` is the non-GC equivalent of this function." | ||
| 220 | + msgstr "" | ||
| 221 | + | ||
| 222 | + msgid ":c:macro:`PyObject_GC_New`" | ||
| 223 | + msgstr "" | ||
| 224 | + | ||
| 225 | + msgid ":c:macro:`PyObject_GC_NewVar`" | ||
| 226 | + msgstr "" | ||
| 227 | + | ||
| 228 | + msgid ":c:member:`~PyTypeObject.tp_free`" | ||
| 229 | + msgstr "" | ||
| 230 | + | ||
| 171 | 231 | msgid "" | |
| 172 | 232 | "Remove the object *op* from the set of container objects tracked by the " | |
| 173 | 233 | "collector. Note that :c:func:`PyObject_GC_Track` can be called again on " | |
@@ -218,9 +278,10 @@ msgid "" | |||
| 218 | 278 | msgstr "" | |
| 219 | 279 | ||
| 220 | 280 | msgid "" | |
| 221 | - "If *o* is not ``NULL``, call the *visit* callback, with arguments *o* and " | ||
| 222 | - "*arg*. If *visit* returns a non-zero value, then return it. Using this " | ||
| 223 | - "macro, :c:member:`~PyTypeObject.tp_traverse` handlers look like::" | ||
| 281 | + "If the :c:expr:`PyObject *` *o* is not ``NULL``, call the *visit* callback, " | ||
| 282 | + "with arguments *o* and *arg*. If *visit* returns a non-zero value, then " | ||
| 283 | + "return it. Using this macro, :c:member:`~PyTypeObject.tp_traverse` handlers " | ||
| 284 | + "look like::" | ||
| 224 | 285 | msgstr "" | |
| 225 | 286 | ||
| 226 | 287 | msgid "" | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -11,7 +11,7 @@ msgid "" | |||
| 11 | 11 | msgstr "" | |
| 12 | 12 | "Project-Id-Version: Python 3.14\n" | |
| 13 | 13 | "Report-Msgid-Bugs-To: \n" | |
| 14 | - "POT-Creation-Date: 2025-05-16 14:19+0000\n" | ||
| 14 | + "POT-Creation-Date: 2025-05-23 14:20+0000\n" | ||
| 15 | 15 | "PO-Revision-Date: 2021-06-28 00:49+0000\n" | |
| 16 | 16 | "Last-Translator: Jo K, 2023\n" | |
| 17 | 17 | "Language-Team: German (https://app.transifex.com/python-doc/teams/5390/de/)\n" | |
@@ -1166,7 +1166,43 @@ msgid "" | |||
| 1166 | 1166 | "interpreter (created automatically by :c:func:`Py_Initialize`). Python " | |
| 1167 | 1167 | "supports the creation of additional interpreters (using :c:func:" | |
| 1168 | 1168 | "`Py_NewInterpreter`), but mixing multiple interpreters and the " | |
| 1169 | - "``PyGILState_*`` API is unsupported." | ||
| 1169 | + "``PyGILState_*`` API is unsupported. This is because :c:func:" | ||
| 1170 | + "`PyGILState_Ensure` and similar functions default to :term:`attaching " | ||
| 1171 | + "<attached thread state>` a :term:`thread state` for the main interpreter, " | ||
| 1172 | + "meaning that the thread can't safely interact with the calling " | ||
| 1173 | + "subinterpreter." | ||
| 1174 | + msgstr "" | ||
| 1175 | + | ||
| 1176 | + msgid "Supporting subinterpreters in non-Python threads" | ||
| 1177 | + msgstr "" | ||
| 1178 | + | ||
| 1179 | + msgid "" | ||
| 1180 | + "If you would like to support subinterpreters with non-Python created " | ||
| 1181 | + "threads, you must use the ``PyThreadState_*`` API instead of the traditional " | ||
| 1182 | + "``PyGILState_*`` API." | ||
| 1183 | + msgstr "" | ||
| 1184 | + | ||
| 1185 | + msgid "" | ||
| 1186 | + "In particular, you must store the interpreter state from the calling " | ||
| 1187 | + "function and pass it to :c:func:`PyThreadState_New`, which will ensure that " | ||
| 1188 | + "the :term:`thread state` is targeting the correct interpreter::" | ||
| 1189 | + msgstr "" | ||
| 1190 | + | ||
| 1191 | + msgid "" | ||
| 1192 | + "/* The return value of PyInterpreterState_Get() from the\n" | ||
| 1193 | + " function that created this thread. */\n" | ||
| 1194 | + "PyInterpreterState *interp = ThreadData->interp;\n" | ||
| 1195 | + "PyThreadState *tstate = PyThreadState_New(interp);\n" | ||
| 1196 | + "PyThreadState_Swap(tstate);\n" | ||
| 1197 | + "\n" | ||
| 1198 | + "/* GIL of the subinterpreter is now held.\n" | ||
| 1199 | + " Perform Python actions here. */\n" | ||
| 1200 | + "result = CallSomeFunction();\n" | ||
| 1201 | + "/* evaluate result or handle exception */\n" | ||
| 1202 | + "\n" | ||
| 1203 | + "/* Destroy the thread state. No Python API allowed beyond this point. */\n" | ||
| 1204 | + "PyThreadState_Clear(tstate);\n" | ||
| 1205 | + "PyThreadState_DeleteCurrent();" | ||
| 1170 | 1206 | msgstr "" | |
| 1171 | 1207 | ||
| 1172 | 1208 | msgid "Cautions about fork()" | |
@@ -1344,6 +1380,11 @@ msgid "" | |||
| 1344 | 1380 | "will simply return ``NULL`` indicating that there was no prior thread state." | |
| 1345 | 1381 | msgstr "" | |
| 1346 | 1382 | ||
| 1383 | + msgid "" | ||
| 1384 | + "Similar to :c:func:`PyGILState_Ensure`, this function will hang the thread " | ||
| 1385 | + "if the runtime is finalizing." | ||
| 1386 | + msgstr "" | ||
| 1387 | + | ||
| 1347 | 1388 | msgid "" | |
| 1348 | 1389 | "The following functions use thread-local storage, and are not compatible " | |
| 1349 | 1390 | "with sub-interpreters:" | |
@@ -1376,6 +1417,13 @@ msgid "" | |||
| 1376 | 1417 | "fatal error." | |
| 1377 | 1418 | msgstr "" | |
| 1378 | 1419 | ||
| 1420 | + msgid "" | ||
| 1421 | + "Calling this function when the runtime is finalizing is unsafe. Doing so " | ||
| 1422 | + "will either hang the thread until the program ends, or fully crash the " | ||
| 1423 | + "interpreter in rare cases. Refer to :ref:`cautions-regarding-runtime-" | ||
| 1424 | + "finalization` for more details." | ||
| 1425 | + msgstr "" | ||
| 1426 | + | ||
| 1379 | 1427 | msgid "" | |
| 1380 | 1428 | "Release any resources previously acquired. After this call, Python's state " | |
| 1381 | 1429 | "will be the same as it was prior to the corresponding :c:func:" | |
@@ -1395,14 +1443,28 @@ msgid "" | |||
| 1395 | 1443 | "been made on the main thread. This is mainly a helper/diagnostic function." | |
| 1396 | 1444 | msgstr "" | |
| 1397 | 1445 | ||
| 1446 | + msgid "" | ||
| 1447 | + "This function does not account for :term:`thread states <thread state>` " | ||
| 1448 | + "created by something other than :c:func:`PyGILState_Ensure` (such as :c:func:" | ||
| 1449 | + "`PyThreadState_New`). Prefer :c:func:`PyThreadState_Get` or :c:func:" | ||
| 1450 | + "`PyThreadState_GetUnchecked` for most cases." | ||
| 1451 | + msgstr "" | ||
| 1452 | + | ||
| 1398 | 1453 | msgid "" | |
| 1399 | 1454 | "Return ``1`` if the current thread is holding the :term:`GIL` and ``0`` " | |
| 1400 | 1455 | "otherwise. This function can be called from any thread at any time. Only if " | |
| 1401 | - "it has had its Python thread state initialized and currently is holding the :" | ||
| 1402 | - "term:`GIL` will it return ``1``. This is mainly a helper/diagnostic " | ||
| 1403 | - "function. It can be useful for example in callback contexts or memory " | ||
| 1404 | - "allocation functions when knowing that the :term:`GIL` is locked can allow " | ||
| 1405 | - "the caller to perform sensitive actions or otherwise behave differently." | ||
| 1456 | + "it has had its :term:`thread state <attached thread state>` initialized via :" | ||
| 1457 | + "c:func:`PyGILState_Ensure` will it return ``1``. This is mainly a helper/" | ||
| 1458 | + "diagnostic function. It can be useful for example in callback contexts or " | ||
| 1459 | + "memory allocation functions when knowing that the :term:`GIL` is locked can " | ||
| 1460 | + "allow the caller to perform sensitive actions or otherwise behave " | ||
| 1461 | + "differently." | ||
| 1462 | + msgstr "" | ||
| 1463 | + | ||
| 1464 | + msgid "" | ||
| 1465 | + "If the current Python process has ever created a subinterpreter, this " | ||
| 1466 | + "function will *always* return ``1``. Prefer :c:func:" | ||
| 1467 | + "`PyThreadState_GetUnchecked` for most cases." | ||
| 1406 | 1468 | msgstr "" | |
| 1407 | 1469 | ||
| 1408 | 1470 | msgid "" | |
| Back | FazBrowse Home | New Git URL |
0 commit comments