← Winnitude! Search  ·  Reader Mode (831 ms)
Links: Stay in Reader Retro Site Converter Retro Mode: OFF Original Page ↗
GITHUB · 12 LINKS

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, 2026

Bug 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 assigned

    Labels


    stdlib

    type-bug

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions