Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 20f24f9

Browse files
committed
Traducido archivo extending/embedding
1 parent 7636ce0 commit 20f24f9

File tree

1 file changed

+190
-19
lines changed

1 file changed

+190
-19
lines changed

extending/embedding.po

Lines changed: 190 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,16 @@ msgstr ""
1111
"Project-Id-Version: Python 3.8\n"
1212
"Report-Msgid-Bugs-To: \n"
1313
"POT-Creation-Date: 2024-11-21 16:38-0300\n"
14-
"PO-Revision-Date: 2020-06-24 23:14+0200\n"
14+
"PO-Revision-Date: 2024-11-30 20:35-0600\n"
1515
"Last-Translator: Cristián Maureira-Fredes <[email protected]>\n"
16-
"Language: es\n"
1716
"Language-Team: python-doc-es\n"
18-
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
17+
"Language: es\n"
1918
"MIME-Version: 1.0\n"
2019
"Content-Type: text/plain; charset=utf-8\n"
2120
"Content-Transfer-Encoding: 8bit\n"
21+
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
2222
"Generated-By: Babel 2.16.0\n"
23+
"X-Generator: Poedit 3.5\n"
2324

2425
#: ../Doc/extending/embedding.rst:8
2526
msgid "Embedding Python in Another Application"
@@ -160,6 +161,40 @@ msgid ""
160161
" Py_ExitStatusException(status);\n"
161162
"}"
162163
msgstr ""
164+
"#define PY_SSIZE_T_CLEAN\n"
165+
"#include <Python.h>\n"
166+
"\n"
167+
"int\n"
168+
"main(int argc, char *argv[])\n"
169+
"{\n"
170+
" PyStatus status;\n"
171+
" PyConfig config;\n"
172+
" PyConfig_InitPythonConfig(&config);\n"
173+
"\n"
174+
" /* optional but recommended */\n"
175+
" status = PyConfig_SetBytesString(&config, &config.program_name, "
176+
"argv[0]);\n"
177+
" if (PyStatus_Exception(status)) {\n"
178+
" goto exception;\n"
179+
" }\n"
180+
"\n"
181+
" status = Py_InitializeFromConfig(&config);\n"
182+
" if (PyStatus_Exception(status)) {\n"
183+
" goto exception;\n"
184+
" }\n"
185+
" PyConfig_Clear(&config);\n"
186+
"\n"
187+
" PyRun_SimpleString(\"from time import time,ctime\\n\"\n"
188+
" \"print('Today is', ctime(time()))\\n\");\n"
189+
" if (Py_FinalizeEx() < 0) {\n"
190+
" exit(120);\n"
191+
" }\n"
192+
" return 0;\n"
193+
"\n"
194+
" exception:\n"
195+
" PyConfig_Clear(&config);\n"
196+
" Py_ExitStatusException(status);\n"
197+
"}"
163198

164199
#: ../Doc/extending/embedding.rst:92
165200
msgid ""
@@ -168,9 +203,12 @@ msgid ""
168203
"3.13, but we keep it here for backward compatibility. See :ref:`arg-parsing-"
169204
"string-and-buffers` for a description of this macro."
170205
msgstr ""
206+
"``#define PY_SSIZE_T_CLEAN`` se usa para indicar que ``Py_ssize_t`` debería "
207+
"usarse en algunas APIs en lugar de ``int``. No es necesario desde Python "
208+
"3.13, pero lo mantenemos aquí por compatibilidad. Ver :ref:`arg-parsing-"
209+
"string-and-buffers` para una descripción de esta macro."
171210

172211
#: ../Doc/extending/embedding.rst:97
173-
#, fuzzy
174212
msgid ""
175213
"Setting :c:member:`PyConfig.program_name` should be called before :c:func:"
176214
"`Py_InitializeFromConfig` to inform the interpreter about paths to Python "
@@ -184,16 +222,16 @@ msgid ""
184222
"`PyRun_SimpleFile` function, which saves you the trouble of allocating "
185223
"memory space and loading the file contents."
186224
msgstr ""
187-
"La función :c:func:`Py_SetProgramName` debe llamarse antes de :c:func:"
188-
"`Py_Initialize` para informar al intérprete sobre las rutas a las "
189-
"bibliotecas de tiempo de ejecución de Python. A continuación, el intérprete "
190-
"de Python se inicializa con :c:func:`Py_Initialize`, seguido de la ejecución "
191-
"de un script Python codificado que imprime la fecha y la hora. Luego, la "
192-
"llamada :c:func:`Py_FinalizeEx` cierra el intérprete, seguido por el final "
193-
"del programa. En un programa real, es posible que desee obtener el script de "
194-
"Python de otra fuente, tal vez una rutina de editor de texto, un archivo o "
195-
"una base de datos. Obtener el código Python de un archivo se puede hacer "
196-
"mejor usando la función :c:func:`PyRun_SimpleFile`, que le ahorra la "
225+
"La configuración :c:member:`PyConfig.program_name` debe llamarse antes de :c:"
226+
"func:`Py_InitializeFromConfig` para informar al intérprete sobre las rutas a "
227+
"las bibliotecas de tiempo de ejecución de Python. A continuación, el "
228+
"intérprete de Python se inicializa con :c:func:`Py_Initialize`, seguido de "
229+
"la ejecución de un script Python codificado que imprime la fecha y la hora. "
230+
"Luego, la llamada :c:func:`Py_FinalizeEx` cierra el intérprete, seguido por "
231+
"el final del programa. En un programa real, es posible que desee obtener el "
232+
"script de Python de otra fuente, tal vez una rutina de editor de texto, un "
233+
"archivo o una base de datos. Obtener el código Python de un archivo se puede "
234+
"hacer mejor usando la función :c:func:`PyRun_SimpleFile`, que le ahorra la "
197235
"molestia de asignar espacio de memoria y cargar el contenido del archivo."
198236

199237
#: ../Doc/extending/embedding.rst:112
@@ -383,6 +421,78 @@ msgid ""
383421
" return 0;\n"
384422
"}\n"
385423
msgstr ""
424+
"#define PY_SSIZE_T_CLEAN\n"
425+
"#include <Python.h>\n"
426+
"\n"
427+
"int\n"
428+
"main(int argc, char *argv[])\n"
429+
"{\n"
430+
" PyObject *pName, *pModule, *pFunc;\n"
431+
" PyObject *pArgs, *pValue;\n"
432+
" int i;\n"
433+
"\n"
434+
" if (argc < 3) {\n"
435+
" fprintf(stderr,\"Usage: call pythonfile funcname [args]\\n\");\n"
436+
" return 1;\n"
437+
" }\n"
438+
"\n"
439+
" Py_Initialize();\n"
440+
" pName = PyUnicode_DecodeFSDefault(argv[1]);\n"
441+
" /* Error checking of pName left out */\n"
442+
"\n"
443+
" pModule = PyImport_Import(pName);\n"
444+
" Py_DECREF(pName);\n"
445+
"\n"
446+
" if (pModule != NULL) {\n"
447+
" pFunc = PyObject_GetAttrString(pModule, argv[2]);\n"
448+
" /* pFunc is a new reference */\n"
449+
"\n"
450+
" if (pFunc && PyCallable_Check(pFunc)) {\n"
451+
" pArgs = PyTuple_New(argc - 3);\n"
452+
" for (i = 0; i < argc - 3; ++i) {\n"
453+
" pValue = PyLong_FromLong(atoi(argv[i + 3]));\n"
454+
" if (!pValue) {\n"
455+
" Py_DECREF(pArgs);\n"
456+
" Py_DECREF(pModule);\n"
457+
" fprintf(stderr, \"Cannot convert argument\\n\");\n"
458+
" return 1;\n"
459+
" }\n"
460+
" /* pValue reference stolen here: */\n"
461+
" PyTuple_SetItem(pArgs, i, pValue);\n"
462+
" }\n"
463+
" pValue = PyObject_CallObject(pFunc, pArgs);\n"
464+
" Py_DECREF(pArgs);\n"
465+
" if (pValue != NULL) {\n"
466+
" printf(\"Result of call: %ld\\n\", PyLong_AsLong(pValue));\n"
467+
" Py_DECREF(pValue);\n"
468+
" }\n"
469+
" else {\n"
470+
" Py_DECREF(pFunc);\n"
471+
" Py_DECREF(pModule);\n"
472+
" PyErr_Print();\n"
473+
" fprintf(stderr,\"Call failed\\n\");\n"
474+
" return 1;\n"
475+
" }\n"
476+
" }\n"
477+
" else {\n"
478+
" if (PyErr_Occurred())\n"
479+
" PyErr_Print();\n"
480+
" fprintf(stderr, \"Cannot find function \\\"%s\\\"\\n\", "
481+
"argv[2]);\n"
482+
" }\n"
483+
" Py_XDECREF(pFunc);\n"
484+
" Py_DECREF(pModule);\n"
485+
" }\n"
486+
" else {\n"
487+
" PyErr_Print();\n"
488+
" fprintf(stderr, \"Failed to load \\\"%s\\\"\\n\", argv[1]);\n"
489+
" return 1;\n"
490+
" }\n"
491+
" if (Py_FinalizeEx() < 0) {\n"
492+
" return 120;\n"
493+
" }\n"
494+
" return 0;\n"
495+
"}\n"
386496

387497
#: ../Doc/extending/embedding.rst:165
388498
msgid ""
@@ -407,6 +517,12 @@ msgid ""
407517
" c = c + b\n"
408518
" return c"
409519
msgstr ""
520+
"def multiply(a,b):\n"
521+
" print(\"Will compute\", a, \"times\", b)\n"
522+
" c = 0\n"
523+
" for i in range(0, a):\n"
524+
" c = c + b\n"
525+
" return c"
410526

411527
#: ../Doc/extending/embedding.rst:180
412528
msgid "then the result should be:"
@@ -418,6 +534,9 @@ msgid ""
418534
"Will compute 3 times 2\n"
419535
"Result of call: 6"
420536
msgstr ""
537+
"$ call multiply multiply 3 2\n"
538+
"Will compute 3 times 2\n"
539+
"Result of call: 6"
421540

422541
#: ../Doc/extending/embedding.rst:188
423542
msgid ""
@@ -437,6 +556,10 @@ msgid ""
437556
"/* Error checking of pName left out */\n"
438557
"pModule = PyImport_Import(pName);"
439558
msgstr ""
559+
"Py_Initialize();\n"
560+
"pName = PyUnicode_DecodeFSDefault(argv[1]);\n"
561+
"/* Error checking of pName left out */\n"
562+
"pModule = PyImport_Import(pName);"
440563

441564
#: ../Doc/extending/embedding.rst:197
442565
msgid ""
@@ -460,6 +583,13 @@ msgid ""
460583
"}\n"
461584
"Py_XDECREF(pFunc);"
462585
msgstr ""
586+
"pFunc = PyObject_GetAttrString(pModule, argv[2]);\n"
587+
"/* pFunc is a new reference */\n"
588+
"\n"
589+
"if (pFunc && PyCallable_Check(pFunc)) {\n"
590+
" ...\n"
591+
"}\n"
592+
"Py_XDECREF(pFunc);"
463593

464594
#: ../Doc/extending/embedding.rst:210
465595
msgid ""
@@ -477,7 +607,7 @@ msgstr ""
477607

478608
#: ../Doc/extending/embedding.rst:216
479609
msgid "pValue = PyObject_CallObject(pFunc, pArgs);"
480-
msgstr ""
610+
msgstr "pValue = PyObject_CallObject(pFunc, pArgs);"
481611

482612
#: ../Doc/extending/embedding.rst:218
483613
msgid ""
@@ -544,6 +674,33 @@ msgid ""
544674
" return PyModule_Create(&EmbModule);\n"
545675
"}"
546676
msgstr ""
677+
"static int numargs=0;\n"
678+
"\n"
679+
"/* Return the number of arguments of the application command line */\n"
680+
"static PyObject*\n"
681+
"emb_numargs(PyObject *self, PyObject *args)\n"
682+
"{\n"
683+
" if(!PyArg_ParseTuple(args, \":numargs\"))\n"
684+
" return NULL;\n"
685+
" return PyLong_FromLong(numargs);\n"
686+
"}\n"
687+
"\n"
688+
"static PyMethodDef EmbMethods[] = {\n"
689+
" {\"numargs\", emb_numargs, METH_VARARGS,\n"
690+
" \"Return the number of arguments received by the process.\"},\n"
691+
" {NULL, NULL, 0, NULL}\n"
692+
"};\n"
693+
"\n"
694+
"static PyModuleDef EmbModule = {\n"
695+
" PyModuleDef_HEAD_INIT, \"emb\", NULL, -1, EmbMethods,\n"
696+
" NULL, NULL, NULL, NULL\n"
697+
"};\n"
698+
"\n"
699+
"static PyObject*\n"
700+
"PyInit_emb(void)\n"
701+
"{\n"
702+
" return PyModule_Create(&EmbModule);\n"
703+
"}"
547704

548705
#: ../Doc/extending/embedding.rst:265
549706
msgid ""
@@ -559,23 +716,26 @@ msgid ""
559716
"numargs = argc;\n"
560717
"PyImport_AppendInittab(\"emb\", &PyInit_emb);"
561718
msgstr ""
719+
"numargs = argc;\n"
720+
"PyImport_AppendInittab(\"emb\", &PyInit_emb);"
562721

563722
#: ../Doc/extending/embedding.rst:271
564-
#, fuzzy
565723
msgid ""
566724
"These two lines initialize the ``numargs`` variable, and make the :func:`!"
567725
"emb.numargs` function accessible to the embedded Python interpreter. With "
568726
"these extensions, the Python script can do things like"
569727
msgstr ""
570728
"Estas dos líneas inicializan la variable ``numargs`` y hacen que la función :"
571-
"func:`emb.numargs` sea accesible para el intérprete de Python incorporado. "
729+
"func:`!emb.numargs` sea accesible para el intérprete de Python incorporado. "
572730
"Con estas extensiones, el script de Python puede hacer cosas como"
573731

574732
#: ../Doc/extending/embedding.rst:275
575733
msgid ""
576734
"import emb\n"
577735
"print(\"Number of arguments\", emb.numargs())"
578736
msgstr ""
737+
"import emb\n"
738+
"print(\"Number of arguments\", emb.numargs())"
579739

580740
#: ../Doc/extending/embedding.rst:280
581741
msgid ""
@@ -647,21 +807,27 @@ msgid ""
647807
"-I/opt/include/python3.11 -I/opt/include/python3.11 -Wsign-compare -DNDEBUG "
648808
"-g -fwrapv -O3 -Wall"
649809
msgstr ""
810+
"$ /opt/bin/python3.11-config --cflags\n"
811+
"-I/opt/include/python3.11 -I/opt/include/python3.11 -Wsign-compare -DNDEBUG "
812+
"-g -fwrapv -O3 -Wall"
650813

651814
#: ../Doc/extending/embedding.rst:323
652-
#, fuzzy
653815
msgid ""
654816
"``pythonX.Y-config --ldflags --embed`` will give you the recommended flags "
655817
"when linking:"
656818
msgstr ""
657-
"``pythonX.Y-config --ldflags`` le dará las banderas recomendadas al vincular:"
819+
"``pythonX.Y-config --ldflags --embed`` le dará las banderas recomendadas al "
820+
"vincular:"
658821

659822
#: ../Doc/extending/embedding.rst:326
660823
msgid ""
661824
"$ /opt/bin/python3.11-config --ldflags --embed\n"
662825
"-L/opt/lib/python3.11/config-3.11-x86_64-linux-gnu -L/opt/lib -lpython3.11 -"
663826
"lpthread -ldl -lutil -lm"
664827
msgstr ""
828+
"$ /opt/bin/python3.11-config --ldflags --embed\n"
829+
"-L/opt/lib/python3.11/config-3.11-x86_64-linux-gnu -L/opt/lib -lpython3.11 -"
830+
"lpthread -ldl -lutil -lm"
665831

666832
#: ../Doc/extending/embedding.rst:332
667833
msgid ""
@@ -703,3 +869,8 @@ msgid ""
703869
">>> sysconfig.get_config_var('LINKFORSHARED')\n"
704870
"'-Xlinker -export-dynamic'"
705871
msgstr ""
872+
">>> import sysconfig\n"
873+
">>> sysconfig.get_config_var('LIBS')\n"
874+
"'-lpthread -ldl -lutil'\n"
875+
">>> sysconfig.get_config_var('LINKFORSHARED')\n"
876+
"'-Xlinker -export-dynamic'"

0 commit comments

Comments
 (0)