@@ -11,15 +11,16 @@ msgstr ""
11
11
"Project-Id-Version : Python 3.8\n "
12
12
"Report-Msgid-Bugs-To : \n "
13
13
"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 "
15
15
"
Last-Translator :
Cristián Maureira-Fredes <[email protected] >\n "
16
- "Language : es\n "
17
16
"Language-Team : python-doc-es\n "
18
- "Plural-Forms : nplurals=2; plural=(n != 1); \n "
17
+ "Language : es \n "
19
18
"MIME-Version : 1.0\n "
20
19
"Content-Type : text/plain; charset=utf-8\n "
21
20
"Content-Transfer-Encoding : 8bit\n "
21
+ "Plural-Forms : nplurals=2; plural=(n != 1);\n "
22
22
"Generated-By : Babel 2.16.0\n "
23
+ "X-Generator : Poedit 3.5\n "
23
24
24
25
#: ../Doc/extending/embedding.rst:8
25
26
msgid "Embedding Python in Another Application"
@@ -160,6 +161,40 @@ msgid ""
160
161
" Py_ExitStatusException(status);\n"
161
162
"}"
162
163
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
+ "}"
163
198
164
199
#: ../Doc/extending/embedding.rst:92
165
200
msgid ""
@@ -168,9 +203,12 @@ msgid ""
168
203
"3.13, but we keep it here for backward compatibility. See :ref:`arg-parsing-"
169
204
"string-and-buffers` for a description of this macro."
170
205
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."
171
210
172
211
#: ../Doc/extending/embedding.rst:97
173
- #, fuzzy
174
212
msgid ""
175
213
"Setting :c:member:`PyConfig.program_name` should be called before :c:func:"
176
214
"`Py_InitializeFromConfig` to inform the interpreter about paths to Python "
@@ -184,16 +222,16 @@ msgid ""
184
222
"`PyRun_SimpleFile` function, which saves you the trouble of allocating "
185
223
"memory space and loading the file contents."
186
224
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 "
197
235
"molestia de asignar espacio de memoria y cargar el contenido del archivo."
198
236
199
237
#: ../Doc/extending/embedding.rst:112
@@ -383,6 +421,78 @@ msgid ""
383
421
" return 0;\n"
384
422
"}\n"
385
423
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"
386
496
387
497
#: ../Doc/extending/embedding.rst:165
388
498
msgid ""
@@ -407,6 +517,12 @@ msgid ""
407
517
" c = c + b\n"
408
518
" return c"
409
519
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"
410
526
411
527
#: ../Doc/extending/embedding.rst:180
412
528
msgid "then the result should be:"
@@ -418,6 +534,9 @@ msgid ""
418
534
"Will compute 3 times 2\n"
419
535
"Result of call: 6"
420
536
msgstr ""
537
+ "$ call multiply multiply 3 2\n"
538
+ "Will compute 3 times 2\n"
539
+ "Result of call: 6"
421
540
422
541
#: ../Doc/extending/embedding.rst:188
423
542
msgid ""
@@ -437,6 +556,10 @@ msgid ""
437
556
"/* Error checking of pName left out */\n"
438
557
"pModule = PyImport_Import(pName);"
439
558
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);"
440
563
441
564
#: ../Doc/extending/embedding.rst:197
442
565
msgid ""
@@ -460,6 +583,13 @@ msgid ""
460
583
"}\n"
461
584
"Py_XDECREF(pFunc);"
462
585
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);"
463
593
464
594
#: ../Doc/extending/embedding.rst:210
465
595
msgid ""
@@ -477,7 +607,7 @@ msgstr ""
477
607
478
608
#: ../Doc/extending/embedding.rst:216
479
609
msgid "pValue = PyObject_CallObject(pFunc, pArgs);"
480
- msgstr ""
610
+ msgstr "pValue = PyObject_CallObject(pFunc, pArgs); "
481
611
482
612
#: ../Doc/extending/embedding.rst:218
483
613
msgid ""
@@ -544,6 +674,33 @@ msgid ""
544
674
" return PyModule_Create(&EmbModule);\n"
545
675
"}"
546
676
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
+ "}"
547
704
548
705
#: ../Doc/extending/embedding.rst:265
549
706
msgid ""
@@ -559,23 +716,26 @@ msgid ""
559
716
"numargs = argc;\n"
560
717
"PyImport_AppendInittab(\" emb\" , &PyInit_emb);"
561
718
msgstr ""
719
+ "numargs = argc;\n"
720
+ "PyImport_AppendInittab(\" emb\" , &PyInit_emb);"
562
721
563
722
#: ../Doc/extending/embedding.rst:271
564
- #, fuzzy
565
723
msgid ""
566
724
"These two lines initialize the ``numargs`` variable, and make the :func:`!"
567
725
"emb.numargs` function accessible to the embedded Python interpreter. With "
568
726
"these extensions, the Python script can do things like"
569
727
msgstr ""
570
728
"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. "
572
730
"Con estas extensiones, el script de Python puede hacer cosas como"
573
731
574
732
#: ../Doc/extending/embedding.rst:275
575
733
msgid ""
576
734
"import emb\n"
577
735
"print(\" Number of arguments\" , emb.numargs())"
578
736
msgstr ""
737
+ "import emb\n"
738
+ "print(\" Number of arguments\" , emb.numargs())"
579
739
580
740
#: ../Doc/extending/embedding.rst:280
581
741
msgid ""
@@ -647,21 +807,27 @@ msgid ""
647
807
"-I/opt/include/python3.11 -I/opt/include/python3.11 -Wsign-compare -DNDEBUG "
648
808
"-g -fwrapv -O3 -Wall"
649
809
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"
650
813
651
814
#: ../Doc/extending/embedding.rst:323
652
- #, fuzzy
653
815
msgid ""
654
816
"``pythonX.Y-config --ldflags --embed`` will give you the recommended flags "
655
817
"when linking:"
656
818
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:"
658
821
659
822
#: ../Doc/extending/embedding.rst:326
660
823
msgid ""
661
824
"$ /opt/bin/python3.11-config --ldflags --embed\n"
662
825
"-L/opt/lib/python3.11/config-3.11-x86_64-linux-gnu -L/opt/lib -lpython3.11 -"
663
826
"lpthread -ldl -lutil -lm"
664
827
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"
665
831
666
832
#: ../Doc/extending/embedding.rst:332
667
833
msgid ""
@@ -703,3 +869,8 @@ msgid ""
703
869
">>> sysconfig.get_config_var('LINKFORSHARED')\n"
704
870
"'-Xlinker -export-dynamic'"
705
871
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