Skip to content

del should call __del__ method #1802

Closed
Closed
@blazewicz

Description

@blazewicz

Example test with custom object:

class Foo():
    def __del__(self):
        print('__del__')

f = Foo()
del f  # should print '__del__'

Also for builtin types with finaliser, like socket.socket.
Example case:

s = socket.socket()
s.connect(addr)  # binds "hard" socket to object `s`
...
del s  # s.close() has not been called - "hard" socket will never be released

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions