Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync with CPython 3.12 #625

Merged
merged 18 commits into from
Oct 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
92 changes: 45 additions & 47 deletions c-api/dict.po
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Python 3.12\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-08-26 00:03+0000\n"
"POT-Creation-Date: 2023-09-03 00:03+0000\n"
"PO-Revision-Date: 2017-09-22 18:26+0000\n"
"Last-Translator: Liang-Bo Wang <me@liang2.tw>\n"
"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-"
Expand Down Expand Up @@ -87,71 +87,70 @@ msgid ""
"to *val*."
msgstr ""

#: ../../c-api/dict.rst:75
#: ../../c-api/dict.rst:73
msgid ""
"Insert *val* into the dictionary *p* using *key* as a key. *key* should be "
"a :c:expr:`const char*` UTF-8 encoded bytes string. The key object is "
"created using ``PyUnicode_FromString(key)``. Return ``0`` on success or "
"``-1`` on failure. This function *does not* steal a reference to *val*."
"This is the same as :c:func:`PyDict_SetItem`, but *key* is specified as a :c:"
"expr:`const char*` UTF-8 encoded bytes string, rather than a :c:expr:"
"`PyObject*`."
msgstr ""

#: ../../c-api/dict.rst:83
#: ../../c-api/dict.rst:80
msgid ""
"Remove the entry in dictionary *p* with key *key*. *key* must be :term:"
"`hashable`; if it isn't, :exc:`TypeError` is raised. If *key* is not in the "
"dictionary, :exc:`KeyError` is raised. Return ``0`` on success or ``-1`` on "
"failure."
msgstr ""

#: ../../c-api/dict.rst:91
#: ../../c-api/dict.rst:88
msgid ""
"Remove the entry in dictionary *p* which has a key specified by the UTF-8 "
"encoded bytes string *key*. If *key* is not in the dictionary, :exc:"
"`KeyError` is raised. Return ``0`` on success or ``-1`` on failure."
"This is the same as :c:func:`PyDict_DelItem`, but *key* is specified as a :c:"
"expr:`const char*` UTF-8 encoded bytes string, rather than a :c:expr:"
"`PyObject*`."
msgstr ""

#: ../../c-api/dict.rst:99
#: ../../c-api/dict.rst:95
msgid ""
"Return the object from dictionary *p* which has a key *key*. Return "
"``NULL`` if the key *key* is not present, but *without* setting an exception."
msgstr ""

#: ../../c-api/dict.rst:104
#: ../../c-api/dict.rst:100
msgid ""
"Exceptions that occur while this calls :meth:`~object.__hash__` and :meth:"
"`~object.__eq__` methods are silently ignored. Prefer the :c:func:"
"`PyDict_GetItemWithError` function instead."
msgstr ""

#: ../../c-api/dict.rst:108
#: ../../c-api/dict.rst:104
msgid ""
"Calling this API without :term:`GIL` held had been allowed for historical "
"reason. It is no longer allowed."
msgstr ""

#: ../../c-api/dict.rst:115
#: ../../c-api/dict.rst:111
msgid ""
"Variant of :c:func:`PyDict_GetItem` that does not suppress exceptions. "
"Return ``NULL`` **with** an exception set if an exception occurred. Return "
"``NULL`` **without** an exception set if the key wasn't present."
msgstr ""

#: ../../c-api/dict.rst:123
#: ../../c-api/dict.rst:119
msgid ""
"This is the same as :c:func:`PyDict_GetItem`, but *key* is specified as a :c:"
"expr:`const char*` UTF-8 encoded bytes string, rather than a :c:expr:"
"`PyObject*`."
msgstr ""

#: ../../c-api/dict.rst:129
#: ../../c-api/dict.rst:125
msgid ""
"Exceptions that occur while this calls :meth:`~object.__hash__` and :meth:"
"`~object.__eq__` methods or while creating the temporary :class:`str` object "
"are silently ignored. Prefer using the :c:func:`PyDict_GetItemWithError` "
"function with your own :c:func:`PyUnicode_FromString` *key* instead."
msgstr ""

#: ../../c-api/dict.rst:138
#: ../../c-api/dict.rst:134
msgid ""
"This is the same as the Python-level :meth:`dict.setdefault`. If present, "
"it returns the value corresponding to *key* from the dictionary *p*. If the "
Expand All @@ -161,29 +160,29 @@ msgid ""
"the insertion."
msgstr ""

#: ../../c-api/dict.rst:148
#: ../../c-api/dict.rst:144
msgid ""
"Return a :c:type:`PyListObject` containing all the items from the dictionary."
msgstr ""

#: ../../c-api/dict.rst:153
#: ../../c-api/dict.rst:149
msgid ""
"Return a :c:type:`PyListObject` containing all the keys from the dictionary."
msgstr ""

#: ../../c-api/dict.rst:158
#: ../../c-api/dict.rst:154
msgid ""
"Return a :c:type:`PyListObject` containing all the values from the "
"dictionary *p*."
msgstr ""

#: ../../c-api/dict.rst:166
#: ../../c-api/dict.rst:162
msgid ""
"Return the number of items in the dictionary. This is equivalent to "
"``len(p)`` on a dictionary."
msgstr ""

#: ../../c-api/dict.rst:172
#: ../../c-api/dict.rst:168
msgid ""
"Iterate over all key-value pairs in the dictionary *p*. The :c:type:"
"`Py_ssize_t` referred to by *ppos* must be initialized to ``0`` prior to the "
Expand All @@ -197,21 +196,21 @@ msgid ""
"structure is sparse, the offsets are not consecutive."
msgstr ""

#: ../../c-api/dict.rst:183
#: ../../c-api/dict.rst:179
msgid "For example::"
msgstr ""
"舉例來說:\n"
"\n"
"::"

#: ../../c-api/dict.rst:193
#: ../../c-api/dict.rst:189
msgid ""
"The dictionary *p* should not be mutated during iteration. It is safe to "
"modify the values of the keys as you iterate over the dictionary, but only "
"so long as the set of keys does not change. For example::"
msgstr ""

#: ../../c-api/dict.rst:218
#: ../../c-api/dict.rst:214
msgid ""
"Iterate over mapping object *b* adding key-value pairs to dictionary *a*. "
"*b* may be a dictionary, or any object supporting :c:func:`PyMapping_Keys` "
Expand All @@ -221,7 +220,7 @@ msgid ""
"or ``-1`` if an exception was raised."
msgstr ""

#: ../../c-api/dict.rst:228
#: ../../c-api/dict.rst:224
msgid ""
"This is the same as ``PyDict_Merge(a, b, 1)`` in C, and is similar to ``a."
"update(b)`` in Python except that :c:func:`PyDict_Update` doesn't fall back "
Expand All @@ -230,7 +229,7 @@ msgid ""
"exception was raised."
msgstr ""

#: ../../c-api/dict.rst:237
#: ../../c-api/dict.rst:233
msgid ""
"Update or merge into dictionary *a*, from the key-value pairs in *seq2*. "
"*seq2* must be an iterable object producing iterable objects of length 2, "
Expand All @@ -239,49 +238,49 @@ msgid ""
"if an exception was raised. Equivalent Python (except for the return value)::"
msgstr ""

#: ../../c-api/dict.rst:251
#: ../../c-api/dict.rst:247
msgid ""
"Register *callback* as a dictionary watcher. Return a non-negative integer "
"id which must be passed to future calls to :c:func:`PyDict_Watch`. In case "
"of error (e.g. no more watcher IDs available), return ``-1`` and set an "
"exception."
msgstr ""

#: ../../c-api/dict.rst:260
#: ../../c-api/dict.rst:256
msgid ""
"Clear watcher identified by *watcher_id* previously returned from :c:func:"
"`PyDict_AddWatcher`. Return ``0`` on success, ``-1`` on error (e.g. if the "
"given *watcher_id* was never registered.)"
msgstr ""

#: ../../c-api/dict.rst:268
#: ../../c-api/dict.rst:264
msgid ""
"Mark dictionary *dict* as watched. The callback granted *watcher_id* by :c:"
"func:`PyDict_AddWatcher` will be called when *dict* is modified or "
"deallocated. Return ``0`` on success or ``-1`` on error."
msgstr ""

#: ../../c-api/dict.rst:276
#: ../../c-api/dict.rst:272
msgid ""
"Mark dictionary *dict* as no longer watched. The callback granted "
"*watcher_id* by :c:func:`PyDict_AddWatcher` will no longer be called when "
"*dict* is modified or deallocated. The dict must previously have been "
"watched by this watcher. Return ``0`` on success or ``-1`` on error."
msgstr ""

#: ../../c-api/dict.rst:285
#: ../../c-api/dict.rst:281
msgid ""
"Enumeration of possible dictionary watcher events: ``PyDict_EVENT_ADDED``, "
"``PyDict_EVENT_MODIFIED``, ``PyDict_EVENT_DELETED``, "
"``PyDict_EVENT_CLONED``, ``PyDict_EVENT_CLEARED``, or "
"``PyDict_EVENT_DEALLOCATED``."
msgstr ""

#: ../../c-api/dict.rst:293
#: ../../c-api/dict.rst:289
msgid "Type of a dict watcher callback function."
msgstr ""

#: ../../c-api/dict.rst:295
#: ../../c-api/dict.rst:291
msgid ""
"If *event* is ``PyDict_EVENT_CLEARED`` or ``PyDict_EVENT_DEALLOCATED``, both "
"*key* and *new_value* will be ``NULL``. If *event* is ``PyDict_EVENT_ADDED`` "
Expand All @@ -290,22 +289,22 @@ msgid ""
"dictionary and *new_value* will be ``NULL``."
msgstr ""

#: ../../c-api/dict.rst:301
#: ../../c-api/dict.rst:297
msgid ""
"``PyDict_EVENT_CLONED`` occurs when *dict* was previously empty and another "
"dict is merged into it. To maintain efficiency of this operation, per-key "
"``PyDict_EVENT_ADDED`` events are not issued in this case; instead a single "
"``PyDict_EVENT_CLONED`` is issued, and *key* will be the source dictionary."
msgstr ""

#: ../../c-api/dict.rst:307
#: ../../c-api/dict.rst:303
msgid ""
"The callback may inspect but must not modify *dict*; doing so could have "
"unpredictable effects, including infinite recursion. Do not trigger Python "
"code execution in the callback, as it could modify the dict as a side effect."
msgstr ""

#: ../../c-api/dict.rst:311
#: ../../c-api/dict.rst:307
msgid ""
"If *event* is ``PyDict_EVENT_DEALLOCATED``, taking a new reference in the "
"callback to the about-to-be-destroyed dictionary will resurrect it and "
Expand All @@ -314,20 +313,20 @@ msgid ""
"again."
msgstr ""

#: ../../c-api/dict.rst:317
#: ../../c-api/dict.rst:313
msgid ""
"Callbacks occur before the notified modification to *dict* takes place, so "
"the prior state of *dict* can be inspected."
msgstr ""

#: ../../c-api/dict.rst:320
#: ../../c-api/dict.rst:316
msgid ""
"If the callback sets an exception, it must return ``-1``; this exception "
"will be printed as an unraisable exception using :c:func:"
"`PyErr_WriteUnraisable`. Otherwise it should return ``0``."
msgstr ""

#: ../../c-api/dict.rst:324
#: ../../c-api/dict.rst:320
msgid ""
"There may already be a pending exception set on entry to the callback. In "
"this case, the callback should return ``0`` with the same exception still "
Expand All @@ -344,14 +343,13 @@ msgstr "object(物件)"
msgid "dictionary"
msgstr "dictionary(字典)"

#: ../../c-api/dict.rst:73
msgid "PyUnicode_FromString()"
msgstr "PyUnicode_FromString()"

#: ../../c-api/dict.rst:164
#: ../../c-api/dict.rst:160
msgid "built-in function"
msgstr "built-in function(內建函式)"

#: ../../c-api/dict.rst:164
#: ../../c-api/dict.rst:160
msgid "len"
msgstr "len"

#~ msgid "PyUnicode_FromString()"
#~ msgstr "PyUnicode_FromString()"
Loading
Loading