shelve returns the rejected value after a failed assignment · Issue #163192 · python/cpython
Repository navigation
shelve returns the rejected value after a failed assignment #163192
New issue
New issue
Backlog
Backlog
shelve returns the rejected value after a failed assignment #163192 Labels
stdlib
type-bug
Description
@tonghuaroot's profile tonghuaroot opened on Dec 5, 2026Bug report
with writeback enabled, assigning an unpicklable value raises an exception, but reading the same key returns that value.
import shelve
with shelve.Shelf({}, writeback=True) as db:
original = []
db['key'] = original
try:
db['key'] = memoryview(b'')
except TypeError:
pass
actual = db['key']
del db['key']
assert actual is original
CPython versions tested on:
3.16
Operating systems tested on:
macOS
Linked PRs
Metadata
Metadata
Assignees
No one assignedLabels
stdlib
type-bug
Projects
- dbm and shelve issues Status No status