Eric V. Smith added the comment: The problem has to do with refcounting when an error occurs. Adjusting the title accordingly.
I'm not sure yet if the problem is in PyObject_Format(), or in handling errors in the eval loop when processing FORMAT_VALUE opcodes. I'm slowly tracking it down. It doesn't happen with format(), so I suspect it's in FORMAT_VALUE. Here's an example showing the error with a large, non-cached int. You need to call it twice to trigger the refcount problem. >>> f'{1000:j}' Traceback (most recent call last): File "<stdin>", line 1, in <module> ValueError: Unknown format code 'j' for object of type 'int' >>> f'{1000:j}' Fatal Python error: Objects/tupleobject.c:233 object at 0x7f904006b360 has negative ref count -2604246222170760230 Current thread 0x00007f9041278700 (most recent call first): Aborted (core dumped) ---------- title: Core dump in f-string with lambda and format specification -> Core dump in f-string with formatting errors due to refcount bug _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue26287> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com