New submission from MultiSosnooley <multisosnoo...@gmail.com>:
``` __import__('json').dumps(object(), default=lambda o: repr(o).encode()) ``` Produce infinite recursion on `default` function. Here is more informative example: ``` >>> def f(o): ... input(f"{o!r} {type(o)}") ... return repr(o).encode() ... >>> import json >>> json.dumps(object(), default=f) <object object at 0x7f8c87e987c0> <class 'object'> b'<object object at 0x7f8c87e987c0>' <class 'bytes'> b"b'<object object at 0x7f8c87e987c0>'" <class 'bytes'> b'b"b\'<object object at 0x7f8c87e987c0>\'"' <class 'bytes'> b'b\'b"b\\\'<object object at 0x7f8c87e987c0>\\\'"\'' <class 'bytes'> b'b\'b\\\'b"b\\\\\\\'<object object at 0x7f8c87e987c0>\\\\\\\'"\\\'\'' <class 'bytes'> ``` ---------- components: Library (Lib) messages: 334877 nosy: MultiSosnooley priority: normal severity: normal status: open title: json.dumps infinite recurssion type: crash versions: Python 3.6, Python 3.8 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue35901> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com