@@ -13,7 +13,7 @@ msgid ""
1313msgstr ""
1414"Project-Id-Version : Python 3.15\n "
1515"Report-Msgid-Bugs-To : \n "
16- "POT-Creation-Date : 2026-10-23 18:01 +0000\n "
16+ "POT-Creation-Date : 2026-10-25 17:19 +0000\n "
1717"PO-Revision-Date : 2025-09-16 00:01+0000\n "
1818"Last-Translator : Inada Naoki <songofacandy@gmail.com>, 2026\n "
1919"Language-Team : Japanese (https://app.transifex.com/python-doc/teams/5390/ "
@@ -175,11 +175,11 @@ msgid ""
175175"view object. The :meth:`!setdefault` method requires two arguments."
176176msgstr ""
177177
178- #: ../../library/dbm.rst:101
179178msgid ""
180179"Key and values are always stored as :class:`bytes`. This means that when "
181180"strings are used they are implicitly converted to the default encoding "
182- "before being stored."
181+ "before being stored. For detailed information about accepted types, see :ref:"
182+ "`dbm-key-value-types`."
183183msgstr ""
184184
185185#: ../../library/dbm.rst:105
@@ -212,6 +212,77 @@ msgstr ""
212212msgid ":meth:`!clear` methods are now available for all :mod:`!dbm` backends."
213213msgstr ""
214214
215+ msgid "Key and value types"
216+ msgstr ""
217+
218+ msgid ""
219+ "The accepted types for keys and values vary by backend. Keys and values are "
220+ "handled the same way, except where noted below:"
221+ msgstr ""
222+
223+ msgid "**Traditional backends:**"
224+ msgstr ""
225+
226+ msgid ""
227+ ":mod:`dbm.gnu` and :mod:`dbm.ndbm`: Accept :class:`str` and :class:`bytes` "
228+ "objects."
229+ msgstr ""
230+
231+ msgid ""
232+ ":mod:`dbm.dumb`: Accepts :class:`str` and :class:`bytes` objects; :class:"
233+ "`bytearray` is acceptable as a value, but not as a key."
234+ msgstr ""
235+
236+ msgid ""
237+ "**SQLite backend** (:mod:`dbm.sqlite3`): Accepts :class:`str`, :class:"
238+ "`bytes`, :class:`int`, :class:`float`, :class:`bool`, :class:`bytearray`, :"
239+ "class:`memoryview`, and :class:`array.array` objects."
240+ msgstr ""
241+
242+ msgid "**Storage format:**"
243+ msgstr ""
244+
245+ msgid ""
246+ "All keys and values are stored as :class:`bytes` objects in the database. "
247+ "When retrieving, you'll always get bytes back, regardless of the original "
248+ "type stored."
249+ msgstr ""
250+
251+ msgid "**Type conversion examples:**"
252+ msgstr ""
253+
254+ msgid "``db['key'] = 'string'`` stored as ``b'string'``"
255+ msgstr ""
256+
257+ msgid ""
258+ "``db['key'] = bytearray(b'data')`` stored as ``b'data'`` (:mod:`dbm.dumb` "
259+ "and :mod:`dbm.sqlite3` only)"
260+ msgstr ""
261+
262+ msgid "``db['key'] = 42`` stored as ``b'42'`` (:mod:`dbm.sqlite3` only)"
263+ msgstr ""
264+
265+ msgid "``db['key'] = 3.14`` stored as ``b'3.14'`` (:mod:`dbm.sqlite3` only)"
266+ msgstr ""
267+
268+ msgid "``db['key'] = True`` stored as ``b'1'`` (:mod:`dbm.sqlite3` only)"
269+ msgstr ""
270+
271+ msgid "``db['key'] = False`` stored as ``b'0'`` (:mod:`dbm.sqlite3` only)"
272+ msgstr ""
273+
274+ msgid ""
275+ "``db['key'] = memoryview(b'data')`` stored as ``b'data'`` (:mod:`dbm."
276+ "sqlite3` only)"
277+ msgstr ""
278+
279+ msgid ""
280+ "``db['key'] = array.array('i', [1, 2, 3])`` stored as bytes (for example, on "
281+ "little-endian: "
282+ "``b'\\ x01\\ x00\\ x00\\ x00\\ x02\\ x00\\ x00\\ x00\\ x03\\ x00\\ x00\\ x00'``) (:mod:"
283+ "`dbm.sqlite3` only)"
284+ msgstr ""
285+
215286#: ../../library/dbm.rst:124
216287msgid ""
217288"The following example records some hostnames and a corresponding title, and "
@@ -220,7 +291,6 @@ msgstr ""
220291"以下の例ではホスト名と対応するタイトルをいくつか記録し、データベースの内容を"
221292"出力します::"
222293
223- #: ../../library/dbm.rst:127
224294msgid ""
225295"import dbm\n"
226296"\n"
@@ -240,8 +310,9 @@ msgid ""
240310" # Often-used methods of the dict interface work too.\n"
241311" print(db.get('python.org', b'not present'))\n"
242312"\n"
243- " # Storing a non-string key or value will raise an exception (most\n"
244- " # likely a TypeError).\n"
313+ " # Storing a non-string key or value behavior depends on the backend:\n"
314+ " # - Traditional backends (ndbm, gnu, dumb) will raise a TypeError\n"
315+ " # - The sqlite3 backend accepts it and converts to bytes\n"
245316" db['www.yahoo.com'] = 4\n"
246317"\n"
247318"# db is automatically closed when leaving the with statement."
0 commit comments