Skip to content

Commit 20a5738

Browse files
committed
#1037 - remove fuzzy flags
1 parent 53d8acf commit 20a5738

File tree

1 file changed

+177
-11
lines changed

1 file changed

+177
-11
lines changed

extending/embedding.po

+177-11
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,40 @@ msgid ""
141141
" Py_ExitStatusException(status);\n"
142142
"}"
143143
msgstr ""
144+
"#define PY_SSIZE_T_CLEAN\n"
145+
"#include <Python.h>\n"
146+
"\n"
147+
"int\n"
148+
"main(int argc, char *argv[])\n"
149+
"{\n"
150+
" PyStatus status;\n"
151+
" PyConfig config;\n"
152+
" PyConfig_InitPythonConfig(&config);\n"
153+
"\n"
154+
" /* 선택적이지만 권장됩니다 */\n"
155+
" status = PyConfig_SetBytesString(&config, &config.program_name, "
156+
"argv[0]);\n"
157+
" if (PyStatus_Exception(status)) {\n"
158+
" goto exception;\n"
159+
" }\n"
160+
"\n"
161+
" status = Py_InitializeFromConfig(&config);\n"
162+
" if (PyStatus_Exception(status)) {\n"
163+
" goto exception;\n"
164+
" }\n"
165+
" PyConfig_Clear(&config);\n"
166+
"\n"
167+
" PyRun_SimpleString(\"from time import time,ctime\\n\"\n"
168+
" \"print('Today is', ctime(time()))\\n\");\n"
169+
" if (Py_FinalizeEx() < 0) {\n"
170+
" exit(120);\n"
171+
" }\n"
172+
" return 0;\n"
173+
"\n"
174+
" exception:\n"
175+
" PyConfig_Clear(&config);\n"
176+
" Py_ExitStatusException(status);\n"
177+
"}"
144178

145179
#: ../../extending/embedding.rst:92
146180
msgid ""
@@ -151,7 +185,6 @@ msgid ""
151185
msgstr ""
152186

153187
#: ../../extending/embedding.rst:97
154-
#, fuzzy
155188
msgid ""
156189
"Setting :c:member:`PyConfig.program_name` should be called before "
157190
":c:func:`Py_InitializeFromConfig` to inform the interpreter about paths "
@@ -165,8 +198,8 @@ msgid ""
165198
"using the :c:func:`PyRun_SimpleFile` function, which saves you the "
166199
"trouble of allocating memory space and loading the file contents."
167200
msgstr ""
168-
":c:func:`Py_SetProgramName` 함수는 파이썬 런타임 라이브러리에 대한 경로를 인터프리터에게 알리기 위해 "
169-
":c:func:`Py_Initialize`\\보다 먼저 호출되어야 합니다. 다음으로, 파이썬 인터프리터는 "
201+
":c:member:`PyConfig.program_name` 설정은 파이썬 런타임 라이브러리에 대한 경로를 인터프리터에게 알리기 "
202+
"위해 :c:func:`Py_InitializeFromConfig`\\보다 먼저 호출되어야 합니다. 다음으로, 파이썬 인터프리터는 "
170203
":c:func:`Py_Initialize`\\로 초기화되고, 날짜와 시간을 인쇄하는 하드 코딩된 파이썬 스크립트가 실행됩니다. 그런"
171204
" 다음, :c:func:`Py_FinalizeEx` 호출이 인터프리터를 종료하고 프로그램이 끝납니다. 실제 프로그램에서는 파이썬 "
172205
"스크립트를 다른 소스(아마도 텍스트 편집기 루틴, 파일 또는 데이터베이스)에서 가져올 수 있습니다. 파일에서 파이썬 코드를 얻는 "
@@ -347,6 +380,79 @@ msgid ""
347380
" return 0;\n"
348381
"}\n"
349382
msgstr ""
383+
"#define PY_SSIZE_T_CLEAN\n"
384+
"#include <Python.h>\n"
385+
"\n"
386+
"int\n"
387+
"main(int argc, char *argv[])\n"
388+
"{\n"
389+
" PyObject *pName, *pModule, *pFunc;\n"
390+
" PyObject *pArgs, *pValue;\n"
391+
" int i;\n"
392+
"\n"
393+
" if (argc < 3) {\n"
394+
" fprintf(stderr,\"Usage: call pythonfile funcname [args]\\n\");\n"
395+
" return 1;\n"
396+
" }\n"
397+
"\n"
398+
" Py_Initialize();\n"
399+
" pName = PyUnicode_DecodeFSDefault(argv[1]);\n"
400+
" /* pName의 에러 검사가 생략되었습니다 */\n"
401+
"\n"
402+
" pModule = PyImport_Import(pName);\n"
403+
" Py_DECREF(pName);\n"
404+
"\n"
405+
" if (pModule != NULL) {\n"
406+
" pFunc = PyObject_GetAttrString(pModule, argv[2]);\n"
407+
" /* pFunc는 새로운 참조입니다 */\n"
408+
"\n"
409+
" if (pFunc && PyCallable_Check(pFunc)) {\n"
410+
" pArgs = PyTuple_New(argc - 3);\n"
411+
" for (i = 0; i < argc - 3; ++i) {\n"
412+
" pValue = PyLong_FromLong(atoi(argv[i + 3]));\n"
413+
" if (!pValue) {\n"
414+
" Py_DECREF(pArgs);\n"
415+
" Py_DECREF(pModule);\n"
416+
" fprintf(stderr, \"Cannot convert argument\\n\");\n"
417+
" return 1;\n"
418+
" }\n"
419+
" /* 여기에서 pValue 참조를 훔칩니다: */\n"
420+
" PyTuple_SetItem(pArgs, i, pValue);\n"
421+
" }\n"
422+
" pValue = PyObject_CallObject(pFunc, pArgs);\n"
423+
" Py_DECREF(pArgs);\n"
424+
" if (pValue != NULL) {\n"
425+
" printf(\"Result of call: %ld\\n\", "
426+
"PyLong_AsLong(pValue));\n"
427+
" Py_DECREF(pValue);\n"
428+
" }\n"
429+
" else {\n"
430+
" Py_DECREF(pFunc);\n"
431+
" Py_DECREF(pModule);\n"
432+
" PyErr_Print();\n"
433+
" fprintf(stderr,\"Call failed\\n\");\n"
434+
" return 1;\n"
435+
" }\n"
436+
" }\n"
437+
" else {\n"
438+
" if (PyErr_Occurred())\n"
439+
" PyErr_Print();\n"
440+
" fprintf(stderr, \"Cannot find function \\\"%s\\\"\\n\", "
441+
"argv[2]);\n"
442+
" }\n"
443+
" Py_XDECREF(pFunc);\n"
444+
" Py_DECREF(pModule);\n"
445+
" }\n"
446+
" else {\n"
447+
" PyErr_Print();\n"
448+
" fprintf(stderr, \"Failed to load \\\"%s\\\"\\n\", argv[1]);\n"
449+
" return 1;\n"
450+
" }\n"
451+
" if (Py_FinalizeEx() < 0) {\n"
452+
" return 120;\n"
453+
" }\n"
454+
" return 0;\n"
455+
"}\n"
350456

351457
#: ../../extending/embedding.rst:165
352458
msgid ""
@@ -369,6 +475,12 @@ msgid ""
369475
" c = c + b\n"
370476
" return c"
371477
msgstr ""
478+
"def multiply(a,b):\n"
479+
" print(\"Will compute\", a, \"times\", b)\n"
480+
" c = 0\n"
481+
" for i in range(0, a):\n"
482+
" c = c + b\n"
483+
" return c"
372484

373485
#: ../../extending/embedding.rst:180
374486
msgid "then the result should be:"
@@ -380,6 +492,9 @@ msgid ""
380492
"Will compute 3 times 2\n"
381493
"Result of call: 6"
382494
msgstr ""
495+
"$ call multiply multiply 3 2\n"
496+
"Will compute 3 times 2\n"
497+
"Result of call: 6"
383498

384499
#: ../../extending/embedding.rst:188
385500
msgid ""
@@ -398,17 +513,21 @@ msgid ""
398513
"/* Error checking of pName left out */\n"
399514
"pModule = PyImport_Import(pName);"
400515
msgstr ""
516+
"Py_Initialize();\n"
517+
"pName = PyUnicode_DecodeFSDefault(argv[1]);\n"
518+
"/* Error checking of pName left out */\n"
519+
"pModule = PyImport_Import(pName);"
401520

402521
#: ../../extending/embedding.rst:197
403-
#, fuzzy
404522
msgid ""
405523
"After initializing the interpreter, the script is loaded using "
406524
":c:func:`PyImport_Import`. This routine needs a Python string as its "
407525
"argument, which is constructed using the "
408526
":c:func:`PyUnicode_DecodeFSDefault` data conversion routine. ::"
409527
msgstr ""
410528
"인터프리터를 초기화한 후, 스크립트는 :c:func:`PyImport_Import`\\를 사용하여 로드됩니다. 이 루틴은 인자로 "
411-
"파이썬 문자열을 요구하는데, :c:func:`PyUnicode_FromString` 데이터 변환 루틴을 사용하여 구성됩니다. ::"
529+
"파이썬 문자열을 요구하는데, :c:func:`PyUnicode_DecodeFSDefault` 데이터 변환 루틴을 사용하여 "
530+
"구성됩니다. ::"
412531

413532
#: ../../extending/embedding.rst:202
414533
#, python-brace-format
@@ -421,6 +540,13 @@ msgid ""
421540
"}\n"
422541
"Py_XDECREF(pFunc);"
423542
msgstr ""
543+
"pFunc = PyObject_GetAttrString(pModule, argv[2]);\n"
544+
"/* pFunc는 새로운 참조입니다 */\n"
545+
"\n"
546+
"if (pFunc && PyCallable_Check(pFunc)) {\n"
547+
" ...\n"
548+
"}\n"
549+
"Py_XDECREF(pFunc);"
424550

425551
#: ../../extending/embedding.rst:210
426552
msgid ""
@@ -436,7 +562,7 @@ msgstr ""
436562

437563
#: ../../extending/embedding.rst:216
438564
msgid "pValue = PyObject_CallObject(pFunc, pArgs);"
439-
msgstr ""
565+
msgstr "pValue = PyObject_CallObject(pFunc, pArgs);"
440566

441567
#: ../../extending/embedding.rst:218
442568
msgid ""
@@ -499,6 +625,33 @@ msgid ""
499625
" return PyModule_Create(&EmbModule);\n"
500626
"}"
501627
msgstr ""
628+
"static int numargs=0;\n"
629+
"\n"
630+
"/* 응용 프로그램 명령 줄의 인자 수를 반환합니다 */\n"
631+
"static PyObject*\n"
632+
"emb_numargs(PyObject *self, PyObject *args)\n"
633+
"{\n"
634+
" if(!PyArg_ParseTuple(args, \":numargs\"))\n"
635+
" return NULL;\n"
636+
" return PyLong_FromLong(numargs);\n"
637+
"}\n"
638+
"\n"
639+
"static PyMethodDef EmbMethods[] = {\n"
640+
" {\"numargs\", emb_numargs, METH_VARARGS,\n"
641+
" \"Return the number of arguments received by the process.\"},\n"
642+
" {NULL, NULL, 0, NULL}\n"
643+
"};\n"
644+
"\n"
645+
"static PyModuleDef EmbModule = {\n"
646+
" PyModuleDef_HEAD_INIT, \"emb\", NULL, -1, EmbMethods,\n"
647+
" NULL, NULL, NULL, NULL\n"
648+
"};\n"
649+
"\n"
650+
"static PyObject*\n"
651+
"PyInit_emb(void)\n"
652+
"{\n"
653+
" return PyModule_Create(&EmbModule);\n"
654+
"}"
502655

503656
#: ../../extending/embedding.rst:265
504657
msgid ""
@@ -514,22 +667,25 @@ msgid ""
514667
"numargs = argc;\n"
515668
"PyImport_AppendInittab(\"emb\", &PyInit_emb);"
516669
msgstr ""
670+
"numargs = argc;\n"
671+
"PyImport_AppendInittab(\"emb\", &PyInit_emb);"
517672

518673
#: ../../extending/embedding.rst:271
519-
#, fuzzy
520674
msgid ""
521675
"These two lines initialize the ``numargs`` variable, and make the "
522676
":func:`!emb.numargs` function accessible to the embedded Python "
523677
"interpreter. With these extensions, the Python script can do things like"
524678
msgstr ""
525-
"이 두 줄은 ``numargs`` 변수를 초기화하고, :func:`emb.numargs` 함수를 내장된 파이썬 인터프리터가 액세스할"
526-
" 수 있도록 만듭니다. 이러한 확장을 통해, 파이썬 스크립트는 다음과 같은 작업을 수행할 수 있습니다"
679+
"이 두 줄은 ``numargs`` 변수를 초기화하고, :func:`!emb.numargs` 함수를 내장된 파이썬 인터프리터가 "
680+
"액세스할 수 있도록 만듭니다. 이러한 확장을 통해, 파이썬 스크립트는 다음과 같은 작업을 수행할 수 있습니다"
527681

528682
#: ../../extending/embedding.rst:275
529683
msgid ""
530684
"import emb\n"
531685
"print(\"Number of arguments\", emb.numargs())"
532686
msgstr ""
687+
"import emb\n"
688+
"print(\"Number of arguments\", emb.numargs())"
533689

534690
#: ../../extending/embedding.rst:280
535691
msgid ""
@@ -593,20 +749,25 @@ msgid ""
593749
"-I/opt/include/python3.11 -I/opt/include/python3.11 -Wsign-compare "
594750
"-DNDEBUG -g -fwrapv -O3 -Wall"
595751
msgstr ""
752+
"$ /opt/bin/python3.11-config --cflags\n"
753+
"-I/opt/include/python3.11 -I/opt/include/python3.11 -Wsign-compare "
754+
"-DNDEBUG -g -fwrapv -O3 -Wall"
596755

597756
#: ../../extending/embedding.rst:323
598-
#, fuzzy
599757
msgid ""
600758
"``pythonX.Y-config --ldflags --embed`` will give you the recommended "
601759
"flags when linking:"
602-
msgstr "``pythonX.Y-config --ldflags``\\는 링크 할 때의 권장 플래그를 제공합니다:"
760+
msgstr "``pythonX.Y-config --ldflags --embed``\\는 링크 할 때의 권장 플래그를 제공합니다:"
603761

604762
#: ../../extending/embedding.rst:326
605763
msgid ""
606764
"$ /opt/bin/python3.11-config --ldflags --embed\n"
607765
"-L/opt/lib/python3.11/config-3.11-x86_64-linux-gnu -L/opt/lib "
608766
"-lpython3.11 -lpthread -ldl -lutil -lm"
609767
msgstr ""
768+
"$ /opt/bin/python3.11-config --ldflags --embed\n"
769+
"-L/opt/lib/python3.11/config-3.11-x86_64-linux-gnu -L/opt/lib "
770+
"-lpython3.11 -lpthread -ldl -lutil -lm"
610771

611772
#: ../../extending/embedding.rst:332
612773
#, python-brace-format
@@ -644,4 +805,9 @@ msgid ""
644805
">>> sysconfig.get_config_var('LINKFORSHARED')\n"
645806
"'-Xlinker -export-dynamic'"
646807
msgstr ""
808+
">>> import sysconfig\n"
809+
">>> sysconfig.get_config_var('LIBS')\n"
810+
"'-lpthread -ldl -lutil'\n"
811+
">>> sysconfig.get_config_var('LINKFORSHARED')\n"
812+
"'-Xlinker -export-dynamic'"
647813

0 commit comments

Comments
 (0)