[New-bugs-announce] [issue45687] Infinite recursion in Pickler.persistent_id

Michał Bartoszkiewicz report at bugs.python.org
Tue Nov 2 04:21:56 EDT 2021


New submission from Michał Bartoszkiewicz <embe at navalgo.com>:

The following code, which seems reasonable:
import io
import pickle

class Pickler(pickle.Pickler):
  def persistent_id(self, obj):
    return super().persistent_id(obj)

Pickler(io.BytesIO()).dump(42)

crashes with:
RecursionError: maximum recursion depth exceeded while calling a Python object

It works perfectly when inheriting from pickle._Pickler (the Python implementation).

----------
components: Library (Lib)
files: pickle-bug.py
messages: 405494
nosy: embe-navalgo
priority: normal
severity: normal
status: open
title: Infinite recursion in Pickler.persistent_id
type: behavior
versions: Python 3.10, Python 3.7, Python 3.8, Python 3.9
Added file: https://bugs.python.org/file50418/pickle-bug.py

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue45687>
_______________________________________


More information about the New-bugs-announce mailing list