Title: `dbm.dumb.reorganize()` can cause data loss after reopening · Issue #155869 · python/cpython · GitHub
Open Graph Title: `dbm.dumb.reorganize()` can cause data loss after reopening · Issue #155869 · python/cpython
X Title: `dbm.dumb.reorganize()` can cause data loss after reopening · Issue #155869 · python/cpython
Description: Bug report Bug description: Repro script: import dbm.dumb import pathlib import tempfile with tempfile.TemporaryDirectory() as tmpdir: path = pathlib.Path(tmpdir) / "database" with dbm.dumb.open(path, "n") as db: db[b"deleted"] = b"x" db...
Open Graph Description: Bug report Bug description: Repro script: import dbm.dumb import pathlib import tempfile with tempfile.TemporaryDirectory() as tmpdir: path = pathlib.Path(tmpdir) / "database" with dbm.dumb.open(pa...
X Description: Bug report Bug description: Repro script: import dbm.dumb import pathlib import tempfile with tempfile.TemporaryDirectory() as tmpdir: path = pathlib.Path(tmpdir) / "database" with dbm.du...
Opengraph URL: https://github.com/python/cpython/issues/155869
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"`dbm.dumb.reorganize()` can cause data loss after reopening","articleBody":"# Bug report\n\n### Bug description:\n\nRepro script:\n\n```\nimport dbm.dumb\nimport pathlib\nimport tempfile\n\nwith tempfile.TemporaryDirectory() as tmpdir:\n path = pathlib.Path(tmpdir) / \"database\"\n\n with dbm.dumb.open(path, \"n\") as db:\n db[b\"deleted\"] = b\"x\"\n db[b\"retained\"] = b\"value\"\n del db[b\"deleted\"]\n\n db.reorganize()\n print(\"before reopening:\", db[b\"retained\"])\n\n with dbm.dumb.open(path, \"r\") as db:\n print(\"after reopening: \", db[b\"retained\"])\n assert db[b\"retained\"] == b\"value\"\n\n```\n\nIf `reorganize()` moves the value, it doesn't persist its new offset. The database works until it's closed and opened again. Then the bad offset is loaded from disk.\n\n### CPython versions tested on:\n\nCPython main branch, 3.15\n\n### Operating systems tested on:\n\nmacOS\n\n\u003c!-- gh-linked-prs -->\n### Linked PRs\n* gh-155872\n* gh-155874\n\u003c!-- /gh-linked-prs -->\n","author":{"url":"https://github.com/lkk7","@type":"Person","name":"lkk7"},"datePublished":"2026-08-15T19:52:18Z","url":"https://github.com/python/cpython/issues/155869"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:9c7789eb-88e5-bd82-9a14-eb20d0de8247 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9248:62F48:1622AFC:1D19C04:6B0231BE |
| html-safe-nonce | a7b895106609eba798dc1d0ba911c63ac8c88503b3e7d3564b4130dc35185660 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5MjQ4OjYyRjQ4OjE2MjJBRkM6MUQxOUMwNDo2QjAyMzFCRSIsInZpc2l0b3JfaWQiOiIxNDg0ODczMTc2NDUzMzYyMTEwIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | f2e3b7956cd73f3b227be16ce1d988f8116009942d756676c26b4a8803dd547a |
| hovercard-subject-tag | issue:5161057853 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/cpython/155869/issue_layout |
| twitter:image | https://opengraph.githubassets.com/dd553c8e5fb5877c535ae7386096e1df53d3004ff707248fcf25721e27ecfc09/python/cpython/issues/155869 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/dd553c8e5fb5877c535ae7386096e1df53d3004ff707248fcf25721e27ecfc09/python/cpython/issues/155869 |
| og:image:alt | Bug report Bug description: Repro script: import dbm.dumb import pathlib import tempfile with tempfile.TemporaryDirectory() as tmpdir: path = pathlib.Path(tmpdir) / "database" with dbm.dumb.open(pa... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | lkk7 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456 |
| turbo-cache-control | no-preview |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 423dbb54c5e7bfecc838eb387c1435eb3d0e760d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width