Software to automate the management and configuration of any infrastructure or application at scale. Install Salt from the Salt package repositories here:
Description
Remove ALL occurrences of __del__ usage.
Relying on this functionality can actually prevent objects from being GC'ed.
Instead, and if we really need a termination routine, we should implement the context manager protocol by adding __enter__ and __exit__ and using the class in a with statement.
Expected behavior
All classes which require explicit termination routines should implement and use the context manager protocol.
Additional context
A few examples of offending code:
Description Remove ALL occurrences of
__del__
usage.Relying on this functionality can actually prevent objects from being GC'ed.
Instead, and if we really need a termination routine, we should implement the context manager protocol by adding
__enter__
and__exit__
and using the class in awith
statement.Expected behavior All classes which require explicit termination routines should implement and use the context manager protocol.
Additional context A few examples of offending code:
https://github.com/saltstack/salt/blob/b95213ec903402f25c1e0aeb3990fe8452ab63ce/salt/utils/rsax931.py#L157 https://github.com/saltstack/salt/blob/b95213ec903402f25c1e0aeb3990fe8452ab63ce/salt/utils/rsax931.py#L203 https://github.com/saltstack/salt/blob/b95213ec903402f25c1e0aeb3990fe8452ab63ce/salt/transport/ipc.py#L239 https://github.com/saltstack/salt/blob/b95213ec903402f25c1e0aeb3990fe8452ab63ce/salt/transport/ipc.py#L362 https://github.com/saltstack/salt/blob/b95213ec903402f25c1e0aeb3990fe8452ab63ce/salt/transport/ipc.py#L602 https://github.com/saltstack/salt/blob/b95213ec903402f25c1e0aeb3990fe8452ab63ce/salt/transport/ipc.py#L767 https://github.com/saltstack/salt/blob/b95213ec903402f25c1e0aeb3990fe8452ab63ce/salt/transport/tcp.py#L195