[issue21788] Rework Python finalization

STINNER Victor report at bugs.python.org
Tue Jun 17 09:40:27 CEST 2014


New submission from STINNER Victor:

Hi,

During the development of Python 3.4, I tried to emit warnings if a file is destroyed without being explicitly closed. The warnings were not emited in threads during Python finalization. Here are related changes:

- Issue #19421: "FileIO destructor imports indirectly the io module at exit"
- Issue #19424: "_warnings: patch to avoid conversions from/to UTF-8"
- Issue #19442: "Python crashes when a warning is emitted during shutdown"
- Change in Python shutdown: issue #19466 "Clear state of threads earlier in Python shutdown"
- Regression => issue #20526

The change #19466 had to be reverted a few days before the release of Python 3.4.0 because it caused the regression #20526.

I'm still not convinced that #20526 was a new bug. IMO the bug still exists, but it is just less likely without the change #19466.

There is still something wrong in Python finalization, so I open this issue to rework it.

The goal is to get warnings in test_4_daemon_threads() of test_threading. I attached the test as a Python script.

----------
files: test_4_daemon_threads.py
messages: 220804
nosy: benjamin.peterson, haypo
priority: normal
severity: normal
status: open
title: Rework Python finalization
versions: Python 3.5
Added file: http://bugs.python.org/file35669/test_4_daemon_threads.py

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue21788>
_______________________________________


More information about the Python-bugs-list mailing list