@@ -69,21 +69,19 @@ msgid ""
69
69
msgstr "μννλ €λ μμ
μ λ°λΌ, μ¬λ¬λΆ λ§μ C νμ₯μ μμ±νλ μ¬λ¬ κ°μ§ λμμ΄ μμ΅λλ€."
70
70
71
71
#: ../../faq/extending.rst:44
72
- #, fuzzy
73
72
msgid ""
74
73
"`Cython <https://cython.org>`_ and its relative `Pyrex "
75
74
"<https://www.csse.canterbury.ac.nz/greg.ewing/python/Pyrex/>`_ are "
76
75
"compilers that accept a slightly modified form of Python and generate the"
77
76
" corresponding C code. Cython and Pyrex make it possible to write an "
78
77
"extension without having to learn Python's C API."
79
78
msgstr ""
80
- "`Cython <http ://cython.org>`_\\ κ³Ό κ΄λ ¨ `Pyrex "
81
- "<https://www.cosc .canterbury.ac.nz/greg.ewing/python/Pyrex/>`_\\ λ μ½κ° μμ λ "
79
+ "`Cython <https ://cython.org>`_\\ κ³Ό κ΄λ ¨ `Pyrex "
80
+ "<https://www.csse .canterbury.ac.nz/greg.ewing/python/Pyrex/>`_\\ λ μ½κ° μμ λ "
82
81
"νμ΄μ¬ νμμ λ°μλ€μ΄κ³ ν΄λΉ C μ½λλ₯Ό μμ±νλ μ»΄νμΌλ¬μ
λλ€. Cythonκ³Ό Pyrexλ₯Ό μ¬μ©νλ©΄ νμ΄μ¬μ C APIλ₯Ό λ°°μ°μ§ "
83
82
"μκ³ λ νμ₯μ μμ±ν μ μμ΅λλ€."
84
83
85
84
#: ../../faq/extending.rst:50
86
- #, fuzzy
87
85
msgid ""
88
86
"If you need to interface to some C or C++ library for which no Python "
89
87
"extension currently exists, you can try wrapping the library's data types"
@@ -95,10 +93,9 @@ msgid ""
95
93
" libraries."
96
94
msgstr ""
97
95
"νμ¬ νμ΄μ¬ νμ₯μ΄ μλ μΌλΆ Cλ C++ λΌμ΄λΈλ¬λ¦¬μ λν μΈν°νμ΄μ€κ° νμνλ©΄, λΌμ΄λΈλ¬λ¦¬μ λ°μ΄ν°νκ³Ό ν¨μλ₯Ό `SWIG "
98
- "<http://www.swig.org>`_\\ κ³Ό κ°μ λκ΅¬λ‘ λνν μ μμ΅λλ€. `SIP "
99
- "<https://riverbankcomputing.com/software/sip/intro>`__, `CXX "
100
- "<http://cxx.sourceforge.net/>`_, `Boost "
101
- "<http://www.boost.org/libs/python/doc/index.html>`_ λλ `Weave "
96
+ "<https://www.swig.org>`_\\ κ³Ό κ°μ λκ΅¬λ‘ λνν μ μμ΅λλ€. `SIP <https://github.com"
97
+ "/Python-SIP/sip>`__, `CXX <https://cxx.sourceforge.net/>`_, `Boost "
98
+ "<https://www.boost.org/libs/python/doc/index.html>`_ λλ `Weave "
102
99
"<https://github.com/scipy/weave>`_\\ λ C++ λΌμ΄λΈλ¬λ¦¬ λνμ λμμ
λλ€."
103
100
104
101
#: ../../faq/extending.rst:61
@@ -138,7 +135,6 @@ msgid "How do I extract C values from a Python object?"
138
135
msgstr "νμ΄μ¬ κ°μ²΄μμ Cκ°μ μ΄λ»κ² μΆμΆν©λκΉ?"
139
136
140
137
#: ../../faq/extending.rst:82
141
- #, fuzzy
142
138
msgid ""
143
139
"That depends on the object's type. If it's a tuple, "
144
140
":c:func:`PyTuple_Size` returns its length and :c:func:`PyTuple_GetItem` "
@@ -147,10 +143,9 @@ msgid ""
147
143
msgstr ""
148
144
"μ΄λ κ°μ²΄μ νμ λ°λΌ λ€λ¦
λλ€. ννμ΄λ©΄, :c:func:`PyTuple_Size`\\ λ κΈΈμ΄λ₯Ό λ°ννκ³ "
149
145
":c:func:`PyTuple_GetItem`\\ μ μ§μ λ μΈλ±μ€μ νλͺ©μ λ°νν©λλ€. 리μ€νΈλ λΉμ·ν ν¨μλ₯Ό κ°μ§κ³ μμ΅λλ€, "
150
- ":c:func:`PyListSize `\\ μ :c:func:`PyList_GetItem`."
146
+ ":c:func:`PyList_Size `\\ μ :c:func:`PyList_GetItem`."
151
147
152
148
#: ../../faq/extending.rst:87
153
- #, fuzzy
154
149
msgid ""
155
150
"For bytes, :c:func:`PyBytes_Size` returns its length and "
156
151
":c:func:`PyBytes_AsStringAndSize` provides a pointer to its value and its"
@@ -159,7 +154,7 @@ msgid ""
159
154
msgstr ""
160
155
"λ°μ΄νΈμ΄μμλ, :c:func:`PyBytes_Size`\\ λ κΈΈμ΄λ₯Ό λ°ννκ³ "
161
156
":c:func:`PyBytes_AsStringAndSize`\\ λ κ°κ³Ό κΈΈμ΄μ λν ν¬μΈν°λ₯Ό μ 곡ν©λλ€. νμ΄μ¬ λ°μ΄νΈμ΄ κ°μ²΄λ "
162
- "λ(null) λ°μ΄νΈλ₯Ό ν¬ν¨ν μ μμ΄μ Cμ :c:func:`strlen`\\ μ μ¬μ©ν μ μμμ μ μνμμμ€."
157
+ "λ(null) λ°μ΄νΈλ₯Ό ν¬ν¨ν μ μμ΄μ Cμ :c:func:`! strlen`\\ μ μ¬μ©ν μ μμμ μ μνμμμ€."
163
158
164
159
#: ../../faq/extending.rst:92
165
160
msgid ""
@@ -214,6 +209,9 @@ msgid ""
214
209
"PyObject_CallMethod(PyObject *object, const char *method_name,\n"
215
210
" const char *arg_format, ...);"
216
211
msgstr ""
212
+ "PyObject *\n"
213
+ "PyObject_CallMethod(PyObject *object, const char *method_name,\n"
214
+ " const char *arg_format, ...);"
217
215
218
216
#: ../../faq/extending.rst:121
219
217
msgid ""
@@ -241,6 +239,13 @@ msgid ""
241
239
" Py_DECREF(res);\n"
242
240
"}"
243
241
msgstr ""
242
+ "res = PyObject_CallMethod(f, \" seek\" , \" (ii)\" , 10, 0);\n"
243
+ "if (res == NULL) {\n"
244
+ " ... an exception occurred ...\n"
245
+ "}\n"
246
+ "else {\n"
247
+ " Py_DECREF(res);\n"
248
+ "}"
244
249
245
250
#: ../../faq/extending.rst:135
246
251
msgid ""
@@ -284,6 +289,13 @@ msgid ""
284
289
"foo\n"
285
290
"hello world!"
286
291
msgstr ""
292
+ ">>> import io, sys\n"
293
+ ">>> sys.stdout = io.StringIO()\n"
294
+ ">>> print('foo')\n"
295
+ ">>> print('hello world!')\n"
296
+ ">>> sys.stderr.write(sys.stdout.getvalue())\n"
297
+ "foo\n"
298
+ "hello world!"
287
299
288
300
#: ../../faq/extending.rst:161
289
301
msgid "A custom object to do the same would look like this:"
@@ -306,6 +318,20 @@ msgid ""
306
318
"foo\n"
307
319
"hello world!"
308
320
msgstr ""
321
+ ">>> import io, sys\n"
322
+ ">>> class StdoutCatcher(io.TextIOBase):\n"
323
+ "... def __init__(self):\n"
324
+ "... self.data = []\n"
325
+ "... def write(self, stuff):\n"
326
+ "... self.data.append(stuff)\n"
327
+ "...\n"
328
+ ">>> import sys\n"
329
+ ">>> sys.stdout = StdoutCatcher()\n"
330
+ ">>> print('foo')\n"
331
+ ">>> print('hello world!')\n"
332
+ ">>> sys.stderr.write(''.join(sys.stdout.data))\n"
333
+ "foo\n"
334
+ "hello world!"
309
335
310
336
#: ../../faq/extending.rst:182
311
337
msgid "How do I access a module written in Python from C?"
@@ -317,7 +343,7 @@ msgstr "λ€μκ³Ό κ°μ΄ λͺ¨λ κ°μ²΄μ λν ν¬μΈν°λ₯Ό μ»μ μ μμ΅
317
343
318
344
#: ../../faq/extending.rst:186
319
345
msgid "module = PyImport_ImportModule(\" <modulename>\" );"
320
- msgstr ""
346
+ msgstr "module = PyImport_ImportModule( \" <modulename> \" ); "
321
347
322
348
#: ../../faq/extending.rst:188
323
349
msgid ""
@@ -339,7 +365,7 @@ msgstr "κ·Έλ° λ€μ, λ€μκ³Ό κ°μ΄ λͺ¨λμ μ΄νΈλ¦¬λ·°νΈ(μ¦ λͺ¨λμ
339
365
340
366
#: ../../faq/extending.rst:197
341
367
msgid "attr = PyObject_GetAttrString(module, \" <attrname>\" );"
342
- msgstr ""
368
+ msgstr "attr = PyObject_GetAttrString(module, \" <attrname> \" ); "
343
369
344
370
#: ../../faq/extending.rst:199
345
371
msgid ""
@@ -398,7 +424,7 @@ msgstr "``.gdbinit`` νμΌμμ (λλ λνμμΌλ‘) λ€μ λͺ
λ Ήμ μΆ
398
424
399
425
#: ../../faq/extending.rst:231
400
426
msgid "br _PyImport_LoadDynamicModule"
401
- msgstr ""
427
+ msgstr "br _PyImport_LoadDynamicModule "
402
428
403
429
#: ../../faq/extending.rst:235
404
430
msgid "Then, when you run GDB:"
@@ -413,6 +439,12 @@ msgid ""
413
439
"gdb) br myfunction.c:50\n"
414
440
"gdb) continue"
415
441
msgstr ""
442
+ "$ gdb /local/bin/python\n"
443
+ "gdb) run myscript.py\n"
444
+ "gdb) continue # repeat until your extension is loaded\n"
445
+ "gdb) finish # so that your extension is loaded\n"
446
+ "gdb) br myfunction.c:50\n"
447
+ "gdb) continue"
416
448
417
449
#: ../../faq/extending.rst:247
418
450
msgid ""
@@ -421,23 +453,18 @@ msgid ""
421
453
msgstr "리λ
μ€ μμ€ν
μμ νμ΄μ¬ λͺ¨λμ μ»΄νμΌνκ³ μΆμ§λ§, μΌλΆ νμΌμ΄ μμ΅λλ€. μ κ·Έλ μ΅λκΉ?"
422
454
423
455
#: ../../faq/extending.rst:249
424
- #, fuzzy , python-brace-format
425
456
msgid ""
426
457
"Most packaged versions of Python omit some files required for compiling "
427
458
"Python extensions."
428
- msgstr ""
429
- "λλΆλΆμ ν¬μ₯λ λ²μ μ νμ΄μ¬μ νμ΄μ¬ νμ₯μ μ»΄νμΌνλ λ° νμν λ€μν νμΌμ΄ ν¬ν¨λ "
430
- ":file:`/usr/lib/python2.{x}/config/` λλ ν°λ¦¬κ° ν¬ν¨λμ΄ μμ§ μμ΅λλ€."
459
+ msgstr "λλΆλΆμ ν¬μ₯λ λ²μ μ νμ΄μ¬μ νμ΄μ¬ νμ₯μ μ»΄νμΌνλ λ° νμν μΌλΆ νμΌμ μλ΅νκ³ μμ΅λλ€."
431
460
432
461
#: ../../faq/extending.rst:252
433
- #, fuzzy
434
462
msgid "For Red Hat, install the python3-devel RPM to get the necessary files."
435
- msgstr "λ λνμ κ²½μ°, νμν νμΌμ μ»μΌλ €λ©΄ python -devel RPMμ μ€μΉνμμμ€."
463
+ msgstr "λ λνμ κ²½μ°, νμν νμΌμ μ»μΌλ €λ©΄ python3 -devel RPMμ μ€μΉνμμμ€."
436
464
437
465
#: ../../faq/extending.rst:254
438
- #, fuzzy
439
466
msgid "For Debian, run ``apt-get install python3-dev``."
440
- msgstr "λ°λΉμμ κ²½μ°, ``apt-get install python -dev``\\ λ₯Ό μ€ννμμμ€."
467
+ msgstr "λ°λΉμμ κ²½μ°, ``apt-get install python3 -dev``\\ λ₯Ό μ€ννμμμ€."
441
468
442
469
#: ../../faq/extending.rst:257
443
470
msgid "How do I tell \" incomplete input\" from \" invalid input\" ?"
@@ -508,67 +535,12 @@ msgstr ""
508
535
"μμ΅λλ€."
509
536
510
537
#: ../../faq/extending.rst:288
511
- #, fuzzy
512
538
msgid ""
513
539
"The Boost Python Library (BPL, "
514
540
"https://www.boost.org/libs/python/doc/index.html) provides a way of doing"
515
541
" this from C++ (i.e. you can inherit from an extension class written in "
516
542
"C++ using the BPL)."
517
543
msgstr ""
518
- "Boost νμ΄μ¬ λΌμ΄λΈλ¬λ¦¬(BPL, http ://www.boost.org/libs/python/doc/index.html)λ "
544
+ "Boost νμ΄μ¬ λΌμ΄λΈλ¬λ¦¬(BPL, https ://www.boost.org/libs/python/doc/index.html)λ "
519
545
"C++μμ μ΄λ₯Ό μννλ λ°©λ²μ μ 곡ν©λλ€ (μ¦, BPLμ μ¬μ©νμ¬ C++λ‘ μμ±λ νμ₯ ν΄λμ€λ₯Ό μμν μ μμ΅λλ€)."
520
546
521
- #~ msgid ""
522
- #~ "However sometimes you have to run "
523
- #~ "the embedded Python interpreter in the"
524
- #~ " same thread as your rest application"
525
- #~ " and you can't allow the "
526
- #~ ":c:func:`PyRun_InteractiveLoop` to stop while "
527
- #~ "waiting for user input. The one "
528
- #~ "solution then is to call "
529
- #~ ":c:func:`PyParser_ParseString` and test for "
530
- #~ "``e.error`` equal to ``E_EOF``, which "
531
- #~ "means the input is incomplete. Here's"
532
- #~ " a sample code fragment, untested, "
533
- #~ "inspired by code from Alex Farber::"
534
- #~ msgstr ""
535
- #~ "κ·Έλ¬λ λλ‘λ λλ¨Έμ§ μμ© νλ‘κ·Έλ¨κ³Ό κ°μ μ€λ λμμ "
536
- #~ "λ΄μ₯λ νμ΄μ¬ μΈν°ν리ν°λ₯Ό μ€νν΄μΌ νκ³ , μ¬μ©μ μ
λ ₯μ"
537
- #~ " κΈ°λ€λ¦¬λ λμ :c:func:`PyRun_InteractiveLoop`\\λ₯Ό μ€μ§ν "
538
- #~ " μ μμ΅λλ€. ν κ°μ§ ν΄κ²°μ±
μ "
539
- #~ ":c:func:`PyParser_ParseString`\\μ νΈμΆνκ³ ``e.error``\\κ° "
540
- #~ "``E_EOF``\\μ κ°μμ§λ₯Ό κ²μ¬νλ κ²μΈλ°, μ΄λ μ
λ ₯μ΄ "
541
- #~ "λΆμμ νλ€λ κ²μ μλ―Έν©λλ€. λ€μμ Alex Farberμ "
542
- #~ "μ½λμμ μκ°μ μ»μ ν
μ€νΈ λμ§ μμ μν μ½λ"
543
- #~ " μ‘°κ°μ
λλ€::"
544
-
545
- #~ msgid ""
546
- #~ "Another solution is trying to compile"
547
- #~ " the received string with "
548
- #~ ":c:func:`Py_CompileString`. If it compiles "
549
- #~ "without errors, try to execute the "
550
- #~ "returned code object by calling "
551
- #~ ":c:func:`PyEval_EvalCode`. Otherwise save the "
552
- #~ "input for later. If the compilation "
553
- #~ "fails, find out if it's an error"
554
- #~ " or just more input is required "
555
- #~ "- by extracting the message string "
556
- #~ "from the exception tuple and comparing"
557
- #~ " it to the string \"unexpected EOF"
558
- #~ " while parsing\". Here is a complete"
559
- #~ " example using the GNU readline "
560
- #~ "library (you may want to ignore "
561
- #~ "**SIGINT** while calling readline())::"
562
- #~ msgstr ""
563
- #~ "λ€λ₯Έ ν΄κ²°μ±
μ μμ λ λ¬Έμμ΄μ "
564
- #~ ":c:func:`Py_CompileString`\\μΌλ‘ μ»΄νμΌνλ €κ³ νλ κ²μ
λλ€. "
565
- #~ "μλ¬ μμ΄ μ»΄νμΌλλ©΄, :c:func:`PyEval_EvalCode`\\λ₯Ό νΈμΆνμ¬"
566
- #~ " λ°νλ μ½λ κ°μ²΄λ₯Ό μ€νν΄ λ³΄μμμ€. κ·Έλ μ§ μμΌλ©΄"
567
- #~ " λμ€μ μν΄ μ
λ ₯μ μ μ₯νμμμ€. μ»΄νμΌμ΄ μ€ν¨νλ©΄, "
568
- #~ "μμΈ ννμμ λ©μμ§ λ¬Έμμ΄μ μΆμΆνκ³ μ΄λ₯Ό "
569
- #~ "\"unexpected EOF while parsing\" λ¬Έμμ΄κ³Ό "
570
- #~ "λΉκ΅νμ¬ μλ¬μΈμ§ λ¨μ§ λ λ§μ μ
λ ₯μ΄ νμνμ§λ₯Ό "
571
- #~ "νμΈνμμμ€. λ€μμ GNU readline λΌμ΄λΈλ¬λ¦¬λ₯Ό μ¬μ©νλ "
572
- #~ "μμ ν μμ μ
λλ€ (readline()μ νΈμΆνλ λμ "
573
- #~ "**SIGINT**\\λ₯Ό 무μνκ³ μ ν μ μμ΅λλ€)::"
574
-
0 commit comments