-
-
Notifications
You must be signed in to change notification settings - Fork 98
Expand file tree
/
Copy pathbytes.po
More file actions
694 lines (575 loc) · 24.4 KB
/
bytes.po
File metadata and controls
694 lines (575 loc) · 24.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
# SOME DESCRIPTIVE TITLE.
# Copyright (C) 2001 Python Software Foundation
# This file is distributed under the same license as the Python package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
# Translators:
# 99 <wh2099@pm.me>, 2026
# python-doc bot, 2026
# Freesand Leo <yuqinju@163.com>, 2026
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: Python 3.15\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2026-05-09 14:43+0000\n"
"PO-Revision-Date: 2025-09-16 00:00+0000\n"
"Last-Translator: Freesand Leo <yuqinju@163.com>, 2026\n"
"Language-Team: Chinese (China) (https://app.transifex.com/python-doc/teams/5390/zh_CN/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: zh_CN\n"
"Plural-Forms: nplurals=1; plural=0;\n"
#: ../../c-api/bytes.rst:6
msgid "Bytes Objects"
msgstr "bytes 对象"
#: ../../c-api/bytes.rst:8
msgid ""
"These functions raise :exc:`TypeError` when expecting a bytes parameter and "
"called with a non-bytes parameter."
msgstr "这些函数在期望附带一个字节串形参但却附带了一个非字节串形参被调用时会引发 :exc:`TypeError`。"
#: ../../c-api/bytes.rst:16
msgid "This subtype of :c:type:`PyObject` represents a Python bytes object."
msgstr "这种 :c:type:`PyObject` 的子类型表示一个 Python 字节对象。"
#: ../../c-api/bytes.rst:21
msgid ""
"This instance of :c:type:`PyTypeObject` represents the Python bytes type; it"
" is the same object as :class:`bytes` in the Python layer."
msgstr ""
":c:type:`PyTypeObject` 的实例代表一个 Python 字节类型,在 Python 层面它与 :class:`bytes` "
"是相同的对象。"
#: ../../c-api/bytes.rst:27
msgid ""
"Return true if the object *o* is a bytes object or an instance of a subtype "
"of the bytes type. This function always succeeds."
msgstr "如果对象 *o* 是一个 bytes 对象或者 bytes 类型的子类型的实例则返回真值。此函数总是会成功执行。"
#: ../../c-api/bytes.rst:33
msgid ""
"Return true if the object *o* is a bytes object, but not an instance of a "
"subtype of the bytes type. This function always succeeds."
msgstr "如果对象 *o* 是一个 bytes 对象但不是 bytes 类型的子类型的实例则返回真值。此函数总是会成功执行。"
#: ../../c-api/bytes.rst:39
msgid ""
"Return a new bytes object with a copy of the string *v* as value on success,"
" and ``NULL`` on failure. The parameter *v* must not be ``NULL``; it will "
"not be checked."
msgstr ""
"成功时返回一个以字符串 *v* 的副本为值的新字节串对象,失败时返回 ``NULL``。形参 *v* 不可为 ``NULL``;它不会被检查。"
#: ../../c-api/bytes.rst:46
msgid ""
"Return a new bytes object with a copy of the string *v* as value and length "
"*len* on success, and ``NULL`` on failure. If *v* is ``NULL``, the contents"
" of the bytes object are uninitialized."
msgstr ""
"成功时返回一个以字符串 *v* 的副本为值且长度为 *len* 的新字节串对象,失败时返回 ``NULL``。如果 *v* 为 "
"``NULL``,则不初始化字节串对象的内容。"
#: ../../c-api/bytes.rst:50
msgid ""
"Use the :c:type:`PyBytesWriter` API instead of "
"``PyBytes_FromStringAndSize(NULL, len)``."
msgstr ""
#: ../../c-api/bytes.rst:57
msgid ""
"Take a C :c:func:`printf`\\ -style *format* string and a variable number of "
"arguments, calculate the size of the resulting Python bytes object and "
"return a bytes object with the values formatted into it. The variable "
"arguments must be C types and must correspond exactly to the format "
"characters in the *format* string. The following format characters are "
"allowed:"
msgstr ""
"接受一个 C :c:func:`printf` 风格的 *format* 字符串和可变数量的参数,计算结果 Python "
"字节串对象的大小并返回参数值经格式化后的字节串对象。可变数量的参数必须均为 C 类型并且必须恰好与 *format* "
"字符串中的格式字符相对应。允许使用下列格式字符:"
#: ../../c-api/bytes.rst:69
msgid "Format Characters"
msgstr "格式字符"
#: ../../c-api/bytes.rst:69
msgid "Type"
msgstr "类型"
#: ../../c-api/bytes.rst:69
msgid "Comment"
msgstr "注释"
#: ../../c-api/bytes.rst:71
msgid "``%%``"
msgstr "``%%``"
#: ../../c-api/bytes.rst:71
msgid "*n/a*"
msgstr "*不适用*"
#: ../../c-api/bytes.rst:71
msgid "The literal % character."
msgstr "文字%字符。"
#: ../../c-api/bytes.rst:73
msgid "``%c``"
msgstr "``%c``"
#: ../../c-api/bytes.rst:73 ../../c-api/bytes.rst:76 ../../c-api/bytes.rst:94
#: ../../c-api/bytes.rst:97
msgid "int"
msgstr "int"
#: ../../c-api/bytes.rst:73
msgid "A single byte, represented as a C int."
msgstr "一个字节,被表示为一个 C int。"
#: ../../c-api/bytes.rst:76
msgid "``%d``"
msgstr "``%d``"
#: ../../c-api/bytes.rst:76
msgid "Equivalent to ``printf(\"%d\")``. [1]_"
msgstr "相当于 ``printf(\"%d\")``。[1]_"
#: ../../c-api/bytes.rst:79
msgid "``%u``"
msgstr "``%u``"
#: ../../c-api/bytes.rst:79
msgid "unsigned int"
msgstr "unsigned int"
#: ../../c-api/bytes.rst:79
msgid "Equivalent to ``printf(\"%u\")``. [1]_"
msgstr "相当于 ``printf(\"%u\")``。[1]_"
#: ../../c-api/bytes.rst:82
msgid "``%ld``"
msgstr "``%ld``"
#: ../../c-api/bytes.rst:82
msgid "long"
msgstr "long"
#: ../../c-api/bytes.rst:82
msgid "Equivalent to ``printf(\"%ld\")``. [1]_"
msgstr "相当于 ``printf(\"%ld\")``。[1]_"
#: ../../c-api/bytes.rst:85
msgid "``%lu``"
msgstr "``%lu``"
#: ../../c-api/bytes.rst:85
msgid "unsigned long"
msgstr "unsigned long"
#: ../../c-api/bytes.rst:85
msgid "Equivalent to ``printf(\"%lu\")``. [1]_"
msgstr "相当于 ``printf(\"%lu\")``。[1]_"
#: ../../c-api/bytes.rst:88
msgid "``%zd``"
msgstr "``%zd``"
#: ../../c-api/bytes.rst:88
msgid ":c:type:`\\ Py_ssize_t`"
msgstr ":c:type:`\\ Py_ssize_t`"
#: ../../c-api/bytes.rst:88
msgid "Equivalent to ``printf(\"%zd\")``. [1]_"
msgstr "相当于 ``printf(\"%zd\")``。[1]_"
#: ../../c-api/bytes.rst:91
msgid "``%zu``"
msgstr "``%zu``"
#: ../../c-api/bytes.rst:91
msgid "size_t"
msgstr "size_t"
#: ../../c-api/bytes.rst:91
msgid "Equivalent to ``printf(\"%zu\")``. [1]_"
msgstr "相当于 ``printf(\"%zu\")``。[1]_"
#: ../../c-api/bytes.rst:94
msgid "``%i``"
msgstr "``%i``"
#: ../../c-api/bytes.rst:94
msgid "Equivalent to ``printf(\"%i\")``. [1]_"
msgstr "相当于 ``printf(\"%i\")``。[1]_"
#: ../../c-api/bytes.rst:97
msgid "``%x``"
msgstr "``%x``"
#: ../../c-api/bytes.rst:97
msgid "Equivalent to ``printf(\"%x\")``. [1]_"
msgstr "相当于 ``printf(\"%x\")``。[1]_"
#: ../../c-api/bytes.rst:100
msgid "``%s``"
msgstr "``%s``"
#: ../../c-api/bytes.rst:100
msgid "const char\\*"
msgstr "const char\\*"
#: ../../c-api/bytes.rst:100
msgid "A null-terminated C character array."
msgstr "以 null 为终止符的 C 字符数组。"
#: ../../c-api/bytes.rst:103
msgid "``%p``"
msgstr "``%p``"
#: ../../c-api/bytes.rst:103
msgid "const void\\*"
msgstr "const void\\*"
#: ../../c-api/bytes.rst:103
msgid ""
"The hex representation of a C pointer. Mostly equivalent to "
"``printf(\"%p\")`` except that it is guaranteed to start with the literal "
"``0x`` regardless of what the platform's ``printf`` yields."
msgstr ""
"一个 C 指针的十六进制表示形式。基本等价于 ``printf(\"%p\")`` 但它会确保以字面值 ``0x`` 开头,不论系统平台上 "
"``printf`` 的输出是什么。"
#: ../../c-api/bytes.rst:112
msgid ""
"An unrecognized format character causes all the rest of the format string to"
" be copied as-is to the result object, and any extra arguments discarded."
msgstr "无法识别的格式字符会导致将格式字符串的其余所有内容原样复制到结果对象,并丢弃所有多余的参数。"
#: ../../c-api/bytes.rst:115
msgid ""
"For integer specifiers (d, u, ld, lu, zd, zu, i, x): the 0-conversion flag "
"has effect even when a precision is given."
msgstr "对于整数说明符(d,u,ld,lu,zd,zu,i,x):当给出精度时,0 转换标志是有效的。"
#: ../../c-api/bytes.rst:121
msgid ""
"Identical to :c:func:`PyBytes_FromFormat` except that it takes exactly two "
"arguments."
msgstr "与 :c:func:`PyBytes_FromFormat` 完全相同,除了它需要两个参数。"
#: ../../c-api/bytes.rst:127
msgid ""
"Return the bytes representation of object *o* that implements the buffer "
"protocol."
msgstr "返回实现了缓冲区协议的对象 *o* 的字节串表示形式。"
#: ../../c-api/bytes.rst:131
msgid ""
"If the object implements the buffer protocol, then the buffer must not be "
"mutated while the bytes object is being created."
msgstr ""
#: ../../c-api/bytes.rst:137
msgid "Return the length of the bytes in bytes object *o*."
msgstr "返回字节串对象 *o* 中字节的长度。"
#: ../../c-api/bytes.rst:142
msgid "Similar to :c:func:`PyBytes_Size`, but without error checking."
msgstr "类似于 :c:func:`PyBytes_Size`,但是不带错误检测。"
#: ../../c-api/bytes.rst:147
msgid ""
"Return a pointer to the contents of *o*. The pointer refers to the internal"
" buffer of *o*, which consists of ``len(o) + 1`` bytes. The last byte in "
"the buffer is always null, regardless of whether there are any other null "
"bytes. The data must not be modified in any way, unless the object was just"
" created using ``PyBytes_FromStringAndSize(NULL, size)``. It must not be "
"deallocated. If *o* is not a bytes object at all, "
":c:func:`PyBytes_AsString` returns ``NULL`` and raises :exc:`TypeError`."
msgstr ""
"返回对应 *o* 的内容的指针。该指针指向 *o* 的内部缓冲区,其中包含 ``len(o) + 1`` "
"个字节。缓冲区的最后一个字节总是为空,不论是否存在其他空字节。该数据不可通过任何形式来修改,除非是刚使用 "
"``PyBytes_FromStringAndSize(NULL, size)`` 创建该对象。它不可被撤销分配。如果 *o* "
"根本不是一个字节串对象,则 :c:func:`PyBytes_AsString` 将返回 ``NULL`` 并引发 :exc:`TypeError`。"
#: ../../c-api/bytes.rst:159
msgid "Similar to :c:func:`PyBytes_AsString`, but without error checking."
msgstr "类似于 :c:func:`PyBytes_AsString`,但是不带错误检测。"
#: ../../c-api/bytes.rst:164
msgid ""
"Return the null-terminated contents of the object *obj* through the output "
"variables *buffer* and *length*. Returns ``0`` on success."
msgstr "通过输出变量 *buffer* 和 *length* 返回对象 *obj* 以空值作为结束的内容。成功时返回 ``0``。"
#: ../../c-api/bytes.rst:168
msgid ""
"If *length* is ``NULL``, the bytes object may not contain embedded null "
"bytes; if it does, the function returns ``-1`` and a :exc:`ValueError` is "
"raised."
msgstr ""
"如果 *length* 为 ``NULL``,字节串对象不可包含嵌入的空字节;如果包含,则该函数将返回 ``-1`` 并引发 "
":exc:`ValueError` 异常。"
#: ../../c-api/bytes.rst:172
msgid ""
"The buffer refers to an internal buffer of *obj*, which includes an "
"additional null byte at the end (not counted in *length*). The data must "
"not be modified in any way, unless the object was just created using "
"``PyBytes_FromStringAndSize(NULL, size)``. It must not be deallocated. If "
"*obj* is not a bytes object at all, :c:func:`PyBytes_AsStringAndSize` "
"returns ``-1`` and raises :exc:`TypeError`."
msgstr ""
"该缓冲区指向 *obj* 的内部缓冲,它的末尾包含一个额外的空字节(不算在 *length* 当中)。该数据不可通过任何方式来修改,除非是刚使用 "
"``PyBytes_FromStringAndSize(NULL, size)`` 创建该对象。它不可被撤销分配。如果 *obj* "
"根本不是一个字节串对象,则 :c:func:`PyBytes_AsStringAndSize` 将返回 ``-1`` 并引发 "
":exc:`TypeError` 异常。"
#: ../../c-api/bytes.rst:179
msgid ""
"Previously, :exc:`TypeError` was raised when embedded null bytes were "
"encountered in the bytes object."
msgstr "以前,当字节串对象中出现嵌入的空字节时将引发 :exc:`TypeError`。"
#: ../../c-api/bytes.rst:186
msgid ""
"Create a new bytes object in *\\*bytes* containing the contents of *newpart*"
" appended to *bytes*; the caller will own the new reference. The reference "
"to the old value of *bytes* will be stolen. If the new object cannot be "
"created, the old reference to *bytes* will still be discarded and the value "
"of *\\*bytes* will be set to ``NULL``; the appropriate exception will be "
"set."
msgstr ""
"在 *\\*bytes* 中创建新的字节串对象,其中包含添加到 *bytes* 的 *newpart* 的内容;调用者将获得新的引用。对 *bytes*"
" 原值的引用将被收回。如果无法创建新对象,对 *bytes* 的旧引用仍将被丢弃且 *\\*bytes* 的值将被设为 "
"``NULL``;并将设置适当的异常。"
#: ../../c-api/bytes.rst:193 ../../c-api/bytes.rst:203
msgid ""
"If *newpart* implements the buffer protocol, then the buffer must not be "
"mutated while the new bytes object is being created."
msgstr ""
#: ../../c-api/bytes.rst:198
msgid ""
"Create a new bytes object in *\\*bytes* containing the contents of *newpart*"
" appended to *bytes*. This version releases the :term:`strong reference` to"
" *newpart* (i.e. decrements its reference count)."
msgstr ""
"在 *\\*bytes* 中创建一个新的字节串对象,其中包含添加到 *bytes* 的 *newpart* 的内容。此版本将释放对 *newpart* "
"的 :term:`strong reference` (即递减其引用计数)。"
#: ../../c-api/bytes.rst:209
msgid "Similar to ``sep.join(iterable)`` in Python."
msgstr "类似于 Python 中的 ``sep.join(iterable)``。"
#: ../../c-api/bytes.rst:211
msgid ""
"*sep* must be Python :class:`bytes` object. (Note that "
":c:func:`PyUnicode_Join` accepts ``NULL`` separator and treats it as a "
"space, whereas :c:func:`PyBytes_Join` doesn't accept ``NULL`` separator.)"
msgstr ""
"*sep* 必须为 Python :class:`bytes` 对象。 (请注意 :c:func:`PyUnicode_Join` 接受 "
"``NULL`` 分隔符并会将其视为空格,而 :c:func:`PyBytes_Join` 则不接受 ``NULL`` 分隔符。)"
#: ../../c-api/bytes.rst:216
msgid ""
"*iterable* must be an iterable object yielding objects that implement the "
":ref:`buffer protocol <bufferobjects>`."
msgstr "*iterable* 必须是一个产生实现了 :ref:`缓冲区协议 <bufferobjects>` 的对象的可迭代对象。"
#: ../../c-api/bytes.rst:219
msgid ""
"On success, return a new :class:`bytes` object. On error, set an exception "
"and return ``NULL``."
msgstr "成功时,返回一个新的 :class:`bytes` 对象。失败时,设置一个异常并返回 ``NULL``。"
#: ../../c-api/bytes.rst:225
msgid ""
"If *iterable* objects implement the buffer protocol, then the buffers must "
"not be mutated while the new bytes object is being created."
msgstr ""
#: ../../c-api/bytes.rst:230
msgid ""
"Resize a bytes object. *newsize* will be the new length of the bytes object."
" You can think of it as creating a new bytes object and destroying the old "
"one, only more efficiently. Pass the address of an existing bytes object as "
"an lvalue (it may be written into), and the new size desired. On success, "
"*\\*bytes* holds the resized bytes object and ``0`` is returned; the address"
" in *\\*bytes* may differ from its input value. If the reallocation fails, "
"the original bytes object at *\\*bytes* is deallocated, *\\*bytes* is set to"
" ``NULL``, :exc:`MemoryError` is set, and ``-1`` is returned."
msgstr ""
"改变字节串对象的大小。*newsize* "
"将为字节串对象的新长度。你可以将它当作是创建一个新的字节串对象并销毁旧的对象,但是更为高效。传入一个现有字节串对象的地址作为 "
"lvalue(它可以被写入),以及想要的新大小。当成功时,*\\*bytes* 将存放改变大小后的字节串对象并返回 ``0``;*\\*bytes* "
"中的地址可能与其输入值不同。如果重新分配失败,则位于 *\\*bytes* 的原始字节串对象将被释放,*\\*bytes* 将被设为 "
"``NULL``,同时设置 :exc:`MemoryError`,然后返回 ``-1``。"
#: ../../c-api/bytes.rst:241
msgid "Use the :c:type:`PyBytesWriter` API instead."
msgstr ""
#: ../../c-api/bytes.rst:247
msgid ""
"Get the string representation of *bytes*. This function is currently used to"
" implement :meth:`!bytes.__repr__` in Python."
msgstr "获取 *bytes* 的字符串表示形式。此函数目前被用于实现 Python 中的 :meth:`!bytes.__repr__`。"
#: ../../c-api/bytes.rst:250
msgid ""
"This function does not do type checking; it is undefined behavior to pass "
"*bytes* as a non-bytes object or ``NULL``."
msgstr "此函数不会进行类型检测;向 *bytes* 传入非字节对象或 ``NULL`` 是未定义的行为。"
#: ../../c-api/bytes.rst:253
msgid ""
"If *smartquotes* is true, the representation will use a double-quoted string"
" instead of single-quoted string when single-quotes are present in *bytes*. "
"For example, the byte string ``'Python'`` would be represented as "
"``b\"'Python'\"`` when *smartquotes* is true, or ``b'\\'Python\\''`` when it"
" is false."
msgstr ""
"如果 *smartquotes* 为真值,表示形式将在 *bytes* 中存在单引号时使用带双引号的字符串而不是带单引号的字符串。例如,当 "
"*smartquotes* 为真值时字节串 ``'Python'`` 将被表示为 ``b\"'Python'\"``,当其为假值时则为 "
"``b'\\'Python\\''`` 这种形式。"
#: ../../c-api/bytes.rst:259
msgid ""
"On success, this function returns a :term:`strong reference` to a "
":class:`str` object containing the representation. On failure, this returns "
"``NULL`` with an exception set."
msgstr ""
"成功时,此函数将返回一个指向包含该表示形式的 :class:`str` 对象的 :term:`strong reference`。失败时,此函数将返回 "
"``NULL`` 并设置一个异常。"
#: ../../c-api/bytes.rst:266
msgid ""
"Unescape a backslash-escaped string *s*. *s* must not be ``NULL``. *len* "
"must be the size of *s*."
msgstr "取消带反斜杠转义的字符串 *s* 的转义。 *s* 必须不为 ``NULL``。 *len* 必须为 *s* 的长度。"
#: ../../c-api/bytes.rst:269
msgid ""
"*errors* must be one of ``\"strict\"``, ``\"replace\"``, or ``\"ignore\"``. "
"If *errors* is ``NULL``, then ``\"strict\"`` is used by default."
msgstr ""
"*errors* 必须为 ``\"strict\"``, ``\"replace\"`` 或 ``\"ignore\"`` 之一。如果 *errors*"
" 为 ``NULL``,则默认使用 ``\"strict\"``。"
#: ../../c-api/bytes.rst:272
msgid ""
"On success, this function returns a :term:`strong reference` to a Python "
":class:`bytes` object containing the unescaped string. On failure, this "
"function returns ``NULL`` with an exception set."
msgstr ""
"成功时,此函数将返回一个指向包含未转义文本的 Python :class:`bytes` 对象的 :term:`strong reference`。 "
"失败时,此函数将返回 ``NULL`` 并设置一个异常。"
#: ../../c-api/bytes.rst:276
msgid "*unicode* and *recode_encoding* are now unused."
msgstr "*unicode* 和 *recode_encoding* 现在未被使用。"
#: ../../c-api/bytes.rst:283
msgid "PyBytesWriter"
msgstr "PyBytesWriter"
#: ../../c-api/bytes.rst:285
msgid ""
"The :c:type:`PyBytesWriter` API can be used to create a Python "
":class:`bytes` object."
msgstr ""
#: ../../c-api/bytes.rst:292
msgid "A bytes writer instance."
msgstr ""
#: ../../c-api/bytes.rst:294
msgid ""
"The API is **not thread safe**: a writer should only be used by a single "
"thread at the same time."
msgstr ""
#: ../../c-api/bytes.rst:297
msgid ""
"The instance must be destroyed by :c:func:`PyBytesWriter_Finish` on success,"
" or :c:func:`PyBytesWriter_Discard` on error."
msgstr ""
#: ../../c-api/bytes.rst:302
msgid "Create, Finish, Discard"
msgstr ""
#: ../../c-api/bytes.rst:306
msgid "Create a :c:type:`PyBytesWriter` to write *size* bytes."
msgstr ""
#: ../../c-api/bytes.rst:308
msgid ""
"If *size* is greater than zero, allocate *size* bytes, and set the writer "
"size to *size*. The caller is responsible to write *size* bytes using "
":c:func:`PyBytesWriter_GetData`. This function does not overallocate."
msgstr ""
#: ../../c-api/bytes.rst:313 ../../c-api/bytes.rst:438
msgid "On error, set an exception and return ``NULL``."
msgstr "发生错误时,将设置异常并返回 ``NULL``。"
#: ../../c-api/bytes.rst:315 ../../c-api/bytes.rst:414
msgid "*size* must be positive or zero."
msgstr ""
#: ../../c-api/bytes.rst:319
msgid ""
"Finish a :c:type:`PyBytesWriter` created by :c:func:`PyBytesWriter_Create`."
msgstr ""
#: ../../c-api/bytes.rst:322
msgid ""
"On success, return a Python :class:`bytes` object. On error, set an "
"exception and return ``NULL``."
msgstr ""
#: ../../c-api/bytes.rst:325
msgid ""
"The writer instance is invalid after the call in any case. No API can be "
"called on the writer after :c:func:`PyBytesWriter_Finish`."
msgstr ""
#: ../../c-api/bytes.rst:330
msgid ""
"Similar to :c:func:`PyBytesWriter_Finish`, but resize the writer to *size* "
"bytes before creating the :class:`bytes` object."
msgstr ""
#: ../../c-api/bytes.rst:335
msgid ""
"Similar to :c:func:`PyBytesWriter_Finish`, but resize the writer using *buf*"
" pointer before creating the :class:`bytes` object."
msgstr ""
#: ../../c-api/bytes.rst:338
msgid ""
"Set an exception and return ``NULL`` if *buf* pointer is outside the "
"internal buffer bounds."
msgstr ""
#: ../../c-api/bytes.rst:341 ../../c-api/bytes.rst:442
msgid "Function pseudo-code::"
msgstr ""
#: ../../c-api/bytes.rst:343
msgid ""
"Py_ssize_t size = (char*)buf - (char*)PyBytesWriter_GetData(writer);\n"
"return PyBytesWriter_FinishWithSize(writer, size);"
msgstr ""
#: ../../c-api/bytes.rst:348
msgid ""
"Discard a :c:type:`PyBytesWriter` created by :c:func:`PyBytesWriter_Create`."
msgstr ""
#: ../../c-api/bytes.rst:350
msgid "Do nothing if *writer* is ``NULL``."
msgstr ""
#: ../../c-api/bytes.rst:352
msgid ""
"The writer instance is invalid after the call. No API can be called on the "
"writer after :c:func:`PyBytesWriter_Discard`."
msgstr ""
#: ../../c-api/bytes.rst:356
msgid "High-level API"
msgstr "高阶 API"
#: ../../c-api/bytes.rst:360
msgid ""
"Grow the *writer* internal buffer by *size* bytes, write *size* bytes of "
"*bytes* at the *writer* end, and add *size* to the *writer* size."
msgstr ""
#: ../../c-api/bytes.rst:364
msgid ""
"If *size* is equal to ``-1``, call ``strlen(bytes)`` to get the string "
"length."
msgstr ""
#: ../../c-api/bytes.rst:367 ../../c-api/bytes.rst:376
#: ../../c-api/bytes.rst:411 ../../c-api/bytes.rst:424
msgid ""
"On success, return ``0``. On error, set an exception and return ``-1``."
msgstr "如果成功,返回 ``0``。如果发生错误,设置异常并返回 ``-1``。"
#: ../../c-api/bytes.rst:372
msgid ""
"Similar to :c:func:`PyBytes_FromFormat`, but write the output directly at "
"the writer end. Grow the writer internal buffer on demand. Then add the "
"written size to the writer size."
msgstr ""
#: ../../c-api/bytes.rst:381
msgid "Getters"
msgstr ""
#: ../../c-api/bytes.rst:385
msgid "Get the writer size."
msgstr ""
#: ../../c-api/bytes.rst:387 ../../c-api/bytes.rst:396
msgid "The function cannot fail."
msgstr ""
#: ../../c-api/bytes.rst:391
msgid "Get the writer data: start of the internal buffer."
msgstr ""
#: ../../c-api/bytes.rst:393
msgid ""
"The pointer is valid until :c:func:`PyBytesWriter_Finish` or "
":c:func:`PyBytesWriter_Discard` is called on *writer*."
msgstr ""
#: ../../c-api/bytes.rst:400
msgid "Low-level API"
msgstr "底层级 API"
#: ../../c-api/bytes.rst:404
msgid ""
"Resize the writer to *size* bytes. It can be used to enlarge or to shrink "
"the writer. This function typically overallocates to achieve amortized "
"performance when resizing multiple times."
msgstr ""
#: ../../c-api/bytes.rst:409 ../../c-api/bytes.rst:422
msgid "Newly allocated bytes are left uninitialized."
msgstr ""
#: ../../c-api/bytes.rst:418
msgid ""
"Resize the writer by adding *grow* bytes to the current writer size. This "
"function typically overallocates to achieve amortized performance when "
"resizing multiple times."
msgstr ""
#: ../../c-api/bytes.rst:427
msgid "*size* can be negative to shrink the writer."
msgstr ""
#: ../../c-api/bytes.rst:431
msgid ""
"Similar to :c:func:`PyBytesWriter_Grow`, but update also the *buf* pointer."
msgstr ""
#: ../../c-api/bytes.rst:434
msgid ""
"The *buf* pointer is moved if the internal buffer is moved in memory. The "
"*buf* relative position within the internal buffer is left unchanged."
msgstr ""
#: ../../c-api/bytes.rst:440
msgid "*buf* must not be ``NULL``."
msgstr ""
#: ../../c-api/bytes.rst:444
msgid ""
"Py_ssize_t pos = (char*)buf - (char*)PyBytesWriter_GetData(writer);\n"
"if (PyBytesWriter_Grow(writer, size) < 0) {\n"
" return NULL;\n"
"}\n"
"return (char*)PyBytesWriter_GetData(writer) + pos;"
msgstr ""
#: ../../c-api/bytes.rst:11
msgid "object"
msgstr "object -- 对象"
#: ../../c-api/bytes.rst:11
msgid "bytes"
msgstr "字节串"