@@ -1132,23 +1132,28 @@ msgid ""
11321132"methods of the type. *pythonapi* is a predefined symbol giving access to "
11331133"the Python C api::"
11341134msgstr ""
1135+ ":mod:`ctypes` 可以通过 :meth:`in_dll` 类方法访问这类变量 。 *pythonapi* 是用于访问 Python C "
1136+ "接口的预定义符号::"
11351137
11361138#: ../../library/ctypes.rst:1069
11371139msgid ""
11381140"If the interpreter would have been started with :option:`-O`, the sample "
11391141"would have printed ``c_long(1)``, or ``c_long(2)`` if :option:`-OO` would "
11401142"have been specified."
11411143msgstr ""
1144+ "如果解释器使用 :option:`-O` 选项启动,这个例子会打印 ``c_long(1)`` , 如果使用 :option:`-OO` 启动,则会打印"
1145+ " ``c_long(2)`` 。"
11421146
11431147#: ../../library/ctypes.rst:1073
11441148msgid ""
11451149"An extended example which also demonstrates the use of pointers accesses the"
11461150" :c:data:`PyImport_FrozenModules` pointer exported by Python."
11471151msgstr ""
1152+ "一个扩展例子, 同时也展示了使用指针访问 Python 导出的 :c:data:`PyImport_FrozenModules` 指针对象。"
11481153
11491154#: ../../library/ctypes.rst:1076
11501155msgid "Quoting the docs for that value:"
1151- msgstr ""
1156+ msgstr "对文档中这个值的解释说明 "
11521157
11531158#: ../../library/ctypes.rst:1078
11541159msgid ""
@@ -1158,18 +1163,20 @@ msgid ""
11581163"could play tricks with this to provide a dynamically created collection of "
11591164"frozen modules."
11601165msgstr ""
1166+ "该指针被初始化为指向 :c:type:`struct _frozen` 数组,以 ``NULL`` 或者 0 "
1167+ "作为结束标记。当一个冻结模块被导入,首先要在这个表中搜索。第三方库可以以此来提供动态创建的冻结模块集合。"
11611168
11621169#: ../../library/ctypes.rst:1083
11631170msgid ""
11641171"So manipulating this pointer could even prove useful. To restrict the "
11651172"example size, we show only how this table can be read with :mod:`ctypes`::"
1166- msgstr ""
1173+ msgstr "这足以证明修改这个指针是很有用的。为了让实例大小不至于太长,这里只展示如何使用 :mod:`ctypes` 读取这个表:: "
11671174
11681175#: ../../library/ctypes.rst:1095
11691176msgid ""
11701177"We have defined the :c:type:`struct _frozen` data type, so we can get the "
11711178"pointer to the table::"
1172- msgstr ""
1179+ msgstr "我们定义了 :c:type:`struct _frozen` 数据类型,接着就可以获取这张表的指针了:: "
11731180
11741181#: ../../library/ctypes.rst:1102
11751182msgid ""
@@ -1179,13 +1186,18 @@ msgid ""
11791186" crash with an access violation or whatever, so it's better to break out of "
11801187"the loop when we hit the ``NULL`` entry::"
11811188msgstr ""
1189+ "由于 ``table`` 是指向 ``struct_frozen`` 数组的 ``指针`` "
1190+ ",我们可以遍历它,只不过需要自己判断循环是否结束,因为指针本身并不包含长度。它早晚会因为访问到野指针或者什么的把自己搞崩溃,所以我们最好在遇到 "
1191+ "``NULL`` 后就让它退出循环::"
11821192
11831193#: ../../library/ctypes.rst:1120
11841194msgid ""
11851195"The fact that standard Python has a frozen module and a frozen package "
11861196"(indicated by the negative ``size`` member) is not well known, it is only "
11871197"used for testing. Try it out with ``import __hello__`` for example."
11881198msgstr ""
1199+ "Python 的冻结模块和冻结包(由负 ``size`` 成员表示)并不是广为人知的事情,它们仅仅用于实验。例如,可以使用 ``import "
1200+ "__hello__`` 尝试一下这个功能。"
11891201
11901202#: ../../library/ctypes.rst:1128
11911203msgid "Surprises"
0 commit comments