@@ -11,7 +11,7 @@ msgid ""
1111msgstr ""
1212"Project-Id-Version : Python 3.12\n "
1313"Report-Msgid-Bugs-To : \n "
14- "POT-Creation-Date : 2023-07-28 14:13 +0000\n "
14+ "POT-Creation-Date : 2023-07-29 02:08 +0000\n "
1515"PO-Revision-Date : 2021-06-28 00:49+0000\n "
1616"
Last-Translator :
Maciej Olko <[email protected] >, 2023\n "
1717"Language-Team : Polish (https://app.transifex.com/python-doc/teams/5390/pl/)\n "
@@ -1430,6 +1430,89 @@ msgid ""
14301430"following functions:"
14311431msgstr ""
14321432
1433+ msgid ""
1434+ "Structure containing most parameters to configure a sub-interpreter. Its "
1435+ "values are used only in :c:func:`Py_NewInterpreterFromConfig` and never "
1436+ "modified by the runtime."
1437+ msgstr ""
1438+
1439+ msgid "Structure fields:"
1440+ msgstr ""
1441+
1442+ msgid ""
1443+ "If this is ``0`` then the sub-interpreter will use its own \" object\" "
1444+ "allocator state. Otherwise it will use (share) the main interpreter's."
1445+ msgstr ""
1446+
1447+ msgid ""
1448+ "If this is ``0`` then :c:member:`~PyInterpreterConfig."
1449+ "check_multi_interp_extensions` must be ``1`` (non-zero). If this is ``1`` "
1450+ "then :c:member:`~PyInterpreterConfig.gil` must not be :c:macro:"
1451+ "`PyInterpreterConfig_OWN_GIL`."
1452+ msgstr ""
1453+
1454+ msgid ""
1455+ "If this is ``0`` then the runtime will not support forking the process in "
1456+ "any thread where the sub-interpreter is currently active. Otherwise fork is "
1457+ "unrestricted."
1458+ msgstr ""
1459+
1460+ msgid ""
1461+ "Note that the :mod:`subprocess` module still works when fork is disallowed."
1462+ msgstr ""
1463+
1464+ msgid ""
1465+ "If this is ``0`` then the runtime will not support replacing the current "
1466+ "process via exec (e.g. :func:`os.execv`) in any thread where the sub-"
1467+ "interpreter is currently active. Otherwise exec is unrestricted."
1468+ msgstr ""
1469+
1470+ msgid ""
1471+ "Note that the :mod:`subprocess` module still works when exec is disallowed."
1472+ msgstr ""
1473+
1474+ msgid ""
1475+ "If this is ``0`` then the sub-interpreter's :mod:`threading` module won't "
1476+ "create threads. Otherwise threads are allowed."
1477+ msgstr ""
1478+
1479+ msgid ""
1480+ "If this is ``0`` then the sub-interpreter's :mod:`threading` module won't "
1481+ "create daemon threads. Otherwise daemon threads are allowed (as long as :c:"
1482+ "member:`~PyInterpreterConfig.allow_threads` is non-zero)."
1483+ msgstr ""
1484+
1485+ msgid ""
1486+ "If this is ``0`` then all extension modules may be imported, including "
1487+ "legacy (single-phase init) modules, in any thread where the sub-interpreter "
1488+ "is currently active. Otherwise only multi-phase init extension modules (see :"
1489+ "pep:`489`) may be imported."
1490+ msgstr ""
1491+
1492+ msgid ""
1493+ "This must be ``1`` (non-zero) if :c:member:`~PyInterpreterConfig."
1494+ "use_main_obmalloc` is ``0``."
1495+ msgstr ""
1496+
1497+ msgid ""
1498+ "This determines the operation of the GIL for the sub-interpreter. It may be "
1499+ "one of the following:"
1500+ msgstr ""
1501+
1502+ msgid "Use the default selection (:c:macro:`PyInterpreterConfig_SHARED_GIL`)."
1503+ msgstr ""
1504+
1505+ msgid "Use (share) the main interpreter's GIL."
1506+ msgstr ""
1507+
1508+ msgid "Use the sub-interpreter's own GIL."
1509+ msgstr ""
1510+
1511+ msgid ""
1512+ "If this is :c:macro:`PyInterpreterConfig_OWN_GIL` then :c:member:"
1513+ "`PyInterpreterConfig.use_main_obmalloc` must be ``0``."
1514+ msgstr ""
1515+
14331516msgid ""
14341517"Create a new sub-interpreter. This is an (almost) totally separate "
14351518"environment for the execution of Python code. In particular, the new "
@@ -1443,16 +1526,41 @@ msgid ""
14431526msgstr ""
14441527
14451528msgid ""
1446- "The return value points to the first thread state created in the new sub-"
1447- "interpreter. This thread state is made in the current thread state. Note "
1448- "that no actual thread is created; see the discussion of thread states "
1449- "below. If creation of the new interpreter is unsuccessful, ``NULL`` is "
1450- "returned; no exception is set since the exception state is stored in the "
1451- "current thread state and there may not be a current thread state. (Like all "
1452- "other Python/C API functions, the global interpreter lock must be held "
1453- "before calling this function and is still held when it returns; however, "
1454- "unlike most other Python/C API functions, there needn't be a current thread "
1455- "state on entry.)"
1529+ "The given *config* controls the options with which the interpreter is "
1530+ "initialized."
1531+ msgstr ""
1532+
1533+ msgid ""
1534+ "Upon success, *tstate_p* will be set to the first thread state created in "
1535+ "the new sub-interpreter. This thread state is made in the current thread "
1536+ "state. Note that no actual thread is created; see the discussion of thread "
1537+ "states below. If creation of the new interpreter is unsuccessful, "
1538+ "*tstate_p* is set to ``NULL``; no exception is set since the exception state "
1539+ "is stored in the current thread state and there may not be a current thread "
1540+ "state."
1541+ msgstr ""
1542+
1543+ msgid ""
1544+ "Like all other Python/C API functions, the global interpreter lock must be "
1545+ "held before calling this function and is still held when it returns. "
1546+ "Likewise a current thread state must be set on entry. On success, the "
1547+ "returned thread state will be set as current. If the sub-interpreter is "
1548+ "created with its own GIL then the GIL of the calling interpreter will be "
1549+ "released. When the function returns, the new interpreter's GIL will be held "
1550+ "by the current thread and the previously interpreter's GIL will remain "
1551+ "released here."
1552+ msgstr ""
1553+
1554+ msgid ""
1555+ "Sub-interpreters are most effective when isolated from each other, with "
1556+ "certain functionality restricted::"
1557+ msgstr ""
1558+
1559+ msgid ""
1560+ "Note that the config is used only briefly and does not get modified. During "
1561+ "initialization the config's values are converted into various :c:type:"
1562+ "`PyInterpreterState` values. A read-only copy of the config may be stored "
1563+ "internally on the :c:type:`PyInterpreterState`."
14561564msgstr ""
14571565
14581566msgid "Extension modules are shared between (sub-)interpreters as follows:"
@@ -1485,15 +1593,69 @@ msgid ""
14851593"shared between these modules."
14861594msgstr ""
14871595
1596+ msgid ""
1597+ "Create a new sub-interpreter. This is essentially just a wrapper around :c:"
1598+ "func:`Py_NewInterpreterFromConfig` with a config that preserves the existing "
1599+ "behavior. The result is an unisolated sub-interpreter that shares the main "
1600+ "interpreter's GIL, allows fork/exec, allows daemon threads, and allows "
1601+ "single-phase init modules."
1602+ msgstr ""
1603+
14881604msgid ""
14891605"Destroy the (sub-)interpreter represented by the given thread state. The "
14901606"given thread state must be the current thread state. See the discussion of "
14911607"thread states below. When the call returns, the current thread state is "
14921608"``NULL``. All thread states associated with this interpreter are "
1493- "destroyed. (The global interpreter lock must be held before calling this "
1494- "function and is still held when it returns.) :c:func:`Py_FinalizeEx` will "
1495- "destroy all sub-interpreters that haven't been explicitly destroyed at that "
1496- "point."
1609+ "destroyed. The global interpreter lock used by the target interpreter must "
1610+ "be held before calling this function. No GIL is held when it returns."
1611+ msgstr ""
1612+
1613+ msgid ""
1614+ ":c:func:`Py_FinalizeEx` will destroy all sub-interpreters that haven't been "
1615+ "explicitly destroyed at that point."
1616+ msgstr ""
1617+
1618+ msgid "A Per-Interpreter GIL"
1619+ msgstr ""
1620+
1621+ msgid ""
1622+ "Using :c:func:`Py_NewInterpreterFromConfig` you can create a sub-interpreter "
1623+ "that is completely isolated from other interpreters, including having its "
1624+ "own GIL. The most important benefit of this isolation is that such an "
1625+ "interpreter can execute Python code without being blocked by other "
1626+ "interpreters or blocking any others. Thus a single Python process can truly "
1627+ "take advantage of multiple CPU cores when running Python code. The "
1628+ "isolation also encourages a different approach to concurrency than that of "
1629+ "just using threads. (See :pep:`554`.)"
1630+ msgstr ""
1631+
1632+ msgid ""
1633+ "Using an isolated interpreter requires vigilance in preserving that "
1634+ "isolation. That especially means not sharing any objects or mutable state "
1635+ "without guarantees about thread-safety. Even objects that are otherwise "
1636+ "immutable (e.g. ``None``, ``(1, 5)``) can't normally be shared because of "
1637+ "the refcount. One simple but less-efficient approach around this is to use "
1638+ "a global lock around all use of some state (or object). Alternately, "
1639+ "effectively immutable objects (like integers or strings) can be made safe in "
1640+ "spite of their refcounts by making them \" immortal\" . In fact, this has been "
1641+ "done for the builtin singletons, small integers, and a number of other "
1642+ "builtin objects."
1643+ msgstr ""
1644+
1645+ msgid ""
1646+ "If you preserve isolation then you will have access to proper multi-core "
1647+ "computing without the complications that come with free-threading. Failure "
1648+ "to preserve isolation will expose you to the full consequences of free-"
1649+ "threading, including races and hard-to-debug crashes."
1650+ msgstr ""
1651+
1652+ msgid ""
1653+ "Aside from that, one of the main challenges of using multiple isolated "
1654+ "interpreters is how to communicate between them safely (not break isolation) "
1655+ "and efficiently. The runtime and stdlib do not provide any standard "
1656+ "approach to this yet. A future stdlib module would help mitigate the effort "
1657+ "of preserving isolation and expose effective tools for communicating (and "
1658+ "sharing) data between interpreters."
14971659msgstr ""
14981660
14991661msgid "Bugs and caveats"
0 commit comments