New submission from Michał Bartoszkiewicz <e...@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 <rep...@bugs.python.org>
<https://bugs.python.org/issue45687>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to