Destructor not called on interpreter exit only in Docker

Viewed 24

I see unexpected behavior by Python interpreter.

import os
class PPP():
    def __init__(self):
        print("PPP------------------------init");
    def __del__(self):
        print("PPP------------------------term");

if __name__ == '__main__':
    p = PPP()

When I run above program in a docker provided by a third party, destructor of PPP is not called by interpreter on exit. But when I remove import statement it calls destructor on exit. When I run it from host environment, constructor and destructor both are called with and without the import statement. Can any body explain this behavior? Please guide me if some configuration is missing in docker.

0 Answers
Related