[issue46256] Objects __del__ called after module have been removed

2022-01-06 Thread Daniele Varrazzo
Daniele Varrazzo added the comment: Thank you @pablogsal. For me it was surprising as never seen before 3.10 instance. If this is the expected behaviour (and the stdlib expects it) we can try and take the same type of care in psycopg. -- ___

[issue46256] Objects __del__ called after module have been removed

2022-01-06 Thread Christopher Vickery
Christopher Vickery added the comment: This it very clear and totally consistent with the observed behavior. I can think of a couple of workarounds for my app (move the db access from module initialization to a function that gets invoked "on demand", or redirect sys.stderr to /dev/null just

[issue46256] Objects __del__ called after module have been removed

2022-01-06 Thread Pablo Galindo Salgado
Pablo Galindo Salgado added the comment: This doesn't look like a bug to me and is documented behavior: https://docs.python.org/3/reference/datamodel.html#object.__del__ Check this paragraph: Warning Due to the precarious circumstances under which __del__() methods are invoked, exceptions

[issue46256] Objects __del__ called after module have been removed

2022-01-05 Thread Christopher Vickery
Christopher Vickery added the comment: The app has to open a db connection during module initialization to trigger the problem, so I can't provide a self-contained way to reproduce the problem. The closest I can come is the attached file, format_rules_annotated.py. With lines 66-69 in

[issue46256] Objects __del__ called after module have been removed

2022-01-05 Thread Dennis Sweeney
Dennis Sweeney added the comment: I'm getting this: Traceback (most recent call last): File "/mnt/c/Users/sween/Source/Repos/cpython2/cpython/delbug.py", line 65, in conn = psycopg.connect('dbname=cuny_curriculum') File

[issue46256] Objects __del__ called after module have been removed

2022-01-04 Thread Christopher Vickery
Christopher Vickery added the comment: If the attached module is run with no command line arguments, it will reproduce the problem without doing anything else. When run using Python 3.9 it does not cause the problem. (This module comes from https://github.com/cvickery/transfer-app, with an

[issue46256] Objects __del__ called after module have been removed

2022-01-04 Thread Daniele Varrazzo
New submission from Daniele Varrazzo : The following bug has been reported to Psycopg: https://github.com/psycopg/psycopg/issues/198 At the end of the program, errors such as the following are dumped: Exception ignored in: Traceback (most recent call last): File