{"id":467436,"date":"2025-07-18T21:17:42","date_gmt":"2025-07-18T21:17:42","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=467436"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=467436","title":{"rendered":"<span>\u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u043e\u0432 \u0432 \u043a\u043e\u0434\u0435 \u043d\u0430 Python \u2014 \u043d\u0435\u0432\u0435\u0440\u043e\u044f\u0442\u043d\u0430\u044f \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>5 \u0438\u044e\u043d\u044f 2025 \u0433\u043e\u0434\u0430 \u0431\u044b\u043b \u043f\u0440\u0438\u043d\u044f\u0442 <a href=\"https:\/\/peps.python.org\/pep-0734\/\" rel=\"noopener noreferrer nofollow\">PEP-0734<\/a>. \u0421\u0443\u0434\u044f \u043f\u043e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043d\u0430 \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u043c \u0441\u0430\u0439\u0442\u0435, \u043e\u043d \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0435\u043d\u0438\u0435\u043c <a href=\"https:\/\/peps.python.org\/pep-0554\/\" rel=\"noopener noreferrer nofollow\">PEP-0554<\/a>. \u042d\u0442\u043e\u0442 PEP \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u0442 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043d\u043e\u0432\u044b\u0439 \u043c\u043e\u0434\u0443\u043b\u044c <code>interpreters<\/code> \u0434\u043b\u044f \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438, \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u043a\u043e\u0434\u0430 \u0432 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u0430\u0445 \u0432 \u0442\u0435\u043a\u0443\u0449\u0435\u043c \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435. \u0410 \u0435\u0441\u043b\u0438 \u0438\u0434\u0442\u0438 \u0434\u0430\u043b\u044c\u0448\u0435, \u0442\u043e \u043e\u043d \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0435\u043d\u0438\u0435\u043c <a href=\"https:\/\/peps.python.org\/pep-0684\/\" rel=\"noopener noreferrer nofollow\">PEP-0684<\/a>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u0442 \u043e\u0434\u0438\u043d GIL \u043d\u0430 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440.<\/p>\n<p>\u041d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u043b\u043d\u043e\u0446\u0435\u043d\u043d\u044b\u0445 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u043e\u0432 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0438\u0445 \u0440\u044f\u0434\u043e\u043c. \u041a\u0430\u043a\u0438\u0435 \u043f\u043b\u044e\u0441\u044b?<\/p>\n<ul>\n<li>\n<p>\u041e\u0434\u0438\u043d \u043f\u0440\u043e\u0446\u0435\u0441\u0441;<\/p>\n<\/li>\n<li>\n<p>\u041e\u0434\u0438\u043d \u0442\u0440\u0435\u0434, \u043d\u043e \u0440\u0443\u043a\u0430\u043c\u0438 \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0435\u0449\u0435;<\/p>\n<\/li>\n<li>\n<p>\u0414\u0430\u043d\u043d\u044b\u0435 \u043c\u0435\u0436\u0434\u0443 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u0430\u043c\u0438 \u0432\u0441\u0435\u0433\u0434\u0430 \u043f\u0435\u0440\u0435\u0434\u0430\u044e\u0442\u0441\u044f \u0447\u0435\u0440\u0435\u0437 \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e, \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u0443\u044e pickle, \u0432\u043a\u043b\u044e\u0447\u0430\u044f \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u043d\u044b\u0435 \u0442\u0438\u043f\u044b;<\/p>\n<\/li>\n<li>\n<p>\u041f\u043e GIL\u0443 \u043d\u0430 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440, \u0432\u0441\u0435 \u0435\u0449\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043f\u043b\u044e\u0448\u043a\u0438 \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0435\u0439 \u043c\u043d\u043e\u0433\u043e\u0437\u0430\u0434\u0430\u0447\u043d\u043e\u0441\u0442\u0438 \u043f\u043e \u0441\u0435\u0442\u0438;<\/p>\n<\/li>\n<li>\n<p>\u0420\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441 asyncio.<\/p>\n<\/li>\n<\/ul>\n<blockquote>\n<p>GIL (Global Interpreter Lock) \u0432 Python \u2014 \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u0430\u044f \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0430 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u0430. \u042d\u0442\u043e \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c, \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0439 \u0432 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0443\u044e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e Python (CPython), \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u0435\u0434\u043e\u0442\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0431\u0430\u0439\u0442-\u043a\u043e\u0434\u0430 Python \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u043c\u0438 \u043f\u043e\u0442\u043e\u043a\u0430\u043c\u0438.<\/p>\n<\/blockquote>\n<p>\u0421\u0440\u0435\u0434\u0438 \u043c\u0438\u043d\u0443\u0441\u043e\u0432 \u2014 \u0434\u0430\u043d\u043d\u044b\u0439 PEP \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0438\u0437\u043c\u0435\u043d\u0438\u043b C-\u043a\u043e\u0434, \u0438 \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0435 \u0432\u0441\u0435\u0433\u0434\u0430 \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0441\u0442\u0430\u0431\u0438\u043b\u044c\u043d\u043e\u0441\u0442\u044c C-\u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0439. \u041a\u0441\u0442\u0430\u0442\u0438, \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u0438\u0445 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c, \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u043b \u0432 <a href=\"https:\/\/habr.com\/ru\/companies\/timeweb\/articles\/875420\/\" rel=\"noopener noreferrer nofollow\">\u0441\u0432\u043e\u0435\u0439 \u043f\u0440\u043e\u0448\u043b\u043e\u0439  \u0441\u0442\u0430\u0442\u044c\u0435<\/a>.<\/p>\n<p>\u0415\u0441\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u0430\u0436\u043d\u044b\u0445 \u043d\u0435\u0442\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0430\u0441\u043f\u0435\u043a\u0442\u043e\u0432 \u043f\u0440\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u043e\u0439 \u0444\u0438\u0447\u0438:<\/p>\n<ul>\n<li>\n<p>PEP-734 \u0438 Free-Threading \u0434\u0435\u043b\u0430\u044e\u0442 \u043e\u0447\u0435\u043d\u044c \u043f\u043e\u0445\u043e\u0436\u0438\u0435 \u0432\u0435\u0449\u0438 \u2013 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u044b\u0432\u0430\u0442\u044c \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0443\u044e \u043c\u043d\u043e\u0433\u043e\u0437\u0430\u0434\u0430\u0447\u043d\u043e\u0441\u0442\u044c, \u043d\u043e \u0440\u0430\u0437\u043d\u044b\u043c\u0438 \u0441\u043f\u043e\u0441\u043e\u0431\u0430\u043c\u0438;<\/p>\n<\/li>\n<li>\n<p>\u0418\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u0441\u0443\u0431\u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u044b \u043f\u043e\u044f\u0432\u0438\u043b\u0438\u0441\u044c \u0432 3.10 \u0432 \u0432\u0438\u0434\u0435 \u0442\u043e\u043b\u044c\u043a\u043e C-API;<\/p>\n<\/li>\n<li>\n<p>\u0415\u0441\u0442\u044c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 PyPI \u043f\u0430\u043a\u0435\u0442 (<a href=\"https:\/\/pypi.org\/project\/interpreters-pep-734\/\" rel=\"noopener noreferrer nofollow\">https:\/\/pypi.org\/project\/interpreters-pep-734\/<\/a>) \u0441 \u0434\u0430\u043d\u043d\u044b\u043c \u043a\u043e\u0434\u043e\u043c;<\/p>\n<\/li>\n<li>\n<p>Python \u0447\u0430\u0441\u0442\u044c \u0432 \u0432\u0438\u0434\u0435 PEP-734 \u0431\u044b\u043b \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d \u0432 3.14 \u0443\u0436\u0435 \u043f\u043e\u0441\u043b\u0435 feature freeze;<\/p>\n<\/li>\n<li>\n<p>\u0418\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043b\u043e\u0441\u044c \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0435\u0433\u043e \u043a\u0430\u043a \u043c\u043e\u0434\u0443\u043b\u044c <code>interpreters<\/code>, \u043e\u0434\u043d\u0430\u043a\u043e \u0432 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u043e\u043d \u0441\u0442\u0430\u043b <code>concurrent.interpreters<\/code>, \u0432\u043e\u0442 \u0442\u0443\u0442 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e <a href=\"https:\/\/discuss.python.org\/t\/decision-making-process-improvements-or-my-frustrations-with-how-pep-734-has-played-out\/95985\" rel=\"noopener noreferrer nofollow\">\u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u043e\u0431\u0441\u0443\u0436\u0434\u0435\u043d\u0438\u0435<\/a>.<\/p>\n<\/li>\n<\/ul>\n<p>PEP \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u043c\u043e\u0434\u0443\u043b\u044c <code>interpreters<\/code> (<code>concurrent.interpreters<\/code>). \u042d\u0442\u043e\u0442 \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u043e\u0431\u044a\u0435\u043a\u0442\u044b <code>Interpreter<\/code>, \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0435 \u0431\u0430\u0437\u043e\u0432\u044b\u0435 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u044b. \u041c\u043e\u0434\u0443\u043b\u044c \u0442\u0430\u043a\u0436\u0435 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0431\u0430\u0437\u043e\u0432\u044b\u0439 \u043a\u043b\u0430\u0441\u0441 <code>Queue<\/code> (\u043e\u0447\u0435\u0440\u0435\u0434\u0438) \u0434\u043b\u044f \u0441\u0432\u044f\u0437\u0438 \u043c\u0435\u0436\u0434\u0443 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u0430\u043c\u0438.<\/p>\n<p>\u0414\u043b\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 API:<\/p>\n<pre><code class=\"python\">interp = interpreters.create() try:     interp.exec('print(\"Hello from PEP-554\")') finally:     interp.close() <\/code><\/pre>\n<p>\u041f\u0440\u044f\u043c\u043e \u0441\u0435\u0439\u0447\u0430\u0441, \u0435\u0441\u043b\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c Python 3.14, \u043c\u043e\u0436\u043d\u043e \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u0430\u043a\u0435\u0442 <code>concurrent.interpreters<\/code>:<\/p>\n<pre><code class=\"python\">import concurrent.interpreters as interpreters  interp = interpreters.create()  a = 15 print(f\"A in main: {a}\")  try:     interp.exec('print(\"Hello from PEP-554\")\\na = 10\\nprint(f\"A in subinterp: {a}\")') finally:     interp.close() <\/code><\/pre>\n<p>\u0412\u044b\u0432\u043e\u0434 \u043f\u0440\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0435:<\/p>\n<pre><code>A in main: 15 Hello from PEP-554 A in subinterp: 10 <\/code><\/pre>\n<h3>\u276f \u041f\u043e\u0447\u0435\u043c\u0443 \u044d\u0442\u043e\u0442 PEP \u0432\u0430\u0436\u0435\u043d?<\/h3>\n<p>\u041c\u043e\u0434\u0443\u043b\u044c <code>interpreters<\/code> \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u0438\u0442 \u0432\u044b\u0441\u043e\u043a\u043e\u0443\u0440\u043e\u0432\u043d\u0435\u0432\u044b\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0434\u043b\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0445 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u043e\u0432. \u0426\u0435\u043b\u044c \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e\u0431\u044b \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0445 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u043e\u0432 CPython \u0431\u043e\u043b\u0435\u0435 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e\u0439 \u0434\u043b\u044f \u043a\u043e\u0434\u0430 Python. \u042d\u0442\u043e \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u043e \u0441\u0435\u0439\u0447\u0430\u0441, \u043a\u043e\u0433\u0434\u0430 CPython \u0438\u043c\u0435\u0435\u0442 GIL \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u0430 (PEP 684), \u0438 \u043b\u044e\u0434\u0438 \u0431\u043e\u043b\u044c\u0448\u0435 \u0437\u0430\u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043e\u0432\u0430\u043d\u044b \u0432 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0445 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u043e\u0432.<\/p>\n<p>\u0411\u0435\u0437 \u043c\u043e\u0434\u0443\u043b\u044f stdlib \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u044b C API , \u0447\u0442\u043e \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0432\u0430\u0435\u0442 \u0438\u0445 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u043e\u0432.<\/p>\n<p>\u041c\u043e\u0434\u0443\u043b\u044c \u0431\u0443\u0434\u0435\u0442 \u0432\u043a\u043b\u044e\u0447\u0430\u0442\u044c \u0431\u0430\u0437\u043e\u0432\u044b\u0439 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u0434\u043b\u044f \u043e\u0431\u0449\u0435\u043d\u0438\u044f \u043c\u0435\u0436\u0434\u0443 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u043e\u0432. \u0411\u0435\u0437 \u043d\u0435\u0433\u043e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u043e\u0432 \u0431\u0443\u0434\u0443\u0442 \u0433\u043e\u0440\u0430\u0437\u0434\u043e \u043c\u0435\u043d\u0435\u0435 \u043f\u043e\u043b\u0435\u0437\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0435\u0439.<\/p>\n<h3>\u276f \u0423\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e<\/h3>\n<p>\u041f\u043e \u0441\u0443\u0442\u0438, \u00ab\u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u00bb \u2014 \u044d\u0442\u043e \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044f (\u043f\u043e \u0441\u0443\u0442\u0438) \u0432\u0441\u0435\u0445 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0439 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u0442\u043e\u043a\u0438 Python \u0434\u043e\u043b\u0436\u043d\u044b \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c.<\/p>\n<p>\u041f\u0440\u043e\u0446\u0435\u0441\u0441\u044b \u0432 \u043f\u0438\u0442\u043e\u043d\u0435 \u043c\u043e\u0433\u0443\u0442 \u0438\u043c\u0435\u0442\u044c \u043e\u0434\u0438\u043d \u0438\u043b\u0438 \u0431\u043e\u043b\u044c\u0448\u0435 \u043f\u043e\u0442\u043e\u043a\u043e\u0432 \u041e\u0421, \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0449\u0438\u0445 python-\u043a\u043e\u0434 (\u0438\u043b\u0438 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0443\u044e\u0442 \u0441 C API). \u041a\u0430\u0436\u0434\u044b\u0439 \u0438\u0437 \u044d\u0442\u0438\u0445 \u043f\u043e\u0442\u043e\u043a\u043e\u0432 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441 \u0440\u0430\u043d\u0442\u0430\u0439\u043c\u043e\u043c CPython.<\/p>\n<p>\u0418\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u044b \u0441\u043e\u0437\u0434\u0430\u044e\u0442\u0441\u044f \u0447\u0435\u0440\u0435\u0437 C API \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <code>Py_NewInterpreterFromConfig()<\/code> (\u0438\u043b\u0438 <code>Py_NewInterpreter()<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043b\u0435\u0433\u043a\u043e\u0439 \u043e\u0431\u0435\u0440\u0442\u043a\u043e\u0439 \u0432\u043e\u043a\u0440\u0443\u0433 <code>Py_NewInterpreterFromConfig()<\/code>). \u042d\u0442\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0434\u0435\u043b\u0430\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:<\/p>\n<ol>\n<li>\n<p>\u0421\u043e\u0437\u0434\u0430\u0435\u0442 \u043d\u043e\u0432\u043e\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435;<\/p>\n<\/li>\n<li>\n<p>\u0421\u043e\u0437\u0434\u0430\u0435\u0442 \u043d\u043e\u0432\u043e\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043f\u043e\u0442\u043e\u043a\u0430;<\/p>\n<\/li>\n<li>\n<p>\u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043f\u043e\u0442\u043e\u043a\u0430 \u043a\u0430\u043a \u0442\u0435\u043a\u0443\u0449\u0435\u0435 (\u0442\u0435\u043a\u0443\u0449\u0435\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0434\u043b\u044f \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u0430);<\/p>\n<\/li>\n<li>\n<p>\u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u0442 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u0430, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043f\u043e\u0442\u043e\u043a\u0430;<\/p>\n<\/li>\n<li>\n<p>\u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043f\u043e\u0442\u043e\u043a\u0430 (\u0432\u0441\u0435 \u0435\u0449\u0435 \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0435).<\/p>\n<\/li>\n<\/ol>\n<p>\u041a\u043e\u0433\u0434\u0430 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0446\u0435\u0441\u0441 Python, \u043e\u043d \u0441\u043e\u0437\u0434\u0430\u0435\u0442 \u043e\u0434\u043d\u043e \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u0430 (\u00ab\u0433\u043b\u0430\u0432\u043d\u044b\u0439\u00bb \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440) \u0441 \u043e\u0434\u043d\u0438\u043c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435\u043c \u043f\u043e\u0442\u043e\u043a\u0430 \u0434\u043b\u044f \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u043f\u043e\u0442\u043e\u043a\u0430 \u041e\u0421. \u0417\u0430\u0442\u0435\u043c \u0441\u0440\u0435\u0434\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f Python \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0441 \u0438\u0445 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c.<\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0441\u043a\u0440\u0438\u043f\u0442 \u0438\u043b\u0438 \u043c\u043e\u0434\u0443\u043b\u044c \u0438\u043b\u0438 REPL \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0441 \u0438\u0445 \u043f\u043e\u043c\u043e\u0449\u044c\u044e. \u042d\u0442\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0432 \u043c\u043e\u0434\u0443\u043b\u0435 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u0430 <code>__main__<\/code>.<\/p>\n<p>\u041a\u043e\u0433\u0434\u0430 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0437\u0430\u0432\u0435\u0440\u0448\u0430\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0437\u0430\u043f\u0440\u043e\u0448\u0435\u043d\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430 Python \u0438\u043b\u0438 REPL \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u043f\u043e\u0442\u043e\u043a\u0435 \u041e\u0421, \u0441\u0440\u0435\u0434\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f Python \u0437\u0430\u0432\u0435\u0440\u0448\u0430\u0435\u0442\u0441\u044f \u0432 \u044d\u0442\u043e\u043c \u043f\u043e\u0442\u043e\u043a\u0435 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u0430.<\/p>\n<h3>\u276f C API<\/h3>\n<p>\u0412\u043d\u0443\u0442\u0440\u0438 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u043c\u043d\u043e\u0433\u043e \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 C-\u043c\u043e\u0434\u0443\u043b\u0435\u0439. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0440\u0430\u0437\u0431\u0435\u0440\u0435\u043c \u0438\u0445 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435.<\/p>\n<hr\/>\n<p><a href=\"https:\/\/github.com\/python\/cpython\/blob\/main\/Python\/crossinterp.c\" rel=\"noopener noreferrer nofollow\"><strong>Python\/crossinterp.c<\/strong><\/a><\/p>\n<p>\u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0444\u0430\u0439\u043b\u0435 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f API \u0434\u043b\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f\u043c\u0438 \u043c\u0435\u0436\u0434\u0443 \u0438\u0437\u043e\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u043c\u0438 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u0430\u043c\u0438. \u041e\u0441\u043d\u043e\u0432\u0430, \u0432 \u043e\u0431\u0449\u0435\u043c.<\/p>\n<p>\u041d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043c\u044b \u043e\u043f\u0443\u0441\u0442\u0438\u043c, \u0435\u0441\u043b\u0438 \u043e\u043d\u0438 \u043c\u0430\u043b\u043e\u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 (\u043f\u043e \u0442\u0438\u043f\u0443 <code>_Py_GetMainfile<\/code>), \u0432\u044b \u0438\u0445 \u0441\u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0441\u0430\u043c\u0438.<\/p>\n<p>\u041e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438:<\/p>\n<ul>\n<li>\n<p><code>runpy_run_path<\/code> \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u0437\u0430\u043f\u0443\u0441\u043a <code>runpy<\/code> \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 \u043f\u0443\u0442\u0435\u043c;<\/p>\n<\/li>\n<li>\n<p><code>set_exc_with_cause<\/code> \u0441\u043e\u0437\u0434\u0430\u0435\u0442 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0441 \u043f\u0440\u0438\u0447\u0438\u043d\u043e\u0439.<\/p>\n<\/li>\n<\/ul>\n<ol>\n<li>\n<p><strong>\u0423\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u0430\u043c\u0438:<\/strong><\/p>\n<ul>\n<li>\n<p><code>_PyXI_NewInterpreter()<\/code>: \u0421\u043e\u0437\u0434\u0430\u0435\u0442 \u043d\u043e\u0432\u044b\u0439 \u0438\u0437\u043e\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440<\/p>\n<\/li>\n<li>\n<p><code>_PyXI_EndInterpreter()<\/code>: \u0417\u0430\u0432\u0435\u0440\u0448\u0430\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0443 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u0430<\/p>\n<\/li>\n<li>\n<p><code>_Py_CallInInterpreter()<\/code>: \u0412\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0432 \u0434\u0440\u0443\u0433\u043e\u043c \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u0435<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u041c\u0435\u0436\u044f\u0437\u044b\u043a\u043e\u0432\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435:<\/strong><\/p>\n<ul>\n<li>\n<p><code>_PyXIData_t<\/code>: \u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u043c\u0435\u0436\u0434\u0443 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u0430\u043c\u0438<\/p>\n<\/li>\n<li>\n<p><code>_PyObject_GetXIData()<\/code>: \u041f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u0443\u0435\u0442 \u043e\u0431\u044a\u0435\u043a\u0442 \u0432 \u043c\u0435\u0436\u044a\u044f\u0437\u044b\u043a\u043e\u0432\u043e\u0439 \u0444\u043e\u0440\u043c\u0430\u0442<\/p>\n<\/li>\n<li>\n<p><code>_PyXIData_NewObject()<\/code>: \u0412\u043e\u0441\u0441\u043e\u0437\u0434\u0430\u0435\u0442 \u043e\u0431\u044a\u0435\u043a\u0442 \u0438\u0437 \u043c\u0435\u0436\u044a\u044f\u0437\u044b\u043a\u043e\u0432\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u0421\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f:<\/strong><\/p>\n<ul>\n<li>\n<p><code>_PyPickle_GetXIData()<\/code>: \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 pickle \u0434\u043b\u044f \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432<\/p>\n<\/li>\n<li>\n<p><code>_PyMarshal_GetXIData()<\/code>: \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 marshal \u0434\u043b\u044f \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043a\u043e\u0434\u0430<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u0423\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0441\u0435\u0441\u0441\u0438\u044f\u043c\u0438:<\/strong><\/p>\n<ul>\n<li>\n<p><code>_PyXI_session<\/code>: \u0421\u0435\u0441\u0441\u0438\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0432 \u0434\u0440\u0443\u0433\u043e\u043c \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u0435<\/p>\n<\/li>\n<li>\n<p><code>_PyXI_Enter()<\/code>: \u041d\u0430\u0447\u0430\u043b\u043e \u0441\u0435\u0441\u0441\u0438\u0438 \u0432 \u0434\u0440\u0443\u0433\u043e\u043c \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u0435<\/p>\n<\/li>\n<li>\n<p><code>_PyXI_Exit()<\/code>: \u0417\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u0435 \u0441\u0435\u0441\u0441\u0438\u0438<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u041e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u043e\u0448\u0438\u0431\u043e\u043a:<\/strong><\/p>\n<ul>\n<li>\n<p><code>_PyXI_excinfo<\/code>: \u0421\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043e\u0431 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f\u0445 \u043c\u0435\u0436\u0434\u0443 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u0430\u043c\u0438<\/p>\n<\/li>\n<li>\n<p><code>_PyXI_failure<\/code>: \u0423\u043d\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0430\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0441\u0431\u043e\u0435\u0432<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<p>\u0421\u0440\u0435\u0434\u0438 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0435\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u0434\u0435\u043b\u0438\u0442\u044c \u0438\u0437\u043e\u043b\u044f\u0446\u0438\u044e \u0433\u043b\u0430\u0432\u043d\u043e\u0433\u043e (<code>__main__<\/code>) \u043c\u043e\u0434\u0443\u043b\u044f \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u0430.<\/p>\n<p>\u0412\u0441\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u044e\u0442\u0441\u044f \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e, \u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f \u043f\u0440\u043e\u0441\u0442\u044b\u043c\u0438 \u043c\u043e\u0436\u043d\u043e \u0431\u0435\u0437 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c pickle. \u0414\u043b\u044f \u0441\u043b\u043e\u0436\u043d\u044b\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0436\u0435 \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f.<\/p>\n<p>\u041f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0432\u044b\u0437\u043e\u0432\u043e\u0432 \u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u043f\u0430\u043c\u044f\u0442\u0438 \u0447\u0435\u0440\u0435\u0437 \u0444\u043b\u0430\u0433  <code>_Py_PENDING_RAWFREE<\/code>.<\/p>\n<p>\u041a\u0440\u043e\u043c\u0435 \u044d\u0442\u043e\u0433\u043e, \u043d\u0435 \u0441\u0442\u043e\u0438\u0442 \u0437\u0430\u0431\u044b\u0432\u0430\u0442\u044c \u043f\u0440\u043e \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0439. \u041f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0439 \u0447\u0435\u0440\u0435\u0437 <code>_PyXI_excinfo<\/code>, \u0442\u0440\u0430\u0441\u0441\u0438\u0440\u043e\u0432\u043a\u0430 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u0443\u0435\u0442\u0441\u044f \u0432 TracebackException, \u0420\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u044b \u043c\u0435\u0442\u043e\u0434\u044b \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u043e\u0448\u0438\u0431\u043e\u043a \u043c\u0435\u0436\u0434\u0443 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u0430\u043c\u0438.<\/p>\n<hr\/>\n<p><a href=\"https:\/\/github.com\/python\/cpython\/blob\/main\/Modules\/_interpretersmodule.c\" rel=\"noopener noreferrer nofollow\"><strong>Modules\/_interpretersmodule.c<\/strong><\/a><\/p>\n<p>\u0414\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u0434\u0443\u043b\u044c \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u0437\u0430 \u043d\u0438\u0437\u043a\u043e\u0443\u0440\u043e\u0432\u043d\u0435\u0432\u044b\u0439 \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u0430\u043c \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u043e\u0432. \u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0441\u0430\u043c\u0438\u0445 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u043e\u0432.<\/p>\n<p>\u041c\u043e\u0434\u0443\u043b\u044c \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u043d\u0438\u0437\u043a\u043e\u0443\u0440\u043e\u0432\u043d\u0435\u0432\u044b\u0439 API \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u0430\u043c\u0438 Python, \u0432\u043a\u043b\u044e\u0447\u0430\u044f:<\/p>\n<ul>\n<li>\n<p>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0438 \u0443\u043d\u0438\u0447\u0442\u043e\u0436\u0435\u043d\u0438\u0435 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u043e\u0432<\/p>\n<\/li>\n<li>\n<p>\u0423\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0438\u0437\u043e\u043b\u044f\u0446\u0438\u0435\u0439 \u043c\u0435\u0436\u0434\u0443 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u0430\u043c\u0438<\/p>\n<\/li>\n<li>\n<p>\u0412\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043a\u043e\u0434\u0430 \u0432 \u0440\u0430\u0437\u043d\u044b\u0445 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u0430\u0445<\/p>\n<\/li>\n<li>\n<p>\u041c\u0435\u0436\u044a\u044f\u0434\u0435\u0440\u043d\u0443\u044e \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0443 \u0434\u0430\u043d\u043d\u044b\u0445<\/p>\n<\/li>\n<li>\n<p>\u0423\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0435\u0439 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u043e\u0432<\/p>\n<\/li>\n<\/ul>\n<p>\u0412 \u043a\u043e\u0434\u0435 \u043c\u043e\u0436\u043d\u043e \u0443\u0432\u0438\u0434\u0435\u0442\u044c C-\u0444\u0443\u043d\u043a\u0446\u0438\u044e <code>interp_create<\/code>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0435\u0439 <code>create()<\/code>. \u041e\u043d \u0441\u043e\u0437\u0434\u0430\u0435\u0442 \u043d\u043e\u0432\u044b\u0439 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440 \u0441 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0439 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0435\u0439 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u0430. \u041f\u043e\u0441\u043b\u0435 \u043c\u043e\u0436\u043d\u043e \u0443\u0432\u0438\u0434\u0435\u0442\u044c <code>interp_destroy<\/code> \u0434\u043b\u044f \u0443\u043d\u0438\u0447\u0442\u043e\u0436\u0435\u043d\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u0430 (\u0432 python \u044d\u0442\u043e <code>destroy()<\/code>). \u0422\u0430\u043a\u0436\u0435 \u0435\u0441\u0442\u044c <code>list_all<\/code> \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0441\u043f\u0438\u0441\u043a\u0430 \u0432\u0441\u0435\u0445 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u043e\u0432 \u0432 \u0442\u0435\u043a\u0443\u0449\u0435\u043c \u043c\u043e\u0434\u0443\u043b\u0435, \u0430 \u0442\u0430\u043a\u0436\u0435 <code>get_current<\/code> \u0438 <code>get_main<\/code> \u043c\u0435\u0442\u043e\u0434\u044b \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u0438 \u0433\u043b\u0430\u0432\u043d\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u0430.<\/p>\n<p>\u0422\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u0434\u0435\u043b\u0438\u0442\u044c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u0441\u043f\u0438\u0441\u043e\u043a \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0434\u043b\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043a\u043e\u0434\u0430: <code>exec()<\/code> \u0434\u043b\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430, <code>run_string<\/code> \u0434\u043b\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0441\u0442\u0440\u043e\u043a\u0438 \u043a\u043e\u0434\u0430, <code>run_func()<\/code> \u0434\u043b\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0442\u0435\u043b\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u0438 <code>call()<\/code> \u0434\u043b\u044f \u0432\u044b\u0437\u043e\u0432\u0430 callable-\u043e\u0431\u044a\u0435\u043a\u0442\u0430 (\u0432\u043a\u043b\u044e\u0447\u0430\u044f callable-\u043a\u043b\u0430\u0441\u0441\u044b) \u0441 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430\u043c\u0438).<\/p>\n<p>\u0414\u043b\u044f \u043c\u0435\u0436\u044a\u044f\u0434\u0435\u0440\u043d\u043e\u0433\u043e \u0438 \u043c\u043d\u043e\u0433\u043e\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u043d\u043e\u0433\u043e \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0438\u0434\u0435\u0442 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0433\u043e \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0431\u0443\u0444\u0435\u0440\u043e\u0432 \u043c\u0435\u0436\u0434\u0443 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u0430\u043c\u0438:<\/p>\n<pre><code>typedef struct {     PyObject base;     Py_buffer *view;     int64_t interpid; } xibufferview; <\/code><\/pre>\n<p>\u0414\u043b\u044f \u0441\u0435\u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0438 \u0434\u0435\u0441\u0435\u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0441\u043b\u043e\u0436\u043d\u044b\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0435\u0441\u0442\u044c \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c <code>_PyXIData<\/code>. \u041e\u043d \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430 \u043a \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u043c \u0433\u0434\u0435 \u0438\u0434\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430 \u0441\u043e \u0441\u043b\u043e\u0436\u043d\u044b\u043c\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u0430\u043c\u0438. \u0410 \u0442\u0430\u043a\u0436\u0435 \u0435\u0441\u0442\u044c \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 \u0440\u0430\u0437\u0434\u0435\u043b\u044f\u0435\u043c\u044b\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0434\u0430\u043d\u043d\u044b\u0445 \u0447\u0435\u0440\u0435\u0437 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b <code>shared<\/code>.<\/p>\n<p>\u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u0435\u0441\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f\u043c\u0438 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u043e\u0432. \u0421\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u043f\u043e\u0442\u043e\u043a\u043e\u0432 \u0441\u0432\u044f\u0437\u0430\u043d\u044b \u0441 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f\u043c\u0438 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0430\u043a \u0436\u0435, \u043a\u0430\u043a \u0441\u0432\u044f\u0437\u0430\u043d\u044b \u043f\u043e\u0442\u043e\u043a\u0438 \u0438 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u044b \u041e\u0421 (\u043d\u0430 \u0432\u044b\u0441\u043e\u043a\u043e\u043c \u0443\u0440\u043e\u0432\u043d\u0435). \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430, \u0441\u0432\u044f\u0437\u044c \u2014 \u043e\u0434\u0438\u043d \u043a\u043e \u043c\u043d\u043e\u0433\u0438\u043c. \u0421\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043f\u043e\u0442\u043e\u043a\u0430 \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u0438\u0442 \u043e\u0434\u043d\u043e\u043c\u0443 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u0443 (\u0438 \u0445\u0440\u0430\u043d\u0438\u0442 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043d\u0430 \u043d\u0435\u0433\u043e). \u042d\u0442\u043e \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043f\u043e\u0442\u043e\u043a\u0430 \u043d\u0438\u043a\u043e\u0433\u0434\u0430 \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0434\u0440\u0443\u0433\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u0430. \u041e\u0434\u043d\u0430\u043a\u043e \u0432 \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u043c \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0438 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440 \u043c\u043e\u0436\u0435\u0442 \u0438\u043c\u0435\u0442\u044c \u043d\u043e\u043b\u044c \u0438\u043b\u0438 \u0431\u043e\u043b\u0435\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0439 \u043f\u043e\u0442\u043e\u043a\u043e\u0432, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0445 \u0441 \u043d\u0438\u043c. \u0418\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440 \u0441\u0447\u0438\u0442\u0430\u0435\u0442\u0441\u044f \u0430\u043a\u0442\u0438\u0432\u043d\u044b\u043c \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u043f\u043e\u0442\u043e\u043a\u0430\u0445 \u041e\u0421, \u0433\u0434\u0435 \u043e\u0434\u043d\u043e \u0438\u0437 \u0435\u0433\u043e \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0439 \u043f\u043e\u0442\u043e\u043a\u043e\u0432 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0442\u0435\u043a\u0443\u0449\u0438\u043c.<\/p>\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u044f <code>set___main___attrs<\/code> \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u044b \u0432 <code>__main__<\/code> \u043c\u043e\u0434\u0443\u043b\u044c, \u0430 <code>capture_exception<\/code> \u043d\u0443\u0436\u043d\u0430 \u0434\u043b\u044f \u0437\u0430\u0445\u0432\u0430\u0442\u0430 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0439, \u0447\u0442\u043e\u0431\u044b \u0432 \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u0438\u0445 \u043c\u0435\u0436\u0434\u0443 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u0430\u043c\u0438. \u0418 \u0442\u0430\u043a\u0436\u0435 \u0435\u0441\u0442\u044c \u043c\u0435\u0442\u043e\u0434 <code>is_shareable<\/code> \u0434\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0440\u0430\u0437\u0434\u0435\u043b\u044f\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442\u044b.<\/p>\n<p>\u0421\u0440\u0435\u0434\u0438 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0435\u0439 \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430 \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u0434\u0435\u043b\u0438\u0442\u044c \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u0443\u044e \u0440\u0430\u0431\u043e\u0442\u0443 \u0441 \u0444\u0430\u0439\u043b\u0430\u043c\u0438. \u0410 \u0442\u0430\u043a\u0436\u0435 \u043e\u0447\u0438\u0441\u0442\u043a\u0430 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0439 (<code>module_clear<\/code>, <code>traverse_module_state<\/code>), \u0434\u0435\u0430\u043b\u043b\u043e\u043a\u0430\u0442\u043e\u0440\u044b (<code>xibufferview_dealloc<\/code>), \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 <code>Py_buffer<\/code> \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0440\u0430\u0437\u0434\u0435\u043b\u044f\u0435\u043c\u044b\u043c\u0438 \u0431\u0443\u0444\u0435\u0440\u0430\u043c\u0438.<\/p>\n<p>\u041e\u0431\u044a\u0435\u043a\u0442\u044b \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u043e\u0432 \u0441\u0442\u0440\u043e\u0433\u043e \u0438\u0437\u043e\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u044b, \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0441\u0435\u0441\u0441\u0438\u0439 \u0447\u0435\u0440\u0435\u0437 <code>_PyXI_Enter<\/code> \u0438 <code>_PyXI_Exit<\/code>. \u041e\u0448\u0438\u0431\u043a\u0438 \u0438\u0437\u043e\u043b\u044f\u0446\u0438\u0438 \u0442\u0430\u043a\u0436\u0435 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0447\u0435\u0440\u0435\u0437 <code>unwrap_not_shareable<\/code>.<\/p>\n<p>\u041a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u043e\u0432 \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c\u0430 \u0441 <code>PyInterpreterConfig<\/code>, \u0430 \u0441\u0430\u043c \u043a\u043e\u043d\u0444\u0438\u0433 \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0447\u0435\u0440\u0435\u0437 \u043c\u0435\u0442\u043e\u0434 <code>new_config<\/code>.<\/p>\n<p>\u0422\u0430\u043a\u0436\u0435 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u044b \u0438\u043c\u0435\u044e\u0442 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c\u044b\u0439 \u0436\u0438\u0437\u043d\u0435\u043d\u043d\u044b\u0439 \u0446\u0438\u043a\u043b, \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c\u044b\u0439 \u0447\u0435\u0440\u0435\u0437 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443 \u0433\u043e\u0442\u043e\u0432\u043d\u043e\u0441\u0442\u0438, \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0438 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u0430, \u0441\u0447\u0435\u0442\u0447\u0438\u043a\u0438 \u0441\u0441\u044b\u043b\u043e\u043a.<\/p>\n<p>\u041c\u043e\u0434\u0443\u043b\u044c \u043f\u043e\u043c\u0435\u0447\u0435\u043d \u043a\u0430\u043a <code>Py_MOD_PER_INTERPRETER_GIL_SUPPORTED<\/code>, \u0447\u0442\u043e \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442 \u0447\u0442\u043e \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 GIL \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u0430 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f. \u0421\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0442 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0435 \u0442\u0438\u043f\u044b \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0439 (<code>InterpreterError<\/code>, <code>NotShareableError<\/code>). \u0421\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c\u044b \u0441 <code>marshal<\/code> \u0434\u043b\u044f \u0441\u0435\u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0441\u043b\u043e\u0436\u043d\u044b\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432.<\/p>\n<hr\/>\n<p><a href=\"https:\/\/github.com\/python\/cpython\/blob\/main\/Modules\/_interpqueuesmodule.c\" rel=\"noopener noreferrer nofollow\"><strong>Modules\/_interpqueuesmodule.c<\/strong><\/a><\/p>\n<p>\u0414\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u0434\u0443\u043b\u044c \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u0437\u0430 \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u043e\u0431\u043c\u0435\u043d\u0430 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f\u043c\u0438 \u043c\u0435\u0436\u0434\u0443 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u0430\u043c\u0438. \u041e\u0447\u0435\u0440\u0435\u0434\u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u043c\u0435\u0436\u0434\u0443 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u0430\u043c\u0438 Python \u0432 \u043e\u0434\u043d\u043e\u043c \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u0443\u044e \u043f\u0430\u043c\u044f\u0442\u044c \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044e\u0442 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0438 \u0434\u043b\u044f \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u0438.<\/p>\n<p>\u0412 \u044d\u0442\u043e\u043c \u043c\u043e\u0434\u0443\u043b\u0435 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440.<\/p>\n<p>\u041f\u0435\u0440\u0432\u0430\u044f \u0438\u0437 \u043d\u0438\u0445 \u2014 \u044d\u0442\u043e <code>_queueitem<\/code>, \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u043e\u0447\u0435\u0440\u0435\u0434\u0438, \u0441\u0432\u044f\u0437\u043d\u044b\u0439 \u0441\u043f\u0438\u0441\u043e\u043a.<\/p>\n<pre><code>struct _queueitem;  typedef struct _queueitem {     \/* The interpreter that added the item to the queue.        The actual bound interpid is found in item-&gt;data.        This is necessary because item-&gt;data might be NULL,        meaning the interpreter has been destroyed. *\/     int64_t interpid;     _PyXIData_t *data;     unboundop_t unboundop;     struct _queueitem *next; } _queueitem; <\/code><\/pre>\n<p>\u041f\u0440\u0438\u043d\u0446\u0438\u043f \u0440\u0430\u0431\u043e\u0442\u044b \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043a\u0430\u0436\u0434\u044b\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u043e\u0447\u0435\u0440\u0435\u0434\u0438 (<code>_queueitem<\/code>) \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442:<\/p>\n<ul>\n<li>\n<p><code>interpid<\/code>: \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440-\u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u0435\u043b\u044c<\/p>\n<\/li>\n<li>\n<p><code>data<\/code>: \u0431\u0443\u0444\u0435\u0440 \u0434\u0430\u043d\u043d\u044b\u0445 (\u0434\u043e 256 \u041a\u0411 \u0431\u0435\u0437 \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438)<\/p>\n<\/li>\n<li>\n<p><code>next<\/code>: \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 (FIFO)<\/p>\n<\/li>\n<\/ul>\n<p>\u0410 \u0442\u0430\u043a\u0436\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0435\u0440\u0435\u0437 <code>queue.put<\/code>. \u041f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u044b \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u0438 \u0437\u0430\u0438\u043c\u0441\u0442\u0432\u043e\u0432\u0430\u043d\u044b \u0438\u0437 <code>threading.Lock<\/code>.<\/p>\n<p>\u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0430\u044f \u2014 \u044d\u0442\u043e \u0441\u0430\u043c\u0430 \u043e\u0447\u0435\u0440\u0435\u0434\u044c (FIFO \u2014 first in \u2014 first out, \u043f\u0435\u0440\u0432\u044b\u0439 \u0432\u043e\u0448\u0435\u043b \u2014 \u043f\u0435\u0440\u0432\u044b\u0439 \u0432\u044b\u0448\u0435\u043b).<\/p>\n<pre><code>typedef struct _queue {     Py_ssize_t num_waiters;  \/\/ protected by global lock     PyThread_type_lock mutex;     int alive;     struct _queueitems {         Py_ssize_t maxsize;         Py_ssize_t count;         _queueitem *first;         _queueitem *last;     } items;     struct _queuedefaults {         xidata_fallback_t fallback;         int unboundop;     } defaults; } _queue; <\/code><\/pre>\n<p>\u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u00ab\u043e\u0436\u0438\u0434\u0430\u044e\u0449\u0438\u0445\u00bb (\u0437\u0430\u0449\u0438\u0449\u0435\u043d\u043e GIL), \u043c\u044c\u044e\u0442\u0435\u043a\u0441, \u0441\u0442\u0430\u0442\u0443\u0441 \u0436\u0438\u0437\u043d\u0438, \u043f\u043e\u0434\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 <code>_queueitems<\/code> \u0441 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u043c \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u043c, \u0447\u0438\u0441\u043b\u043e\u043c, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043f\u0435\u0440\u0432\u044b\u043c \u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u043c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u043c, \u043f\u043e\u0434\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 <code>_queuedefaults<\/code> \u0434\u043b\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e.<\/p>\n<p>\u041f\u043e\u0442\u043e\u043c \u0438\u0434\u0435\u0442 <code>_queueref<\/code> \u2014 \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0447\u0435\u0440\u0435\u0434\u044c:<\/p>\n<pre><code>struct _queueref;  typedef struct _queueref {     struct _queueref *next;     int64_t qid;     Py_ssize_t refcount;     _queue *queue; } _queueref; <\/code><\/pre>\n<p>\u0412 \u043d\u0435\u0439 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043e\u0431\u044a\u0435\u043a\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0441\u0441\u044b\u043b\u043a\u0438, ID \u043e\u0447\u0435\u0440\u0435\u0434\u0438, \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u0441\u044b\u043b\u043e\u043a \u0438 \u0441\u0430\u043c\u0430 \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u0432 \u0432\u0438\u0434\u0435 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044f.<\/p>\n<p>\u0418 \u0432 \u043a\u043e\u043d\u0446\u0435 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 <code>_queues<\/code>:<\/p>\n<pre><code>typedef struct _queues {     PyThread_type_lock mutex;     _queueref *head;     int64_t count;     int64_t next_id; } _queues; <\/code><\/pre>\n<p>\u041c\u044c\u044e\u0442\u0435\u043a\u0441, \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u0432 \u0432\u0438\u0434\u0435 \u00ab\u0433\u043e\u043b\u043e\u0432\u044b\u00bb, \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0438 <code>next_id<\/code>. <code>_queues<\/code> \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u044b\u043c \u0440\u0435\u0435\u0441\u0442\u0440\u043e\u043c \u0432\u0441\u0435\u0445 \u043e\u0447\u0435\u0440\u0435\u0434\u0435\u0439.<\/p>\n<p>\u0422\u0430\u043a\u0436\u0435 \u0432 \u044d\u0442\u043e\u043c \u043c\u043e\u0434\u0443\u043b\u0435 \u0437\u0430\u0434\u0430\u0435\u0442\u0441\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u043c\u0438: <code>_PyXIData_t<\/code> \u043a\u0430\u043a \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 \u0434\u043b\u044f \u0434\u0430\u043d\u043d\u044b\u0445, \u0438 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u044b \u0434\u043b\u044f \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0438 \u0434\u0435\u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432. \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u043c\u043e\u0436\u043d\u043e \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u043f\u043e\u043b\u0438\u0442\u0438\u043a\u0443 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u00ab\u043d\u0435\u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0445\u00bb \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432, \u043a\u043e\u0433\u0434\u0430 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440-\u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a \u0443\u043d\u0438\u0447\u0442\u043e\u0436\u0435\u043d.<\/p>\n<p>\u041c\u043e\u0434\u0443\u043b\u044c \u043f\u043e\u0442\u043e\u043a\u043e\u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u044b\u0439 (\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u044f \u0438\u0434\u0435\u0442 \u0447\u0435\u0440\u0435\u0437 <code>PyThread_type_lock<\/code>, \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0441 \u043e\u0447\u0435\u0440\u0435\u0434\u044f\u043c\u0438 \u0430\u0442\u043e\u043c\u0430\u0440\u043d\u044b\u0435). \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0435 \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u044b\u0435 \u0430\u043b\u043b\u043e\u043a\u0430\u0442\u043e\u0440\u044b \u043f\u0430\u043c\u044f\u0442\u0438, \u0435\u0441\u0442\u044c \u043e\u0447\u0438\u0441\u0442\u043a\u0430 \u0438 \u0441\u0447\u0435\u0442\u0447\u0438\u043a\u0438 \u0441\u0441\u044b\u043b\u043e\u043a.<\/p>\n<p>\u041d\u0443 \u0438 \u0435\u0441\u0442\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u043e\u0448\u0438\u0431\u043e\u043a: python-\u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043e\u0431 \u043e\u0447\u0435\u0440\u0435\u0434\u044f\u0445, \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u043a\u043e\u0434\u043e\u0432 \u0438 \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0430\u0446\u0438\u044f \u0441\u0438\u0448\u043d\u044b\u0445 \u043e\u0448\u0438\u0431\u043e\u043a \u0432 python-\u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f.<\/p>\n<p>\u0415\u0441\u043b\u0438 \u043a\u0440\u0430\u0442\u043a\u043e, \u0442\u043e \u0432\u043e\u0442 API \u043c\u043e\u0434\u0443\u043b\u044f:<\/p>\n<ul>\n<li>\n<p><code>create()<\/code>\/<code>destroy()<\/code> \u2014 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043e\u0447\u0435\u0440\u0435\u0434\u044f\u043c\u0438<\/p>\n<\/li>\n<li>\n<p><code>put()<\/code>\/<code>get()<\/code> \u2014 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438<\/p>\n<\/li>\n<li>\n<p><code>bind()<\/code>\/<code>release()<\/code> \u2014 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0441\u0441\u044b\u043b\u043a\u0430\u043c\u0438<\/p>\n<\/li>\n<li>\n<p>\u0412\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u044b (<code>get_count()<\/code>, <code>is_full()<\/code> \u0438 \u0434\u0440\u0443\u0433\u0438\u0435)<\/p>\n<\/li>\n<\/ul>\n<hr\/>\n<p><a href=\"https:\/\/github.com\/python\/cpython\/blob\/main\/Modules\/_interpchannelsmodule.c\" rel=\"noopener noreferrer nofollow\"><strong>Modules\/_interpchannelsmodule.c<\/strong><\/a><\/p>\n<p>\u0424\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u043c\u043e\u0434\u0443\u043b\u044c, \u043d\u0430\u0431\u043e\u0440 \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u043e\u0432. \u042d\u0442\u043e\u0442 \u043a\u043e\u0434 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442 \u043d\u0438\u0437\u043a\u043e\u0443\u0440\u043e\u0432\u043d\u0435\u0432\u044b\u0439 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u043c\u0435\u0436\u044a\u044f\u0434\u0435\u0440\u043d\u044b\u0445 \u043a\u0430\u043d\u0430\u043b\u043e\u0432 \u0434\u043b\u044f CPython, \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u044e\u0449\u0438\u0439 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0443 \u0434\u0430\u043d\u043d\u044b\u0445 \u043c\u0435\u0436\u0434\u0443 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u0430\u043c\u0438. \u0415\u0433\u043e \u044f\u0434\u0440\u043e\u043c \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 <code>globals<\/code>, \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u044e\u0449\u0430\u044f \u0446\u0435\u043d\u0442\u0440\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u043e\u0435 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435:<\/p>\n<pre><code>static struct globals {     PyMutex mutex;          \/\/ \u0413\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u044b\u0439 \u043c\u044c\u044e\u0442\u0435\u043a\u0441 \u0434\u043b\u044f \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u0438     int module_count;        \/\/ \u0421\u0447\u0451\u0442\u0447\u0438\u043a \u0430\u043a\u0442\u0438\u0432\u043d\u044b\u0445 \u043f\u043e\u0434-\u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u043e\u0432     _channels channels;      \/\/ \u041a\u043e\u0440\u043d\u0435\u0432\u043e\u0439 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 \u043a\u0430\u043d\u0430\u043b\u043e\u0432 } _globals = {0}; <\/code><\/pre>\n<p>\u0413\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u043e\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0437\u0430\u0449\u0438\u0449\u0435\u043d\u043e \u043c\u044c\u044e\u0442\u0435\u043a\u0441\u043e\u043c, \u043f\u0440\u0435\u0434\u043e\u0442\u0432\u0440\u0430\u0449\u0430\u044e\u0449\u0438\u043c race conditions \u043f\u0440\u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u0435 \u043a \u0441\u043f\u0438\u0441\u043a\u0443 \u043a\u0430\u043d\u0430\u043b\u043e\u0432. \u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 <code>_channels<\/code> \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u0436\u0438\u0437\u043d\u0435\u043d\u043d\u044b\u043c \u0446\u0438\u043a\u043b\u043e\u043c \u0432\u0441\u0435\u0445 \u043a\u0430\u043d\u0430\u043b\u043e\u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430:<\/p>\n<pre><code>typedef struct _channels {     PyThread_type_lock mutex;  \/\/ \u041c\u044c\u044e\u0442\u0435\u043a\u0441 \u0441\u043f\u0438\u0441\u043a\u0430 \u043a\u0430\u043d\u0430\u043b\u043e\u0432     _channelref *head;         \/\/ \u0421\u0432\u044f\u0437\u043d\u044b\u0439 \u0441\u043f\u0438\u0441\u043e\u043a \u0430\u043a\u0442\u0438\u0432\u043d\u044b\u0445 \u043a\u0430\u043d\u0430\u043b\u043e\u0432     int64_t numopen;           \/\/ \u0421\u0447\u0451\u0442\u0447\u0438\u043a \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u0445 \u043a\u0430\u043d\u0430\u043b\u043e\u0432     int64_t next_id;           \/\/ \u0413\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0445 ID } _channels; <\/code><\/pre>\n<p>\u041a\u0430\u0436\u0434\u044b\u0439 \u043a\u0430\u043d\u0430\u043b \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u0435\u0439 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440:<\/p>\n<ol>\n<li>\n<p><code><strong>_channelref<\/strong><\/code> \u2014 \u0437\u0430\u043f\u0438\u0441\u044c \u0432 \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u043e\u043c \u0440\u0435\u0435\u0441\u0442\u0440\u0435<\/p>\n<\/li>\n<li>\n<p><code><strong>_channel_state<\/strong><\/code> \u2014 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043a\u0430\u043d\u0430\u043b\u0430<\/p>\n<\/li>\n<li>\n<p><code><strong>_channelitem<\/strong><\/code> \u2014 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0434\u0430\u043d\u043d\u044b\u0445<\/p>\n<\/li>\n<\/ol>\n<p>\u042d\u043b\u0435\u043c\u0435\u043d\u0442 \u043e\u0447\u0435\u0440\u0435\u0434\u0438 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u0438\u043d\u043a\u0430\u043f\u0441\u0443\u043b\u0438\u0440\u0443\u0435\u0442 \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0435\u043c\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0438 \u043c\u0435\u0442\u0430\u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e:<\/p>\n<pre><code>typedef struct _channelitem {     int64_t interpid;      \/\/ ID \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u0430-\u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0430     _PyXIData_t *data;     \/\/ \u041a\u0440\u043e\u0441\u0441-\u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435     _waiting_t *waiting;   \/\/ \u0421\u0435\u043c\u0430\u0444\u043e\u0440 \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u0438     unboundop_t unboundop; \/\/ \u041e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u043d\u0435\u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432     struct _channelitem *next; \/\/ \u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 } _channelitem; <\/code><\/pre>\n<p>\u041a\u043b\u044e\u0447\u0435\u0432\u0430\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 <code>_channel_state<\/code> \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u043c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435\u043c \u043a\u0430\u043d\u0430\u043b\u0430:<\/p>\n<pre><code>typedef struct _channel {     PyThread_type_lock mutex;   \/\/ \u041b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0439 \u043c\u044c\u044e\u0442\u0435\u043a\u0441     _channelqueue *queue;       \/\/ \u041e\u0447\u0435\u0440\u0435\u0434\u044c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 (FIFO)     _channelends *ends;         \/\/ \u0420\u0435\u0435\u0441\u0442\u0440 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u043e\u0432     struct {         unboundop_t unboundop;  \/\/ \u0421\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432         xidata_fallback_t fallback; \/\/ Fallback-\u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f     } defaults;     int open;                   \/\/ \u0424\u043b\u0430\u0433 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f     struct _channel_closing *closing; \/\/ \u0421\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0437\u0430\u043a\u0440\u044b\u0442\u0438\u044f } _channel_state; <\/code><\/pre>\n<p>\u041e\u0441\u043e\u0431\u043e\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u0443\u0434\u0435\u043b\u0435\u043d\u043e \u0434\u0432\u0443\u0445\u0444\u0430\u0437\u043d\u043e\u043c\u0443 \u0437\u0430\u043a\u0440\u044b\u0442\u0438\u044e, fallback-\u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0438 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u043c\u0443 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u044e \u0441\u0441\u044b\u043b\u043e\u043a. \u0412\u0441\u0435 \u044d\u0442\u043e \u0432\u043c\u0435\u0441\u0442\u0435 \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u0443\u0435\u0442 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u0435 \u043f\u0440\u0438 \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u044b\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439, \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0432\u043d\u0435 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0433\u043e XI-\u0444\u043e\u0440\u043c\u0430\u0442\u0430.<\/p>\n<p>\u042d\u043a\u0441\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c\u044b\u0439 \u0442\u0438\u043f <code>channelid<\/code> \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0434\u043b\u044f Python:<\/p>\n<pre><code>typedef struct channelid {     PyObject_HEAD     int64_t cid;       \/\/ \u0423\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0439 ID \u043a\u0430\u043d\u0430\u043b\u0430     int end;           \/\/ \u0420\u043e\u043b\u044c \u043a\u043e\u043d\u0435\u0447\u043d\u043e\u0439 \u0442\u043e\u0447\u043a\u0438     int resolve;       \/\/ \u0424\u043b\u0430\u0433 \u0430\u0432\u0442\u043e\u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u044f     _channels *channels; \/\/ \u0421\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 } channelid; <\/code><\/pre>\n<p>\u041a\u0430\u043a \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c, \u043c\u044c\u044e\u0442\u0435\u043a\u0441\u0442\u044b \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u0447\u043d\u044b: \u0438\u0437 \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0432 \u0441\u043f\u0438\u0441\u043e\u043a \u043a\u0430\u043d\u0430\u043b\u043e\u0432 \u0438 \u0434\u0430\u043b\u044c\u0448\u0435 \u0432 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0439.<\/p>\n<p>\u041e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0430\u0442\u043e\u043c\u0430\u0440\u043d\u044b\u0435 (\u043d\u0435\u0434\u0435\u043b\u0438\u043c\u044b\u0435), \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0442 \u0442\u0430\u0443\u043c\u0430\u0443\u0442\u044b \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043e\u043a \u0434\u043b\u044f \u043f\u0440\u0435\u0434\u043e\u0442\u0432\u0440\u0430\u0449\u0435\u043d\u0438\u044f \u0432\u0437\u0430\u0438\u043c\u043d\u044b\u0445 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043e\u043a (\u0438\u0437\u0432\u0438\u043d\u044f\u044e\u0441\u044c \u0437\u0430 \u0442\u0430\u0432\u0442\u043e\u043b\u043e\u0433\u0438\u044e).<\/p>\n<p>\u0418 \u0435\u0441\u0442\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043d\u0435 \u0441\u0442\u043e\u0438\u0442 \u0437\u0430\u0431\u044b\u0432\u0430\u0442\u044c \u0432\u0441\u0435 \u044d\u0442\u043e \u0447\u0438\u0441\u0442\u0438\u0442\u044c \u2014 \u0441\u0431\u043e\u0440\u043a\u0430 \u043c\u0443\u0441\u043e\u0440\u0430 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u043f\u0440\u0438 \u043a\u0430\u0436\u0434\u043e\u043c \u0443\u043d\u0438\u0447\u0442\u043e\u0436\u0435\u043d\u0438\u0438 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u0430.<\/p>\n<h3>\u276f \u041f\u0440\u0438\u043d\u0446\u0438\u043f \u0440\u0430\u0431\u043e\u0442\u044b \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438:<\/h3>\n<p>\u041e\u0442\u043f\u0440\u0430\u0432\u043a\u0430:<\/p>\n<pre><code>_PyXIData_t *data = xi_data_serialize(obj);  \/\/ \u0421\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f _channelitem *item = create_item(data);       \/\/ \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 append_to_queue(queue, item);                 \/\/ \u0418\u043d\u044a\u0435\u043a\u0446\u0438\u044f \u0432 \u043e\u0447\u0435\u0440\u0435\u0434\u044c signal_receivers(waiting);                    \/\/ \u0423\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u0435\u043b\u0435\u0439 <\/code><\/pre>\n<p>\u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435:<\/p>\n<pre><code>_channelitem *item = pop_from_queue(queue);   \/\/ \u0418\u0437\u0432\u043b\u0435\u0447\u0435\u043d\u0438\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 if (!item) wait_with_timeout(mutex, timeout); \/\/ \u0411\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0430 \u043f\u0440\u0438 \u043f\u0443\u0441\u0442\u043e\u0439 \u043e\u0447\u0435\u0440\u0435\u0434\u0438 PyObject *obj = xi_data_deserialize(item-&gt;data); \/\/ \u0414\u0435\u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f <\/code><\/pre>\n<p>\u0417\u0430\u043a\u0440\u044b\u0442\u0438\u0435:<\/p>\n<pre><code>channel-&gt;open = 0;                          \/\/ \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0444\u043b\u0430\u0433\u0430 broadcast_closing(channel-&gt;waiting);         \/\/ \u041e\u043f\u043e\u0432\u0435\u0449\u0435\u043d\u0438\u0435 \u0436\u0434\u0443\u0449\u0438\u0445 \u043f\u043e\u0442\u043e\u043a\u043e\u0432 schedule_async_cleanup(channel);             \/\/ \u0410\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u0430\u044f \u043e\u0447\u0438\u0441\u0442\u043a\u0430 <\/code><\/pre>\n<p>\u0421\u0438\u0441\u0442\u0435\u043c\u0430 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043e\u0448\u0438\u0431\u043e\u043a \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u0443\u0435\u0442 \u043a\u043e\u0434\u044b \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0445 \u0432\u044b\u0437\u043e\u0432\u043e\u0432 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 <code>EAGAIN<\/code>) \u0432 Python-\u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c <code>PyErr_SetFromErrno<\/code>. \u0414\u043b\u044f \u043a\u0440\u0438\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0441\u0435\u043a\u0446\u0438\u0439 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u043f\u0430\u0442\u0442\u0435\u0440\u043d <code>Py_BEGIN_CRITICAL_SECTION<\/code> \u0441 \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0435\u0439 \u043e\u0441\u0432\u043e\u0431\u043e\u0436\u0434\u0435\u043d\u0438\u044f \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432. \u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u0435\u0442 \u0441\u0442\u0440\u043e\u0433\u0443\u044e \u0438\u0437\u043e\u043b\u044f\u0446\u0438\u044e \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u043e\u0432 \u0447\u0435\u0440\u0435\u0437 \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0432 \u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0435 \u043e\u0442 GC \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435.<\/p>\n<h3>\u276f \u041e \u043c\u043e\u0434\u0443\u043b\u0435<\/h3>\n<p>\u041f\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u043e\u0431 \u043c\u043e\u0442\u0438\u0432\u0430\u0446\u0438\u0438 \u0438 \u043e \u0442\u043e\u043c \u043a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 PEP \u043c\u043e\u0436\u043d\u043e <a href=\"https:\/\/peps.python.org\/pep-0734\/\" rel=\"noopener noreferrer nofollow\">\u043f\u043e \u044d\u0442\u043e\u0439 \u0441\u0441\u044b\u043b\u043a\u0435<\/a>.<\/p>\n<p>\u041c\u043e\u0434\u0443\u043b\u044c <code>interpreters<\/code> \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u0432 Python 3.14, \u043d\u043e \u0441\u0430\u043c\u043e \u043d\u0430\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044f \u043c\u043e\u0434\u0443\u043b\u044f \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u043e, \u0442\u0435\u043f\u0435\u0440\u044c \u044d\u0442\u043e <a href=\"https:\/\/docs.python.org\/3.14\/library\/concurrent.interpreters.html\" rel=\"noopener noreferrer nofollow\">concurrent.interpreters<\/a>.<\/p>\n<p>\u0412 \u043d\u0435\u043c \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043c\u0435\u0442\u043e\u0434\u044b:<\/p>\n<ul>\n<li>\n<p><code>concurrent.interpreters.list_all()<\/code> \u2014 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u043e\u0432, \u043e\u0434\u0438\u043d \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e\u0433\u043e.<\/p>\n<\/li>\n<li>\n<p><code>concurrent.interpreters.get_current()<\/code> \u2014 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043e\u0431\u044a\u0435\u043a\u0442 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u0430 \u0434\u043b\u044f \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u0437\u0430\u043f\u0443\u0449\u0435\u043d\u043d\u043e\u0433\u043e.<\/p>\n<\/li>\n<li>\n<p><code>concurrent.interpreters.get_main()<\/code> \u2014 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043e\u0431\u044a\u0435\u043a\u0442 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u0430 \u0434\u043b\u044f \u0433\u043b\u0430\u0432\u043d\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u0430.<\/p>\n<\/li>\n<li>\n<p><code>concurrent.interpreters.create()<\/code> \u2014 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u0442 \u043d\u043e\u0432\u044b\u0439 (idle) Python-\u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440 \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043e\u0431\u044a\u0435\u043a\u0442 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u0435 \u0434\u043b\u044f \u043d\u0435\u0433\u043e.<\/p>\n<\/li>\n<\/ul>\n<p>\u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043e\u0431 \u043e\u0431\u044a\u0435\u043a\u0442\u0430\u0445 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u043d\u0430 <a href=\"https:\/\/docs.python.org\/3.14\/library\/concurrent.interpreters.html\" rel=\"noopener noreferrer nofollow\">\u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438<\/a>.<\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f:<\/p>\n<pre><code class=\"python\">import concurrent.interpreters as interpreters from textwrap import dedent  interp = interpreters.create()  # Run in the current OS thread. interp.exec('print(\"spam!\")')  interp.exec(\"\"\"if True:     print('spam!')     \"\"\")  interp.exec(dedent(\"\"\"     print('spam!')     \"\"\"))  def run():     print('spam!')  interp.call(run)  # Run in new OS thread. t = interp.call_in_thread(run) t.join() <\/code><\/pre>\n<p>\u0414\u043b\u044f Python 3.12+ \u0435\u0441\u0442\u044c \u0435\u0449\u0435 PyPI-\u043f\u0430\u043a\u0435\u0442 <a href=\"https:\/\/pypi.org\/project\/interpreters-pep-734\/\" rel=\"noopener noreferrer nofollow\">interpreters-pep-734<\/a>:<\/p>\n<pre><code class=\"python\">try:     import interpreters except ModuleNotFoundError:     from interpreters_backports import interpreters  try:     import interpreters.queues except ModuleNotFoundError:     import interpreters_backports.interpreters.queues     from interpreters_backports import interpreters  try:     from interpreters import channels except ModuleNotFoundError:     from interpreters_experimental.interpreters import channels  try:     from concurrent.futures import ThreadPoolExecutor except ModuleNotFoundError:     from interpreters_backports.concurrent.futures import ThreadPoolExecutor <\/code><\/pre>\n<h3>\u276f \u0410 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435?<\/h3>\n<p>\u041f\u0440\u043e\u0446\u0435\u0441\u0441 \u043e\u0434\u0438\u043d, \u043d\u043e \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u043e\u0432 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0438 \u0443 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0441\u0432\u043e\u0439 GIL. \u0412\u0441\u0435 \u043e\u043d\u0438 \u0434\u0435\u043b\u044f\u0442 \u043e\u0434\u043d\u0443 \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u043d\u0443\u044e \u043f\u0430\u043c\u044f\u0442\u044c. \u0414\u043b\u044f \u0437\u0430\u0449\u0438\u0442\u044b \u043e\u0442 \u043f\u0435\u0440\u0435\u0442\u0435\u0440\u0430\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u0440\u0430\u0437\u043d\u044b\u043c\u0438 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u0430\u043c\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f pickle, \u043e\u043d \u043d\u0435 \u0434\u043e\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f \u043c\u0443\u0442\u0430\u0446\u0438\u044f \u043e\u0434\u043d\u043e\u0439 \u043f\u0430\u043c\u044f\u0442\u0438 \u0438\u0437 \u0440\u0430\u0437\u043d\u044b\u0445 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u043e\u0432 (\u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u043a\u043e\u043d\u0444\u043b\u0438\u043a\u0442\u043e\u0432\u0430\u043b\u0438 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u044b).<\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u043d\u044f\u0442\u044c \u0438\u0445 \u043c\u043e\u0436\u043d\u043e \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e CSP \u0438\u0437 Golang (\u0435\u0441\u043b\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0448\u0435\u0434\u0443\u043b\u0434\u0435\u0440).<\/p>\n<p>\u041f\u0440\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043d\u0435\u0438\u0437\u043c\u0435\u043d\u044f\u0435\u043c\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0441\u0443\u0431\u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u0430\u0445 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0432 <a href=\"https:\/\/youtu.be\/fwRMdncVOnA?si=2bO08V7Etp7w8qpM\" rel=\"noopener noreferrer nofollow\">\u0434\u043e\u043a\u043b\u0430\u0434\u0435 \u042e\u0440\u0438\u044f \u0421\u0435\u043b\u0438\u0432\u0430\u043d\u043e\u0432\u0430<\/a>.<\/p>\n<p>\u0422\u0430\u043a\u0436\u0435 \u043d\u0430 PyCON US-24 \u043f\u0440\u0435\u0437\u0435\u043d\u0442\u043e\u0432\u0430\u043b\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b \u043f\u043e\u0434\u0438\u043d\u0442\u0435\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u043e\u0432 \u0438 free-threading. \u0412\u0438\u0434\u0435\u043e-\u0434\u043e\u043a\u043b\u0430\u0434 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c <a href=\"https:\/\/youtu.be\/Mp5wKOL4L2Q?si=vP-u9utukkzWpBkL\" rel=\"noopener noreferrer nofollow\">\u0437\u0434\u0435\u0441\u044c<\/a>.<\/p>\n<p>\u0421\u0443\u0431\u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u044b \u043d\u0435 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u041e\u0421, \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0442 \u0432 \u043e\u0434\u043d\u043e\u043c \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435. \u041f\u043e\u0442\u043e\u043a\u0438 \u041e\u0421 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u043f\u0440\u0438\u0432\u044f\u0437\u0430\u043d\u044b \u043a \u0440\u0430\u0437\u043d\u044b\u043c \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u0430\u043c, \u0438 \u0435\u0441\u043b\u0438 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 <em>\u0441\u0432\u043e\u0439<\/em> GIL (PEP-684), \u0435\u0433\u043e \u043f\u043e\u0442\u043e\u043a\u0438 \u043d\u0435 \u0431\u043b\u043e\u043a\u0438\u0440\u0443\u044e\u0442\u0441\u044f GIL \u0434\u0440\u0443\u0433\u0438\u0445 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u043e\u0432.<\/p>\n<figure class=\"\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/gd\/5r\/zs\/gd5rzscgtd_pxo9bfibsimqt8r8.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/gd\/5r\/zs\/gd5rzscgtd_pxo9bfibsimqt8r8.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/gd\/5r\/zs\/gd5rzscgtd_pxo9bfibsimqt8r8.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/figure>\n<p>\u0424\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438, \u043f\u043e\u0434\u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440 \u2014 \u044d\u0442\u043e \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0435 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u043e \u0438\u043c\u0435\u043d, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043c\u043e\u0436\u0435\u0442 \u0438\u043c\u0435\u0442\u044c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 GIL. \u0418\u0437\u043e\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043e\u0442 \u0434\u0440\u0443\u0433\u0438\u0445 \u043f\u043e\u0434\u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u043e\u0432.<\/p>\n<p>\u0410 \u043c\u043e\u0436\u0435\u0442 \u0438 \u043d\u0435 \u0438\u043c\u0435\u0442\u044c:<\/p>\n<pre><code>PyInterpreterConfig config = {           .use_main_obmalloc = 0,           .allow_fork = 0,           .allow_exec = 0,           .allow_threads = 1,           .allow_daemon_threads = 0,           .check_multi_interp_extensions = 1,           .gil = PyInterpreterConfig_OWN_GIL,       }; <\/code><\/pre>\n<p><code>.gil = PyInterpreterConfig_OWN_GIL<\/code> \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c <code>PyInterpreterConfig_SHARED_GIL<\/code>.<\/p>\n<p>\u0421\u043e\u0433\u043b\u0430\u0441\u043d\u043e PEP:<\/p>\n<blockquote>\n<p>The interpreters module will provide a high-level interface to the multiple interpreter functionality. The goal is to make the existing multiple-interpreters feature of CPython more easily accessible to Python code. This is particularly relevant now that CPython has a per-interpreter GIL (PEP 684) and people are more interested in using multiple interpreters.<\/p>\n<\/blockquote>\n<p>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u043e\u0434\u0438\u043d\u0442\u0435\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u043e\u0432 \u043c\u043e\u0436\u0435\u0442 \u0434\u0430\u0442\u044c \u0431\u0443\u0441\u0442 \u043a \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0438 \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u043c\u0443 GIL. \u0418 \u043c\u044b \u0442\u0430\u043a \u043f\u043b\u0430\u0432\u043d\u043e \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043a \u0431\u0435\u043d\u0447\u043c\u0430\u0440\u043a\u0430\u043c.<\/p>\n<h3>\u276f \u0411\u0435\u043d\u0447\u043c\u0430\u0440\u043a<\/h3>\n<p>\u041a\u043e\u0434 \u0437\u0430\u043c\u0435\u0440\u0430 \u044f \u0432\u0437\u044f\u043b <a href=\"https:\/\/gist.github.com\/sobolevn\/149a461c629f6e03aef3a772c7422b2e\" rel=\"noopener noreferrer nofollow\">\u043e\u0442\u0441\u044e\u0434\u0430<\/a> (\u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 pyperf \u0438 httpx).<\/p>\n<p>\u0411\u0435\u043d\u0447\u043c\u0430\u0440\u043a \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 IO-bound \u0438 CPU-bound \u0437\u0430\u0434\u0430\u0447\u0438. \u041e\u043d \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442 \u043f\u0440\u043e\u0441\u0442\u0443\u044e \u0432\u0435\u0440\u0441\u0438\u044e, Threading GIL\/NoGIL, \u0447\u0435\u0440\u0435\u0437 \u043c\u0443\u043b\u044c\u0442\u0438\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0438\u043d\u0433 \u0438 \u0441\u0430\u043c\u0438 \u043f\u043e\u0434\u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u044b.<\/p>\n<p>IO-bound \u0437\u0430\u0434\u0430\u0447\u0430 \u043d\u0430 Ryzen 7 5825u:<\/p>\n<pre><code>Regular: Mean +- std dev: 4.85 sec +- 0.48 sec Threading: Mean +- std dev: 1.22 sec +- 0.19 sec Multiprocessing: Mean +- std dev: 1.45 sec +- 0.26 sec Subinterpreters: Meain +- std dev: 1.85 sec +- 0.30 sec <\/code><\/pre>\n<p>CPU-bound \u0437\u0430\u0434\u0430\u0447\u0430 \u043d\u0430 Ryzen 7 5825u:<\/p>\n<pre><code>Regular: Mean +- std dev: 60.2 ms +- 0.6 ms Threading: Mean +- std dev: 22.6 ms +- 0.7 ms Multiprocessing: Mean +- std dev: 153 ms +- 3 ms Subinterpreters: Mean +- std dev: 120.8 ms +- 4 ms <\/code><\/pre>\n<p>\u0414\u043b\u044f \u0447\u0438\u0441\u0442\u043e\u0442\u044b \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0430, \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u043d\u0430 \u0434\u0440\u0443\u0433\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u0435.<\/p>\n<blockquote>\n<p>\u0417\u0434\u0435\u0441\u044c <code>WORKLOADS<\/code> \u0431\u044b\u043b\u0438 \u043f\u043e\u0431\u043e\u043b\u044c\u0448\u0435 \u0447\u0435\u043c \u0432 \u043f\u0435\u0440\u0432\u043e\u043c \u0431\u0435\u043d\u0447\u043c\u0430\u0440\u043a\u0435 \u043d\u0430 ryzen, \u0441\u0442\u0430\u043b\u0438: <code>WORKLOADS = [(1, 10000), (10001, 20000), (20001, 30000), (30001, 40000)]<\/code><\/p>\n<\/blockquote>\n<p>CPU-bound \u0437\u0430\u0434\u0430\u0447\u0430 \u043d\u0430 M2 Pro:<\/p>\n<pre><code>Regular: Mean +- std dev: 163 ms +- 1 ms Threading with GIL: Mean +- std dev: 168 ms +- 2 ms Threading NoGIL: Mean +- std dev: 48.7 ms +- 0.6 ms Multiprocessing: Mean +- std dev: 73.4 ms +- 1.5 ms Subinterpreters: Mean +- std dev: 44.8 ms +- 0.5 ms <\/code><\/pre>\n<p>IO-bound \u0437\u0430\u0434\u0430\u0447\u0430 \u043d\u0430 M2 Pro:<\/p>\n<pre><code>Regular: Mean +- std dev: 1.45 sec +- 0.03 sec Threading with GIL: Mean +- std dev: 384 ms +- 17 ms (~1\/4 \u043e\u0442 1.45s) Threading NoGIL: Mean +- std dev: 373 ms +- 20 ms Multiprocessing: Mean +- std dev: 687 ms +- 32 ms Subinterpreters: Mean +- std dev: 547 ms +- 13 ms <\/code><\/pre>\n<p>\u041c\u043e\u0436\u0435\u0442 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f, \u0447\u0442\u043e \u043d\u0435 \u0442\u0430\u043a \u043c\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0432\u044b\u0434\u0430\u043b\u043e. \u041d\u043e \u043c\u044b \u043d\u0435 \u0443\u0447\u043b\u0438 \u0447\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0441\u0442\u044c, \u043c\u043d\u043e\u0433\u043e\u043f\u043e\u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c \u0432\u043d\u0443\u0442\u0440\u0438 \u043f\u043e\u0434\u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u043e\u0432. \u0412 \u0438\u0442\u043e\u0433\u0435 \u043e\u0442\u043b\u0438\u0447\u043d\u044b\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b \u0434\u043b\u044f \u0434\u043b\u0438\u043d\u043d\u044b\u0445 \u0437\u0430\u0434\u0430\u0447, \u043a\u043e\u0433\u0434\u0430 \u043d\u0443\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u043d\u043e\u0433\u043e \u0438\u043b\u0438 \u0432\u0430\u0436\u043d\u0430 \u0438\u0437\u043e\u043b\u044f\u0446\u0438\u044f. \u041f\u0438\u0448\u0438\u0442\u0435 \u0441\u0432\u043e\u0438 \u043c\u043d\u0435\u043d\u0438\u044f \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445.<\/p>\n<p>\u041c\u043e\u0436\u043d\u043e \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u0447\u0442\u043e \u0441\u0430\u0431\u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u044b \u0443\u0441\u0442\u0443\u043f\u0430\u044e\u0442 \u0432 IO-bound \u0437\u0430\u0434\u0430\u0447\u0430\u0445 \u043f\u0435\u0440\u0435\u0434 \u0442\u0440\u0435\u0434\u0438\u043d\u0433\u043e\u043c. \u041f\u043e\u0447\u0435\u043c\u0443 \u0442\u0430\u043a \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442?<\/p>\n<p>\u0412 \u0441\u0443\u0431\u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u0430\u0445 \u043a\u0430\u0436\u0434\u044b\u0439 \u0432\u044b\u0437\u043e\u0432 <code>interp.exec()<\/code> \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435, \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0441\u0435\u0441\u0441\u0438\u0439 \u043c\u0435\u0436\u0434\u0443 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u0430\u043c\u0438, \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043d\u043e\u0432\u043e\u0433\u043e GIL \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438. \u0421\u0430\u043c\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u043e\u0432 \u0434\u043e\u0440\u043e\u0433\u043e\u0435, \u0438 \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0438\u0445 \u043b\u0443\u0447\u0448\u0435 \u0432\u044b\u0431\u0438\u0440\u0430\u0442\u044c \u0434\u043b\u044f CPU-bound \u2014 \u0438\u0431\u043e \u043e\u043d\u0438 \u0434\u0430\u044e\u0442 \u0438\u0441\u0442\u0438\u043d\u043d\u044b\u0439 \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u0438\u0437\u043c \u043d\u0430 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u044f\u0434\u0440\u0430\u0445.<\/p>\n<p>\u0421\u0443\u0431\u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u044b \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0442 \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u043e \u0432 CPU-bound \u0437\u0430\u0434\u0430\u0447\u0430\u0445 <strong>\u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u0438 \u0438\u0441\u0442\u0438\u043d\u043d\u043e \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e\u043c \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0438<\/strong> (\u043a\u043e\u0433\u0434\u0430 \u0443 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0435\u0441\u0442\u044c \u0441\u0432\u043e\u0439 GIL). \u0412 \u0442\u0435\u043a\u0443\u0449\u0435\u043c CPython (\u043e\u0431\u0449\u0438\u0439 GIL) \u043e\u043d\u0438 \u043f\u0440\u043e\u0438\u0433\u0440\u044b\u0432\u0430\u044e\u0442 \u043f\u043e\u0442\u043e\u043a\u0430\u043c \u0438\u0437-\u0437\u0430 \u043d\u0430\u043a\u043b\u0430\u0434\u043d\u044b\u0445 \u0440\u0430\u0441\u0445\u043e\u0434\u043e\u0432 \u043d\u0430 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0443 \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<p>\u041a\u0430\u0436\u0434\u044b\u0439 \u0432\u044b\u0437\u043e\u0432 <code>interp.exec()<\/code> \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u043c\u0435\u0436\u044a\u044f\u0434\u0435\u0440\u043d\u044b\u0439 \u0444\u043e\u0440\u043c\u0430\u0442 \u0447\u0435\u0440\u0435\u0437 <code>_PyXIData_t<\/code>. \u0414\u043b\u044f \u043f\u0440\u043e\u0441\u0442\u044b\u0445 \u0442\u0438\u043f\u043e\u0432 (int, str) \u044d\u0442\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0431\u044b\u0441\u0442\u0440\u043e, \u043d\u043e \u043f\u0440\u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0435 \u0441\u043b\u043e\u0436\u043d\u044b\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 (\u0441\u043b\u043e\u0432\u0430\u0440\u0438, \u0434\u0430\u0442\u0430\u043a\u043b\u0430\u0441\u0441\u044b) \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438, \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u044b\u0439 pickle. \u0412 \u0442\u0435\u0441\u0442\u0430\u0445 \u0441 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0435\u0439 1000 \u0441\u043b\u043e\u0432\u0430\u0440\u0435\u0439 \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u043c 1 \u041a\u0411 \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0441\u044a\u0435\u0434\u0430\u043b\u0430 37% \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f.<\/p>\n<h3>\u276f \u041e\u0431\u0449\u0438\u0435 \u0432\u044b\u0432\u043e\u0434\u044b<\/h3>\n<p>\u041a \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440\u0443 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u044e <a href=\"https:\/\/www.youtube.com\/watch?v=VBiaNNpLzWA\" rel=\"noopener noreferrer nofollow\">\u0438\u043d\u0442\u0435\u0440\u0432\u044c\u044e CPython Core \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 \u041d\u0438\u043a\u0438\u0442\u044b \u0421\u043e\u0431\u043e\u043b\u0435\u0432\u0430 \u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 \u043c\u043e\u0434\u0443\u043b\u044f \u0441\u0430\u0431\u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u043e\u0432 \u042d\u0440\u0438\u043a\u0430 \u0421\u043d\u043e\u0443<\/a>.<\/p>\n<p>\u041f\u043e\u0433\u0440\u0443\u0436\u0430\u044f\u0441\u044c \u0432 \u0438\u0441\u0442\u043e\u0440\u0438\u044e \u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u0441\u0443\u0431\u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u043e\u0432, \u044f\u0441\u043d\u043e \u043e\u0434\u043d\u043e \u2014 \u0447\u0442\u043e \u044d\u0442\u043e \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0444\u0443\u043d\u0434\u0430\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u044b\u0439 \u0441\u0434\u0432\u0438\u0433 \u0432 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0435 CPython. \u041f\u043e \u0441\u0443\u0442\u0438 \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u0441\u0442\u0438\u0447\u044c \u0438\u0441\u0442\u0438\u043d\u043d\u043e\u0433\u043e \u043f\u0430\u0440\u0430\u043b\u0435\u043b\u043b\u0438\u0437\u043c\u0430 \u0447\u0435\u0440\u0435\u0437 \u0441\u0443\u0431\u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u044b.<\/p>\n<p>\u041e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u0435\u0442 \u0434\u0435\u0442\u0430\u043b\u044c \u0447\u0442\u043e \u043c\u044b \u043f\u0440\u043e\u0441\u0442\u043e \u0438\u0437\u043e\u043b\u0438\u0440\u0443\u0435\u043c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u043e\u0432, \u0432\u044b\u0434\u0430\u0432\u0430\u044f \u043a\u0430\u0436\u0434\u043e\u043c\u0443 \u043f\u043e \u0441\u0432\u043e\u0435\u043c\u0443 GIL. \u0412 \u0442\u043e\u043c \u0438\u043d\u0442\u0435\u0440\u0432\u044c\u044e \u042d\u0440\u0438\u043a \u0432\u0435\u0440\u043d\u043e \u043f\u043e\u0434\u043c\u0435\u0442\u0438\u043b, \u0447\u0442\u043e \u00ab\u0438\u0437\u043e\u043b\u044f\u0446\u0438\u044f \u0434\u0430\u0451\u0442 \u043d\u0430\u043c \u043a\u043e\u043d\u0446\u0435\u043f\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0435 \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u043e\u00bb.<\/p>\n<p>\u041d\u043e \u044d\u0442\u0430 \u0441\u0430\u043c\u0430\u044f \u0438\u0437\u043e\u043b\u044f\u0446\u0438\u044f \u043e\u0447\u0435\u043d\u044c \u0441\u043b\u043e\u0436\u043d\u043e \u0434\u0430\u043b\u0430\u0441\u044c \u2014 \u0432\u0441\u0435 \u0438\u0437-\u0437\u0430 \u043d\u044e\u0430\u043d\u0441\u043e\u0432 \u0432 \u0432\u0438\u0434\u0435:<\/p>\n<ol>\n<li>\n<p><strong>Immortal objects<\/strong> (<a href=\"https:\/\/peps.python.org\/pep-0683\/\" rel=\"noopener noreferrer nofollow\">PEP 683<\/a>): \u041e\u0431\u044a\u0435\u043a\u0442\u044b \u0432\u0440\u043e\u0434\u0435 None \u0438\u043b\u0438 \u043c\u0430\u043b\u044b\u0445 \u0446\u0435\u043b\u044b\u0445 \u0447\u0438\u0441\u0435\u043b \u0441\u0442\u0430\u043b\u0438 \u00ab\u0431\u0435\u0441\u0441\u043c\u0435\u0440\u0442\u043d\u044b\u043c\u0438\u00bb \u2014 \u0438\u0445 \u0441\u0447\u0451\u0442\u0447\u0438\u043a \u0441\u0441\u044b\u043b\u043e\u043a \u0444\u0438\u043a\u0441\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043d\u0430 \u0430\u0441\u0442\u0440\u043e\u043d\u043e\u043c\u0438\u0447\u0435\u0441\u043a\u043e\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0438, \u0438\u0441\u043a\u043b\u044e\u0447\u0430\u044f \u0433\u043e\u043d\u043a\u0438 \u043c\u0435\u0436\u0434\u0443 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u0430\u043c\u0438.<\/p>\n<\/li>\n<\/ol>\n<blockquote>\n<p>\u041a\u0441\u0442\u0430\u0442\u0438, \u0438\u043c\u0435\u043d\u043d\u043e \u043f\u043e\u044d\u0442\u043e\u043c\u0443 (\u0438\u0437-\u0437\u0430 PEP 683) <code>sys.getrefcount(X)<\/code> \u0433\u0434\u0435 X \u2014 \u0447\u0438\u0441\u043b\u043e \u043e\u0442 -5 \u0434\u043e 256 \u0432\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e, \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u0437\u0430\u043e\u0431\u043b\u0430\u0447\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f, \u043d\u043e \u0441\u0442\u043e\u0438\u0442 \u0432\u044b\u0439\u0442\u0438 \u0437\u0430 \u044d\u0442\u043e\u0442 \u043b\u0438\u043c\u0438\u0442, \u0442\u043e \u0447\u0438\u0441\u043b\u043e \u0441\u0441\u044b\u043b\u043e\u043a \u0431\u0443\u0434\u0435\u0442 \u0430\u0434\u0435\u043a\u0432\u0430\u0442\u043d\u044b\u043c.<\/p>\n<\/blockquote>\n<ol start=\"2\">\n<li>\n<p><strong>\u0421\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0442\u0438\u043f\u044b<\/strong>: \u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0438\u0437\u043c\u0435\u043d\u044f\u0435\u043c\u044b\u0445 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432 (dict, subclasses) \u0440\u0435\u0448\u0435\u043d\u0430 \u0447\u0435\u0440\u0435\u0437 \u043f\u0435\u0440\u0435\u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0432 per-interpreter \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0430.<\/p>\n<\/li>\n<li>\n<p><strong>\u041c\u043e\u0434\u0443\u043b\u0438 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0439<\/strong>: \u0422\u0440\u0435\u0431\u0443\u044e\u0442 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0430 \u043d\u0430 \u043c\u043d\u043e\u0433\u043e\u0444\u0430\u0437\u043d\u0443\u044e \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e (PEP 489) \u0438 heap-\u0442\u0438\u043f\u044b. \u0411\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0432\u0440\u043e\u0434\u0435 OpenSSL (\u0447\u0435\u0440\u0435\u0437 ssl \u043c\u043e\u0434\u0443\u043b\u044c) \u2014 \u043e\u0441\u043e\u0431\u044b\u0439 \u0441\u043b\u0443\u0447\u0430\u0439, \u0433\u0434\u0435 \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u043c\u0435\u0436\u0434\u0443 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u0430\u043c\u0438 \u0431\u044b\u043b\u043e \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430\u0442\u0438\u0447\u043d\u043e. \u041d\u043e \u043a\u0430\u043a \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e, \u043e\u043d\u0438 \u0443\u0436\u0435 \u043f\u043e\u0431\u043e\u0440\u043e\u043b\u0438 \u044d\u0442\u0443 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443.<\/p>\n<\/li>\n<\/ol>\n<p>\u041d\u043e \u043d\u0435 \u0441\u0442\u043e\u0438\u0442 \u0437\u0430\u0431\u044b\u0432\u0430\u0442\u044c, \u0447\u0442\u043e \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u044f \u0438\u043c\u0435\u0435\u0442 \u0441\u0432\u043e\u0438 \u043c\u0438\u043d\u0443\u0441\u044b. \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u043e\u0432 \u0432\u0435\u0441\u044c\u043c\u0430 \u0434\u043e\u0440\u043e\u0433\u043e\u0435 \u0443\u0434\u043e\u0432\u043e\u043b\u044c\u0441\u0442\u0432\u0438\u0435 \u2014 \u0438\u043d\u043e\u0433\u0434\u0430 \u043b\u0435\u0433\u0447\u0435 \u043e\u0431\u043e\u0439\u0442\u0438\u0441\u044c \u043f\u043e\u0442\u043e\u043a\u0430\u043c\u0438, \u043c\u043d\u043e\u0433\u043e\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u043d\u043e\u0441\u0442\u044c\u044e \u0438\u043b\u0438 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0441\u0442\u044c\u044e. \u041d\u043e \u0432\u0441\u0435 \u044d\u0442\u043e \u0432\u043e\u0437\u043d\u0430\u0433\u0440\u0430\u0436\u0434\u0430\u0435\u0442\u0441\u044f, \u0435\u0441\u043b\u0438 \u0443\u043c\u0435\u0442\u044c \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c.<\/p>\n<p>\u041e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u043f\u0435\u0440\u0441\u043f\u0435\u043a\u0442\u0438\u0432\u043d\u0430 \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u044f \u0441 asyncio. \u041a\u0430\u0436\u0434\u044b\u0439 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440 \u0438\u043c\u0435\u0435\u0442 \u0441\u0432\u043e\u0439 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 event loop, \u043d\u043e \u043f\u043e\u043a\u0430 \u0447\u0442\u043e \u043d\u0435\u0442 \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u043e\u0439 \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u0438 \u043c\u0435\u0436\u0434\u0443 \u043d\u0438\u043c\u0438.<\/p>\n<p>\u0421\u0443\u0431\u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u044b \u2014 \u043d\u0435 \u043d\u043e\u0432\u0430\u044f \u043a\u043e\u043d\u0446\u0435\u043f\u0446\u0438\u044f. \u0418\u0445 \u043a\u043e\u0440\u043d\u0438 \u0443\u0445\u043e\u0434\u044f\u0442 \u0432 Python 1.5, \u0433\u0434\u0435 \u043e\u043d\u0438 \u0432\u043e\u0437\u043d\u0438\u043a\u043b\u0438 \u043a\u0430\u043a \u043e\u0442\u0432\u0435\u0442 \u043d\u0430 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443 \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u044b\u0445 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0439. \u0418\u0434\u0435\u044f \u0438\u043d\u043a\u0430\u043f\u0441\u0443\u043b\u044f\u0446\u0438\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u0430 \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u043d\u0430\u043f\u043e\u043c\u0438\u043d\u0430\u0435\u0442 \u0438\u043d\u0436\u0435\u043d\u0435\u0440\u043d\u044b\u0435 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0438 \u0431\u043e\u0440\u044c\u0431\u044b \u0441 \u00ab\u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u044b\u043c \u0445\u0430\u043e\u0441\u043e\u043c\u00bb. \u041a\u0430\u043a \u043e\u0442\u043c\u0435\u0447\u0430\u0435\u0442 \u042d\u0440\u0438\u043a, \u044d\u0442\u043e \u043b\u043e\u0433\u0438\u0447\u043d\u043e\u0435 \u0440\u0430\u0437\u0432\u0438\u0442\u0438\u0435: \u0435\u0441\u043b\u0438 \u043f\u043e\u0442\u043e\u043a\u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u0438\u0437\u043e\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f (thread state), \u0442\u043e \u0438 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u044b \u0437\u0430\u0441\u043b\u0443\u0436\u0438\u043b\u0438 \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e\u0435. \u0418\u0441\u0442\u043e\u0440\u0438\u0447\u0435\u0441\u043a\u0438 \u0432\u0434\u043e\u0445\u043d\u043e\u0432\u0435\u043d\u0438\u0435\u043c \u043f\u043e\u0441\u043b\u0443\u0436\u0438\u043b TCL, \u043d\u043e \u0432 Python \u044d\u0442\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0434\u0435\u0441\u044f\u0442\u0438\u043b\u0435\u0442\u0438\u044f\u043c\u0438 \u043e\u0441\u0442\u0430\u0432\u0430\u043b\u0430\u0441\u044c \u00ab\u0441\u043f\u044f\u0449\u0435\u0439\u00bb \u0438\u0437-\u0437\u0430 \u043d\u0435\u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e\u0441\u0442\u0438 \u0438\u0437 Python-\u043a\u043e\u0434\u0430 \u0438 \u043d\u0430\u0440\u0443\u0448\u0435\u043d\u0438\u0439 \u0438\u0437\u043e\u043b\u044f\u0446\u0438\u0438.<\/p>\n<p>\u042d\u0440\u0438\u043a \u0441\u043a\u0435\u043f\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0441\u044f \u043d\u0430\u0441\u0447\u0451\u0442 \u043c\u0430\u0441\u0441\u043e\u0432\u043e\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0441\u0443\u0431\u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u043e\u0432. \u0412 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0435, \u043c\u043d\u043e\u0433\u0438\u0435 \u0441 \u043d\u0438\u043c \u0441\u043e\u0433\u043b\u0430\u0441\u044f\u0442\u0441\u044f, \u0442\u0430\u043a \u043a\u0430\u043a \u0438\u0445 \u043d\u0438\u0448\u0430 \u044d\u0442\u043e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0434\u043b\u044f \u0432\u044b\u0441\u043e\u043a\u043e\u0443\u0440\u043e\u0432\u043d\u0435\u0432\u044b\u0445 \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0446\u0438\u0439, \u0432\u0435\u0431-\u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0438, \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0434\u0430\u043d\u043d\u044b\u0445. \u0410 \u0442\u0430\u043a\u0436\u0435 \u043a\u0430\u043a \u0430\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u0430 multiprocessing \u2014 \u0440\u0435\u0441\u0443\u0440\u0441\u044b \u041e\u0421 \u043f\u0440\u0438 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u044d\u043a\u043e\u043d\u043e\u043c\u044f\u0442\u0441\u044f \u043b\u0443\u0447\u0448\u0435, \u043a\u043e\u043c\u043c\u0443\u043d\u0438\u043a\u0430\u0446\u0438\u044f \u0432 \u0440\u0430\u043c\u043a\u0430\u0445 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0431\u044b\u0441\u0442\u0440\u0435\u0435.<\/p>\n<p>\u041d\u043e \u0443\u0441\u043f\u0435\u0445 \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0438 \u0441\u0430\u0431\u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u043e\u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u0442\u0430\u043a\u0436\u0435 \u043e\u0442 \u0430\u0434\u0430\u043f\u0442\u0430\u0446\u0438\u0438 C-\u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0439.<\/p>\n<h3>\u276f \u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h3>\n<p>\u041a\u043e\u0434 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432 \u0438 \u0442\u0435\u0441\u0442\u043e\u0432 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 PEP-0734 \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u0432 <a href=\"https:\/\/github.com\/alexeev-prog\/pep734-examples\" rel=\"noopener noreferrer nofollow\">\u043c\u043e\u0435\u043c \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438<\/a>.<\/p>\n<p>\u041f\u043e\u043b\u044c\u0437\u0443\u044f\u0441\u044c \u043f\u0440\u0430\u0432\u043e\u043c \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0440\u0435\u043a\u043b\u0430\u043c\u044b, \u043c\u043e\u0433\u0443 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0438\u0442\u044c \u0432\u0430\u043c \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u0442\u044c\u0441\u044f \u043d\u0430 <a href=\"https:\/\/t.me\/hex_warehouse\" rel=\"noopener noreferrer nofollow\">\u043c\u043e\u0439 \u0431\u043b\u043e\u0433 \u0432 \u0442\u0435\u043b\u0435\u0433\u0440\u0430\u043c\u0435<\/a> \u0438 \u0442\u0430\u043a\u0436\u0435 \u043d\u0430 \u043a\u0430\u043d\u0430\u043b <a href=\"https:\/\/t.me\/opensource_findings\" rel=\"noopener noreferrer nofollow\">\u00ab\u041d\u0430\u0445\u043e\u0434\u043a\u0438 \u0432 \u043e\u043f\u0435\u043d\u0441\u043e\u0440\u0441\u0435\u00bb<\/a>. \u0415\u0441\u043b\u0438 \u0432\u0430\u043c \u043a\u043e\u043d\u0435\u0447\u043d\u043e \u0441\u0442\u0430\u0442\u044c\u044f \u043f\u043e\u043d\u0440\u0430\u0432\u0438\u043b\u0430\u0441\u044c \u0438 \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u0432\u0438\u0434\u0435\u0442\u044c \u0447\u0443\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0435.<\/p>\n<p>\u0415\u0441\u043b\u0438 \u0432\u0430\u043c \u043f\u043e\u043d\u0440\u0430\u0432\u0438\u043b\u0430\u0441\u044c \u0441\u0442\u0430\u0442\u044c\u044f, \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u0435\u0441\u044c \u0435\u0439 \u0441 \u0434\u0440\u0443\u0437\u044c\u044f\u043c\u0438. \u0410 \u043b\u0443\u0447\u0448\u0435 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0435 \u043a\u043e\u043d\u0442\u0440\u0438\u0431\u044c\u044e\u0442\u0438\u0442\u044c \u0432 python \u0438 \u043f\u0440\u043e\u0447\u0438\u0435 \u043e\u043f\u0435\u043d\u0441\u043e\u0440\u0441 \u043f\u0440\u043e\u0435\u043a\u0442\u044b. \u0423\u0434\u0430\u0447\u0438!<\/p>\n<h4>\u0418\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0438<\/h4>\n<ul>\n<li>\n<p><a href=\"https:\/\/www.youtube.com\/watch?v=VBiaNNpLzWA\" rel=\"noopener noreferrer nofollow\">\u041b\u0443\u0447\u0448\u0438\u0439 \u043a\u0443\u0440\u0441 \u043f\u043e Python 15: Subinterpreters<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/talkpython.fm\/episodes\/show\/225\/can-subinterpreters-free-us-from-pythons-gil\" rel=\"noopener noreferrer nofollow\">Can subinterpreters free us from Python&#8217;s GIL?<\/a><\/p>\n<\/li>\n<\/ul>\n<blockquote>\n<p><a href=\"https:\/\/t.me\/timewebru\" rel=\"noopener noreferrer nofollow\"><strong>\u041d\u043e\u0432\u043e\u0441\u0442\u0438, \u043e\u0431\u0437\u043e\u0440\u044b \u043f\u0440\u043e\u0434\u0443\u043a\u0442\u043e\u0432 \u0438 \u043a\u043e\u043d\u043a\u0443\u0440\u0441\u044b \u043e\u0442 \u043a\u043e\u043c\u0430\u043d\u0434\u044b Timeweb.Cloud &#8212; \u0432 \u043d\u0430\u0448\u0435\u043c Telegram-\u043a\u0430\u043d\u0430\u043b\u0435<\/strong><\/a> <strong>\u21a9<\/strong><\/p>\n<\/blockquote>\n<figure class=\"\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/l4\/va\/3_\/l4va3_wb_-jzyhjkp0scerkikj8.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/l4\/va\/3_\/l4va3_wb_-jzyhjkp0scerkikj8.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/l4\/va\/3_\/l4va3_wb_-jzyhjkp0scerkikj8.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/figure>\n<p><strong><em>\u041f\u0435\u0440\u0435\u0434 \u043e\u043f\u043b\u0430\u0442\u043e\u0439 \u0432 \u0440\u0430\u0437\u0434\u0435\u043b\u0435 \u00ab\u0411\u043e\u043d\u0443\u0441\u044b \u0438 \u043f\u0440\u043e\u043c\u043e\u043a\u043e\u0434\u044b\u00bb \u0432 \u043f\u0430\u043d\u0435\u043b\u0438 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f <\/em><\/strong><a href=\"https:\/\/timeweb.cloud\/?utm_source=habr&amp;utm_medium=banner&amp;utm_campaign=promo\" rel=\"noopener noreferrer nofollow\"><strong><em>\u0430\u043a\u0442\u0438\u0432\u0438\u0440\u0443\u0439\u0442\u0435 \u043f\u0440\u043e\u043c\u043e\u043a\u043e\u0434<\/em><\/strong><\/a><strong><em> \u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0435 \u043a\u044d\u0448\u0431\u044d\u043a \u043d\u0430 \u0431\u0430\u043b\u0430\u043d\u0441.<\/em><\/strong><\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/922314\/\"> https:\/\/habr.com\/ru\/articles\/922314\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>5 \u0438\u044e\u043d\u044f 2025 \u0433\u043e\u0434\u0430 \u0431\u044b\u043b \u043f\u0440\u0438\u043d\u044f\u0442 <a href=\"https:\/\/peps.python.org\/pep-0734\/\" rel=\"noopener noreferrer nofollow\">PEP-0734<\/a>. \u0421\u0443\u0434\u044f \u043f\u043e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043d\u0430 \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u043c \u0441\u0430\u0439\u0442\u0435, \u043e\u043d \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0435\u043d\u0438\u0435\u043c <a href=\"https:\/\/peps.python.org\/pep-0554\/\" rel=\"noopener noreferrer nofollow\">PEP-0554<\/a>. \u042d\u0442\u043e\u0442 PEP \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u0442 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043d\u043e\u0432\u044b\u0439 \u043c\u043e\u0434\u0443\u043b\u044c <code>interpreters<\/code> \u0434\u043b\u044f \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438, \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u043a\u043e\u0434\u0430 \u0432 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u0430\u0445 \u0432 \u0442\u0435\u043a\u0443\u0449\u0435\u043c \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435. \u0410 \u0435\u0441\u043b\u0438 \u0438\u0434\u0442\u0438 \u0434\u0430\u043b\u044c\u0448\u0435, \u0442\u043e \u043e\u043d \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0435\u043d\u0438\u0435\u043c <a href=\"https:\/\/peps.python.org\/pep-0684\/\" rel=\"noopener noreferrer nofollow\">PEP-0684<\/a>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u0442 \u043e\u0434\u0438\u043d GIL \u043d\u0430 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440.<\/p>\n<p>\u041d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u043b\u043d\u043e\u0446\u0435\u043d\u043d\u044b\u0445 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u043e\u0432 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0438\u0445 \u0440\u044f\u0434\u043e\u043c. \u041a\u0430\u043a\u0438\u0435 \u043f\u043b\u044e\u0441\u044b?<\/p>\n<ul>\n<li>\n<p>\u041e\u0434\u0438\u043d \u043f\u0440\u043e\u0446\u0435\u0441\u0441;<\/p>\n<\/li>\n<li>\n<p>\u041e\u0434\u0438\u043d \u0442\u0440\u0435\u0434, \u043d\u043e \u0440\u0443\u043a\u0430\u043c\u0438 \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0435\u0449\u0435;<\/p>\n<\/li>\n<li>\n<p>\u0414\u0430\u043d\u043d\u044b\u0435 \u043c\u0435\u0436\u0434\u0443 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u0430\u043c\u0438 \u0432\u0441\u0435\u0433\u0434\u0430 \u043f\u0435\u0440\u0435\u0434\u0430\u044e\u0442\u0441\u044f \u0447\u0435\u0440\u0435\u0437 \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e, \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u0443\u044e pickle, \u0432\u043a\u043b\u044e\u0447\u0430\u044f \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u043d\u044b\u0435 \u0442\u0438\u043f\u044b;<\/p>\n<\/li>\n<li>\n<p>\u041f\u043e GIL\u0443 \u043d\u0430 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440, \u0432\u0441\u0435 \u0435\u0449\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043f\u043b\u044e\u0448\u043a\u0438 \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0435\u0439 \u043c\u043d\u043e\u0433\u043e\u0437\u0430\u0434\u0430\u0447\u043d\u043e\u0441\u0442\u0438 \u043f\u043e \u0441\u0435\u0442\u0438;<\/p>\n<\/li>\n<li>\n<p>\u0420\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441 asyncio.<\/p>\n<\/li>\n<\/ul>\n<blockquote>\n<p>GIL (Global Interpreter Lock) \u0432 Python \u2014 \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u0430\u044f \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0430 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u0430. \u042d\u0442\u043e \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c, \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0439 \u0432 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0443\u044e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e Python (CPython), \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u0435\u0434\u043e\u0442\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0431\u0430\u0439\u0442-\u043a\u043e\u0434\u0430 Python \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u043c\u0438 \u043f\u043e\u0442\u043e\u043a\u0430\u043c\u0438.<\/p>\n<\/blockquote>\n<p>\u0421\u0440\u0435\u0434\u0438 \u043c\u0438\u043d\u0443\u0441\u043e\u0432 \u2014 \u0434\u0430\u043d\u043d\u044b\u0439 PEP \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0438\u0437\u043c\u0435\u043d\u0438\u043b C-\u043a\u043e\u0434, \u0438 \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0435 \u0432\u0441\u0435\u0433\u0434\u0430 \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0441\u0442\u0430\u0431\u0438\u043b\u044c\u043d\u043e\u0441\u0442\u044c C-\u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0439. \u041a\u0441\u0442\u0430\u0442\u0438, \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u0438\u0445 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c, \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u043b \u0432 <a href=\"https:\/\/habr.com\/ru\/companies\/timeweb\/articles\/875420\/\" rel=\"noopener noreferrer nofollow\">\u0441\u0432\u043e\u0435\u0439 \u043f\u0440\u043e\u0448\u043b\u043e\u0439  \u0441\u0442\u0430\u0442\u044c\u0435<\/a>.<\/p>\n<p>\u0415\u0441\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u0430\u0436\u043d\u044b\u0445 \u043d\u0435\u0442\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0430\u0441\u043f\u0435\u043a\u0442\u043e\u0432 \u043f\u0440\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u043e\u0439 \u0444\u0438\u0447\u0438:<\/p>\n<ul>\n<li>\n<p>PEP-734 \u0438 Free-Threading \u0434\u0435\u043b\u0430\u044e\u0442 \u043e\u0447\u0435\u043d\u044c \u043f\u043e\u0445\u043e\u0436\u0438\u0435 \u0432\u0435\u0449\u0438 \u2013 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u044b\u0432\u0430\u0442\u044c \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0443\u044e \u043c\u043d\u043e\u0433\u043e\u0437\u0430\u0434\u0430\u0447\u043d\u043e\u0441\u0442\u044c, \u043d\u043e \u0440\u0430\u0437\u043d\u044b\u043c\u0438 \u0441\u043f\u043e\u0441\u043e\u0431\u0430\u043c\u0438;<\/p>\n<\/li>\n<li>\n<p>\u0418\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u0441\u0443\u0431\u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u044b \u043f\u043e\u044f\u0432\u0438\u043b\u0438\u0441\u044c \u0432 3.10 \u0432 \u0432\u0438\u0434\u0435 \u0442\u043e\u043b\u044c\u043a\u043e C-API;<\/p>\n<\/li>\n<li>\n<p>\u0415\u0441\u0442\u044c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 PyPI \u043f\u0430\u043a\u0435\u0442 (<a href=\"https:\/\/pypi.org\/project\/interpreters-pep-734\/\" rel=\"noopener noreferrer nofollow\">https:\/\/pypi.org\/project\/interpreters-pep-734\/<\/a>) \u0441 \u0434\u0430\u043d\u043d\u044b\u043c \u043a\u043e\u0434\u043e\u043c;<\/p>\n<\/li>\n<li>\n<p>Python \u0447\u0430\u0441\u0442\u044c \u0432 \u0432\u0438\u0434\u0435 PEP-734 \u0431\u044b\u043b \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d \u0432 3.14 \u0443\u0436\u0435 \u043f\u043e\u0441\u043b\u0435 feature freeze;<\/p>\n<\/li>\n<li>\n<p>\u0418\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043b\u043e\u0441\u044c \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0435\u0433\u043e \u043a\u0430\u043a \u043c\u043e\u0434\u0443\u043b\u044c <code>interpreters<\/code>, \u043e\u0434\u043d\u0430\u043a\u043e \u0432 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u043e\u043d \u0441\u0442\u0430\u043b <code>concurrent.interpreters<\/code>, \u0432\u043e\u0442 \u0442\u0443\u0442 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e <a href=\"https:\/\/discuss.python.org\/t\/decision-making-process-improvements-or-my-frustrations-with-how-pep-734-has-played-out\/95985\" rel=\"noopener noreferrer nofollow\">\u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u043e\u0431\u0441\u0443\u0436\u0434\u0435\u043d\u0438\u0435<\/a>.<\/p>\n<\/li>\n<\/ul>\n<p>PEP \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u043c\u043e\u0434\u0443\u043b\u044c <code>interpreters<\/code> (<code>concurrent.interpreters<\/code>). \u042d\u0442\u043e\u0442 \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u043e\u0431\u044a\u0435\u043a\u0442\u044b <code>Interpreter<\/code>, \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0435 \u0431\u0430\u0437\u043e\u0432\u044b\u0435 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u044b. \u041c\u043e\u0434\u0443\u043b\u044c \u0442\u0430\u043a\u0436\u0435 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0431\u0430\u0437\u043e\u0432\u044b\u0439 \u043a\u043b\u0430\u0441\u0441 <code>Queue<\/code> (\u043e\u0447\u0435\u0440\u0435\u0434\u0438) \u0434\u043b\u044f \u0441\u0432\u044f\u0437\u0438 \u043c\u0435\u0436\u0434\u0443 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u0430\u043c\u0438.<\/p>\n<p>\u0414\u043b\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 API:<\/p>\n<pre><code class=\"python\">interp = interpreters.create() try:     interp.exec('print(\"Hello from PEP-554\")') finally:     interp.close() <\/code><\/pre>\n<p>\u041f\u0440\u044f\u043c\u043e \u0441\u0435\u0439\u0447\u0430\u0441, \u0435\u0441\u043b\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c Python 3.14, \u043c\u043e\u0436\u043d\u043e \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u0430\u043a\u0435\u0442 <code>concurrent.interpreters<\/code>:<\/p>\n<pre><code class=\"python\">import concurrent.interpreters as interpreters  interp = interpreters.create()  a = 15 print(f\"A in main: {a}\")  try:     interp.exec('print(\"Hello from PEP-554\")\\na = 10\\nprint(f\"A in subinterp: {a}\")') finally:     interp.close() <\/code><\/pre>\n<p>\u0412\u044b\u0432\u043e\u0434 \u043f\u0440\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0435:<\/p>\n<pre><code>A in main: 15 Hello from PEP-554 A in subinterp: 10 <\/code><\/pre>\n<h3>\u276f \u041f\u043e\u0447\u0435\u043c\u0443 \u044d\u0442\u043e\u0442 PEP \u0432\u0430\u0436\u0435\u043d?<\/h3>\n<p>\u041c\u043e\u0434\u0443\u043b\u044c <code>interpreters<\/code> \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u0438\u0442 \u0432\u044b\u0441\u043e\u043a\u043e\u0443\u0440\u043e\u0432\u043d\u0435\u0432\u044b\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0434\u043b\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0445 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u043e\u0432. \u0426\u0435\u043b\u044c \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e\u0431\u044b \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0445 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u043e\u0432 CPython \u0431\u043e\u043b\u0435\u0435 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e\u0439 \u0434\u043b\u044f \u043a\u043e\u0434\u0430 Python. \u042d\u0442\u043e \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u043e \u0441\u0435\u0439\u0447\u0430\u0441, \u043a\u043e\u0433\u0434\u0430 CPython \u0438\u043c\u0435\u0435\u0442 GIL \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u0430 (PEP 684), \u0438 \u043b\u044e\u0434\u0438 \u0431\u043e\u043b\u044c\u0448\u0435 \u0437\u0430\u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043e\u0432\u0430\u043d\u044b \u0432 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0445 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u043e\u0432.<\/p>\n<p>\u0411\u0435\u0437 \u043c\u043e\u0434\u0443\u043b\u044f stdlib \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u044b C API , \u0447\u0442\u043e \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0432\u0430\u0435\u0442 \u0438\u0445 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u043e\u0432.<\/p>\n<p>\u041c\u043e\u0434\u0443\u043b\u044c \u0431\u0443\u0434\u0435\u0442 \u0432\u043a\u043b\u044e\u0447\u0430\u0442\u044c \u0431\u0430\u0437\u043e\u0432\u044b\u0439 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u0434\u043b\u044f \u043e\u0431\u0449\u0435\u043d\u0438\u044f \u043c\u0435\u0436\u0434\u0443 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u043e\u0432. \u0411\u0435\u0437 \u043d\u0435\u0433\u043e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u043e\u0432 \u0431\u0443\u0434\u0443\u0442 \u0433\u043e\u0440\u0430\u0437\u0434\u043e \u043c\u0435\u043d\u0435\u0435 \u043f\u043e\u043b\u0435\u0437\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0435\u0439.<\/p>\n<h3>\u276f \u0423\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e<\/h3>\n<p>\u041f\u043e \u0441\u0443\u0442\u0438, \u00ab\u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u00bb \u2014 \u044d\u0442\u043e \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044f (\u043f\u043e \u0441\u0443\u0442\u0438) \u0432\u0441\u0435\u0445 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0439 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u0442\u043e\u043a\u0438 Python \u0434\u043e\u043b\u0436\u043d\u044b \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c.<\/p>\n<p>\u041f\u0440\u043e\u0446\u0435\u0441\u0441\u044b \u0432 \u043f\u0438\u0442\u043e\u043d\u0435 \u043c\u043e\u0433\u0443\u0442 \u0438\u043c\u0435\u0442\u044c \u043e\u0434\u0438\u043d \u0438\u043b\u0438 \u0431\u043e\u043b\u044c\u0448\u0435 \u043f\u043e\u0442\u043e\u043a\u043e\u0432 \u041e\u0421, \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0449\u0438\u0445 python-\u043a\u043e\u0434 (\u0438\u043b\u0438 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0443\u044e\u0442 \u0441 C API). \u041a\u0430\u0436\u0434\u044b\u0439 \u0438\u0437 \u044d\u0442\u0438\u0445 \u043f\u043e\u0442\u043e\u043a\u043e\u0432 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441 \u0440\u0430\u043d\u0442\u0430\u0439\u043c\u043e\u043c CPython.<\/p>\n<p>\u0418\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u044b \u0441\u043e\u0437\u0434\u0430\u044e\u0442\u0441\u044f \u0447\u0435\u0440\u0435\u0437 C API \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <code>Py_NewInterpreterFromConfig()<\/code> (\u0438\u043b\u0438 <code>Py_NewInterpreter()<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043b\u0435\u0433\u043a\u043e\u0439 \u043e\u0431\u0435\u0440\u0442\u043a\u043e\u0439 \u0432\u043e\u043a\u0440\u0443\u0433 <code>Py_NewInterpreterFromConfig()<\/code>). \u042d\u0442\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0434\u0435\u043b\u0430\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:<\/p>\n<ol>\n<li>\n<p>\u0421\u043e\u0437\u0434\u0430\u0435\u0442 \u043d\u043e\u0432\u043e\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435;<\/p>\n<\/li>\n<li>\n<p>\u0421\u043e\u0437\u0434\u0430\u0435\u0442 \u043d\u043e\u0432\u043e\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043f\u043e\u0442\u043e\u043a\u0430;<\/p>\n<\/li>\n<li>\n<p>\u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043f\u043e\u0442\u043e\u043a\u0430 \u043a\u0430\u043a \u0442\u0435\u043a\u0443\u0449\u0435\u0435 (\u0442\u0435\u043a\u0443\u0449\u0435\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0434\u043b\u044f \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u0430);<\/p>\n<\/li>\n<li>\n<p>\u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u0442 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u0430, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043f\u043e\u0442\u043e\u043a\u0430;<\/p>\n<\/li>\n<li>\n<p>\u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043f\u043e\u0442\u043e\u043a\u0430 (\u0432\u0441\u0435 \u0435\u0449\u0435 \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0435).<\/p>\n<\/li>\n<\/ol>\n<p>\u041a\u043e\u0433\u0434\u0430 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0446\u0435\u0441\u0441 Python, \u043e\u043d \u0441\u043e\u0437\u0434\u0430\u0435\u0442 \u043e\u0434\u043d\u043e \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u0430 (\u00ab\u0433\u043b\u0430\u0432\u043d\u044b\u0439\u00bb \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440) \u0441 \u043e\u0434\u043d\u0438\u043c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435\u043c \u043f\u043e\u0442\u043e\u043a\u0430 \u0434\u043b\u044f \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u043f\u043e\u0442\u043e\u043a\u0430 \u041e\u0421. \u0417\u0430\u0442\u0435\u043c \u0441\u0440\u0435\u0434\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f Python \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0441 \u0438\u0445 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c.<\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0441\u043a\u0440\u0438\u043f\u0442 \u0438\u043b\u0438 \u043c\u043e\u0434\u0443\u043b\u044c \u0438\u043b\u0438 REPL \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0441 \u0438\u0445 \u043f\u043e\u043c\u043e\u0449\u044c\u044e. \u042d\u0442\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0432 \u043c\u043e\u0434\u0443\u043b\u0435 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u0430 <code>__main__<\/code>.<\/p>\n<p>\u041a\u043e\u0433\u0434\u0430 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0437\u0430\u0432\u0435\u0440\u0448\u0430\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0437\u0430\u043f\u0440\u043e\u0448\u0435\u043d\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430 Python \u0438\u043b\u0438 REPL \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u043f\u043e\u0442\u043e\u043a\u0435 \u041e\u0421, \u0441\u0440\u0435\u0434\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f Python \u0437\u0430\u0432\u0435\u0440\u0448\u0430\u0435\u0442\u0441\u044f \u0432 \u044d\u0442\u043e\u043c \u043f\u043e\u0442\u043e\u043a\u0435 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u0430.<\/p>\n<h3>\u276f C API<\/h3>\n<p>\u0412\u043d\u0443\u0442\u0440\u0438 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u043c\u043d\u043e\u0433\u043e \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 C-\u043c\u043e\u0434\u0443\u043b\u0435\u0439. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0440\u0430\u0437\u0431\u0435\u0440\u0435\u043c \u0438\u0445 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435.<\/p>\n<hr\/>\n<p><a href=\"https:\/\/github.com\/python\/cpython\/blob\/main\/Python\/crossinterp.c\" rel=\"noopener noreferrer nofollow\"><strong>Python\/crossinterp.c<\/strong><\/a><\/p>\n<p>\u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0444\u0430\u0439\u043b\u0435 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f API \u0434\u043b\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f\u043c\u0438 \u043c\u0435\u0436\u0434\u0443 \u0438\u0437\u043e\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u043c\u0438 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u0430\u043c\u0438. \u041e\u0441\u043d\u043e\u0432\u0430, \u0432 \u043e\u0431\u0449\u0435\u043c.<\/p>\n<p>\u041d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043c\u044b \u043e\u043f\u0443\u0441\u0442\u0438\u043c, \u0435\u0441\u043b\u0438 \u043e\u043d\u0438 \u043c\u0430\u043b\u043e\u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 (\u043f\u043e \u0442\u0438\u043f\u0443 <code>_Py_GetMainfile<\/code>), \u0432\u044b \u0438\u0445 \u0441\u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0441\u0430\u043c\u0438.<\/p>\n<p>\u041e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438:<\/p>\n<ul>\n<li>\n<p><code>runpy_run_path<\/code> \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u0437\u0430\u043f\u0443\u0441\u043a <code>runpy<\/code> \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 \u043f\u0443\u0442\u0435\u043c;<\/p>\n<\/li>\n<li>\n<p><code>set_exc_with_cause<\/code> \u0441\u043e\u0437\u0434\u0430\u0435\u0442 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0441 \u043f\u0440\u0438\u0447\u0438\u043d\u043e\u0439.<\/p>\n<\/li>\n<\/ul>\n<ol>\n<li>\n<p><strong>\u0423\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u0430\u043c\u0438:<\/strong><\/p>\n<ul>\n<li>\n<p><code>_PyXI_NewInterpreter()<\/code>: \u0421\u043e\u0437\u0434\u0430\u0435\u0442 \u043d\u043e\u0432\u044b\u0439 \u0438\u0437\u043e\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440<\/p>\n<\/li>\n<li>\n<p><code>_PyXI_EndInterpreter()<\/code>: \u0417\u0430\u0432\u0435\u0440\u0448\u0430\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0443 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u0430<\/p>\n<\/li>\n<li>\n<p><code>_Py_CallInInterpreter()<\/code>: \u0412\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0432 \u0434\u0440\u0443\u0433\u043e\u043c \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u0435<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u041c\u0435\u0436\u044f\u0437\u044b\u043a\u043e\u0432\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435:<\/strong><\/p>\n<ul>\n<li>\n<p><code>_PyXIData_t<\/code>: \u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u043c\u0435\u0436\u0434\u0443 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u0430\u043c\u0438<\/p>\n<\/li>\n<li>\n<p><code>_PyObject_GetXIData()<\/code>: \u041f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u0443\u0435\u0442 \u043e\u0431\u044a\u0435\u043a\u0442 \u0432 \u043c\u0435\u0436\u044a\u044f\u0437\u044b\u043a\u043e\u0432\u043e\u0439 \u0444\u043e\u0440\u043c\u0430\u0442<\/p>\n<\/li>\n<li>\n<p><code>_PyXIData_NewObject()<\/code>: \u0412\u043e\u0441\u0441\u043e\u0437\u0434\u0430\u0435\u0442 \u043e\u0431\u044a\u0435\u043a\u0442 \u0438\u0437 \u043c\u0435\u0436\u044a\u044f\u0437\u044b\u043a\u043e\u0432\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u0421\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f:<\/strong><\/p>\n<ul>\n<li>\n<p><code>_PyPickle_GetXIData()<\/code>: \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 pickle \u0434\u043b\u044f \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432<\/p>\n<\/li>\n<li>\n<p><code>_PyMarshal_GetXIData()<\/code>: \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 marshal \u0434\u043b\u044f \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043a\u043e\u0434\u0430<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u0423\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0441\u0435\u0441\u0441\u0438\u044f\u043c\u0438:<\/strong><\/p>\n<ul>\n<li>\n<p><code>_PyXI_session<\/code>: \u0421\u0435\u0441\u0441\u0438\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0432 \u0434\u0440\u0443\u0433\u043e\u043c \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u0435<\/p>\n<\/li>\n<li>\n<p><code>_PyXI_Enter()<\/code>: \u041d\u0430\u0447\u0430\u043b\u043e \u0441\u0435\u0441\u0441\u0438\u0438 \u0432 \u0434\u0440\u0443\u0433\u043e\u043c \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u0435<\/p>\n<\/li>\n<li>\n<p><code>_PyXI_Exit()<\/code>: \u0417\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u0435 \u0441\u0435\u0441\u0441\u0438\u0438<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u041e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u043e\u0448\u0438\u0431\u043e\u043a:<\/strong><\/p>\n<ul>\n<li>\n<p><code>_PyXI_excinfo<\/code>: \u0421\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043e\u0431 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f\u0445 \u043c\u0435\u0436\u0434\u0443 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u0430\u043c\u0438<\/p>\n<\/li>\n<li>\n<p><code>_PyXI_failure<\/code>: \u0423\u043d\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0430\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0441\u0431\u043e\u0435\u0432<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<p>\u0421\u0440\u0435\u0434\u0438 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0435\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u0434\u0435\u043b\u0438\u0442\u044c \u0438\u0437\u043e\u043b\u044f\u0446\u0438\u044e \u0433\u043b\u0430\u0432\u043d\u043e\u0433\u043e (<code>__main__<\/code>) \u043c\u043e\u0434\u0443\u043b\u044f \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u0430.<\/p>\n<p>\u0412\u0441\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u044e\u0442\u0441\u044f \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e, \u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f \u043f\u0440\u043e\u0441\u0442\u044b\u043c\u0438 \u043c\u043e\u0436\u043d\u043e \u0431\u0435\u0437 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c pickle. \u0414\u043b\u044f \u0441\u043b\u043e\u0436\u043d\u044b\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0436\u0435 \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f.<\/p>\n<p>\u041f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0432\u044b\u0437\u043e\u0432\u043e\u0432 \u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u043f\u0430\u043c\u044f\u0442\u0438 \u0447\u0435\u0440\u0435\u0437 \u0444\u043b\u0430\u0433  <code>_Py_PENDING_RAWFREE<\/code>.<\/p>\n<p>\u041a\u0440\u043e\u043c\u0435 \u044d\u0442\u043e\u0433\u043e, \u043d\u0435 \u0441\u0442\u043e\u0438\u0442 \u0437\u0430\u0431\u044b\u0432\u0430\u0442\u044c \u043f\u0440\u043e \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0439. \u041f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0439 \u0447\u0435\u0440\u0435\u0437 <code>_PyXI_excinfo<\/code>, \u0442\u0440\u0430\u0441\u0441\u0438\u0440\u043e\u0432\u043a\u0430 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u0443\u0435\u0442\u0441\u044f \u0432 TracebackException, \u0420\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u044b \u043c\u0435\u0442\u043e\u0434\u044b \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u043e\u0448\u0438\u0431\u043e\u043a \u043c\u0435\u0436\u0434\u0443 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u0430\u043c\u0438.<\/p>\n<hr\/>\n<p><a href=\"https:\/\/github.com\/python\/cpython\/blob\/main\/Modules\/_interpretersmodule.c\" rel=\"noopener noreferrer nofollow\"><strong>Modules\/_interpretersmodule.c<\/strong><\/a><\/p>\n<p>\u0414\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u0434\u0443\u043b\u044c \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u0437\u0430 \u043d\u0438\u0437\u043a\u043e\u0443\u0440\u043e\u0432\u043d\u0435\u0432\u044b\u0439 \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u0430\u043c \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u043e\u0432. \u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0441\u0430\u043c\u0438\u0445 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u043e\u0432.<\/p>\n<p>\u041c\u043e\u0434\u0443\u043b\u044c \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u043d\u0438\u0437\u043a\u043e\u0443\u0440\u043e\u0432\u043d\u0435\u0432\u044b\u0439 API \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u0430\u043c\u0438 Python, \u0432\u043a\u043b\u044e\u0447\u0430\u044f:<\/p>\n<ul>\n<li>\n<p>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0438 \u0443\u043d\u0438\u0447\u0442\u043e\u0436\u0435\u043d\u0438\u0435 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u043e\u0432<\/p>\n<\/li>\n<li>\n<p>\u0423\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0438\u0437\u043e\u043b\u044f\u0446\u0438\u0435\u0439 \u043c\u0435\u0436\u0434\u0443 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u0430\u043c\u0438<\/p>\n<\/li>\n<li>\n<p>\u0412\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043a\u043e\u0434\u0430 \u0432 \u0440\u0430\u0437\u043d\u044b\u0445 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u0430\u0445<\/p>\n<\/li>\n<li>\n<p>\u041c\u0435\u0436\u044a\u044f\u0434\u0435\u0440\u043d\u0443\u044e \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0443 \u0434\u0430\u043d\u043d\u044b\u0445<\/p>\n<\/li>\n<li>\n<p>\u0423\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0435\u0439 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u043e\u0432<\/p>\n<\/li>\n<\/ul>\n<p>\u0412 \u043a\u043e\u0434\u0435 \u043c\u043e\u0436\u043d\u043e \u0443\u0432\u0438\u0434\u0435\u0442\u044c C-\u0444\u0443\u043d\u043a\u0446\u0438\u044e <code>interp_create<\/code>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0435\u0439 <code>create()<\/code>. \u041e\u043d \u0441\u043e\u0437\u0434\u0430\u0435\u0442 \u043d\u043e\u0432\u044b\u0439 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440 \u0441 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0439 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0435\u0439 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u0430. \u041f\u043e\u0441\u043b\u0435 \u043c\u043e\u0436\u043d\u043e \u0443\u0432\u0438\u0434\u0435\u0442\u044c <code>interp_destroy<\/code> \u0434\u043b\u044f \u0443\u043d\u0438\u0447\u0442\u043e\u0436\u0435\u043d\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u0430 (\u0432 python \u044d\u0442\u043e <code>destroy()<\/code>). \u0422\u0430\u043a\u0436\u0435 \u0435\u0441\u0442\u044c <code>list_all<\/code> \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0441\u043f\u0438\u0441\u043a\u0430 \u0432\u0441\u0435\u0445 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u043e\u0432 \u0432 \u0442\u0435\u043a\u0443\u0449\u0435\u043c \u043c\u043e\u0434\u0443\u043b\u0435, \u0430 \u0442\u0430\u043a\u0436\u0435 <code>get_current<\/code> \u0438 <code>get_main<\/code> \u043c\u0435\u0442\u043e\u0434\u044b \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u0438 \u0433\u043b\u0430\u0432\u043d\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u0430.<\/p>\n<p>\u0422\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u0434\u0435\u043b\u0438\u0442\u044c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u0441\u043f\u0438\u0441\u043e\u043a \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0434\u043b\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043a\u043e\u0434\u0430: <code>exec()<\/code> \u0434\u043b\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430, <code>run_string<\/code> \u0434\u043b\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0441\u0442\u0440\u043e\u043a\u0438 \u043a\u043e\u0434\u0430, <code>run_func()<\/code> \u0434\u043b\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0442\u0435\u043b\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u0438 <code>call()<\/code> \u0434\u043b\u044f \u0432\u044b\u0437\u043e\u0432\u0430 callable-\u043e\u0431\u044a\u0435\u043a\u0442\u0430 (\u0432\u043a\u043b\u044e\u0447\u0430\u044f callable-\u043a\u043b\u0430\u0441\u0441\u044b) \u0441 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430\u043c\u0438).<\/p>\n<p>\u0414\u043b\u044f \u043c\u0435\u0436\u044a\u044f\u0434\u0435\u0440\u043d\u043e\u0433\u043e \u0438 \u043c\u043d\u043e\u0433\u043e\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u043d\u043e\u0433\u043e \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0438\u0434\u0435\u0442 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0433\u043e \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0431\u0443\u0444\u0435\u0440\u043e\u0432 \u043c\u0435\u0436\u0434\u0443 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u0430\u043c\u0438:<\/p>\n<pre><code>typedef struct {     PyObject base;     Py_buffer *view;     int64_t interpid; } xibufferview; <\/code><\/pre>\n<p>\u0414\u043b\u044f \u0441\u0435\u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0438 \u0434\u0435\u0441\u0435\u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0441\u043b\u043e\u0436\u043d\u044b\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0435\u0441\u0442\u044c \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c <code>_PyXIData<\/code>. \u041e\u043d \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430 \u043a \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u043c \u0433\u0434\u0435 \u0438\u0434\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430 \u0441\u043e \u0441\u043b\u043e\u0436\u043d\u044b\u043c\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u0430\u043c\u0438. \u0410 \u0442\u0430\u043a\u0436\u0435 \u0435\u0441\u0442\u044c \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 \u0440\u0430\u0437\u0434\u0435\u043b\u044f\u0435\u043c\u044b\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0434\u0430\u043d\u043d\u044b\u0445 \u0447\u0435\u0440\u0435\u0437 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b <code>shared<\/code>.<\/p>\n<p>\u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u0435\u0441\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f\u043c\u0438 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u043e\u0432. \u0421\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u043f\u043e\u0442\u043e\u043a\u043e\u0432 \u0441\u0432\u044f\u0437\u0430\u043d\u044b \u0441 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f\u043c\u0438 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0430\u043a \u0436\u0435, \u043a\u0430\u043a \u0441\u0432\u044f\u0437\u0430\u043d\u044b \u043f\u043e\u0442\u043e\u043a\u0438 \u0438 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u044b \u041e\u0421 (\u043d\u0430 \u0432\u044b\u0441\u043e\u043a\u043e\u043c \u0443\u0440\u043e\u0432\u043d\u0435). \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430, \u0441\u0432\u044f\u0437\u044c \u2014 \u043e\u0434\u0438\u043d \u043a\u043e \u043c\u043d\u043e\u0433\u0438\u043c. \u0421\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043f\u043e\u0442\u043e\u043a\u0430 \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u0438\u0442 \u043e\u0434\u043d\u043e\u043c\u0443 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u0443 (\u0438 \u0445\u0440\u0430\u043d\u0438\u0442 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043d\u0430 \u043d\u0435\u0433\u043e). \u042d\u0442\u043e \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043f\u043e\u0442\u043e\u043a\u0430 \u043d\u0438\u043a\u043e\u0433\u0434\u0430 \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0434\u0440\u0443\u0433\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u0430. \u041e\u0434\u043d\u0430\u043a\u043e \u0432 \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u043c \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0438 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440 \u043c\u043e\u0436\u0435\u0442 \u0438\u043c\u0435\u0442\u044c \u043d\u043e\u043b\u044c \u0438\u043b\u0438 \u0431\u043e\u043b\u0435\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0439 \u043f\u043e\u0442\u043e\u043a\u043e\u0432, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0445 \u0441 \u043d\u0438\u043c. \u0418\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440 \u0441\u0447\u0438\u0442\u0430\u0435\u0442\u0441\u044f \u0430\u043a\u0442\u0438\u0432\u043d\u044b\u043c \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u043f\u043e\u0442\u043e\u043a\u0430\u0445 \u041e\u0421, \u0433\u0434\u0435 \u043e\u0434\u043d\u043e \u0438\u0437 \u0435\u0433\u043e \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0439 \u043f\u043e\u0442\u043e\u043a\u043e\u0432 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0442\u0435\u043a\u0443\u0449\u0438\u043c.<\/p>\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u044f <code>set___main___attrs<\/code> \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u044b \u0432 <code>__main__<\/code> \u043c\u043e\u0434\u0443\u043b\u044c, \u0430 <code>capture_exception<\/code> \u043d\u0443\u0436\u043d\u0430 \u0434\u043b\u044f \u0437\u0430\u0445\u0432\u0430\u0442\u0430 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0439, \u0447\u0442\u043e\u0431\u044b \u0432 \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u0438\u0445 \u043c\u0435\u0436\u0434\u0443 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u0430\u043c\u0438. \u0418 \u0442\u0430\u043a\u0436\u0435 \u0435\u0441\u0442\u044c \u043c\u0435\u0442\u043e\u0434 <code>is_shareable<\/code> \u0434\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0440\u0430\u0437\u0434\u0435\u043b\u044f\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442\u044b.<\/p>\n<p>\u0421\u0440\u0435\u0434\u0438 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0435\u0439 \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430 \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u0434\u0435\u043b\u0438\u0442\u044c \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u0443\u044e \u0440\u0430\u0431\u043e\u0442\u0443 \u0441 \u0444\u0430\u0439\u043b\u0430\u043c\u0438. \u0410 \u0442\u0430\u043a\u0436\u0435 \u043e\u0447\u0438\u0441\u0442\u043a\u0430 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0439 (<code>module_clear<\/code>, <code>traverse_module_state<\/code>), \u0434\u0435\u0430\u043b\u043b\u043e\u043a\u0430\u0442\u043e\u0440\u044b (<code>xibufferview_dealloc<\/code>), \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 <code>Py_buffer<\/code> \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0440\u0430\u0437\u0434\u0435\u043b\u044f\u0435\u043c\u044b\u043c\u0438 \u0431\u0443\u0444\u0435\u0440\u0430\u043c\u0438.<\/p>\n<p>\u041e\u0431\u044a\u0435\u043a\u0442\u044b \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u043e\u0432 \u0441\u0442\u0440\u043e\u0433\u043e \u0438\u0437\u043e\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u044b, \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0441\u0435\u0441\u0441\u0438\u0439 \u0447\u0435\u0440\u0435\u0437 <code>_PyXI_Enter<\/code> \u0438 <code>_PyXI_Exit<\/code>. \u041e\u0448\u0438\u0431\u043a\u0438 \u0438\u0437\u043e\u043b\u044f\u0446\u0438\u0438 \u0442\u0430\u043a\u0436\u0435 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0447\u0435\u0440\u0435\u0437 <code>unwrap_not_shareable<\/code>.<\/p>\n<p>\u041a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u043e\u0432 \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c\u0430 \u0441 <code>PyInterpreterConfig<\/code>, \u0430 \u0441\u0430\u043c \u043a\u043e\u043d\u0444\u0438\u0433 \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0447\u0435\u0440\u0435\u0437 \u043c\u0435\u0442\u043e\u0434 <code>new_config<\/code>.<\/p>\n<p>\u0422\u0430\u043a\u0436\u0435 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u044b \u0438\u043c\u0435\u044e\u0442 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c\u044b\u0439 \u0436\u0438\u0437\u043d\u0435\u043d\u043d\u044b\u0439 \u0446\u0438\u043a\u043b, \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c\u044b\u0439 \u0447\u0435\u0440\u0435\u0437 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443 \u0433\u043e\u0442\u043e\u0432\u043d\u043e\u0441\u0442\u0438, \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0438 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u0430, \u0441\u0447\u0435\u0442\u0447\u0438\u043a\u0438 \u0441\u0441\u044b\u043b\u043e\u043a.<\/p>\n<p>\u041c\u043e\u0434\u0443\u043b\u044c \u043f\u043e\u043c\u0435\u0447\u0435\u043d \u043a\u0430\u043a <code>Py_MOD_PER_INTERPRETER_GIL_SUPPORTED<\/code>, \u0447\u0442\u043e \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442 \u0447\u0442\u043e \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 GIL \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u0430 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f. \u0421\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0442 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0435 \u0442\u0438\u043f\u044b \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0439 (<code>InterpreterError<\/code>, <code>NotShareableError<\/code>). \u0421\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c\u044b \u0441 <code>marshal<\/code> \u0434\u043b\u044f \u0441\u0435\u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0441\u043b\u043e\u0436\u043d\u044b\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432.<\/p>\n<hr\/>\n<p><a href=\"https:\/\/github.com\/python\/cpython\/blob\/main\/Modules\/_interpqueuesmodule.c\" rel=\"noopener noreferrer nofollow\"><strong>Modules\/_interpqueuesmodule.c<\/strong><\/a><\/p>\n<p>\u0414\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u0434\u0443\u043b\u044c \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u0437\u0430 \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u043e\u0431\u043c\u0435\u043d\u0430 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f\u043c\u0438 \u043c\u0435\u0436\u0434\u0443 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u0430\u043c\u0438. \u041e\u0447\u0435\u0440\u0435\u0434\u0438<\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-467436","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/467436","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=467436"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/467436\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=467436"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=467436"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=467436"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}