Skip to content

object no longer passed to sys.unraisablehook #134732

Closed as not planned
Closed as not planned
@graingert

Description

@graingert

Bug report

Bug description:

given

import gc
import sys

class Foo:
    def __del__(self):
        raise ValueError("__del__ is broken")


def main():
    v = None
    def unraisablehook(unraisable_arg):
        nonlocal v
        v = unraisable_arg

    sys.unraisablehook = unraisablehook
    Foo()
    gc.collect()
    print(v.object)


if __name__ == "__main__":
    sys.exit(main())

On Python 3.13 you get <function Foo.__del__ at 0x7181347936a0> on 3.14 you get None

CPython versions tested on:

3.14

Operating systems tested on:

Linux

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.14bugs and security fixesinterpreter-core(Objects, Python, Grammar, and Parser dirs)type-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions