This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2001年11月03日 20:07 by tim.peters, last changed 2022年04月10日 16:04 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| gc_fini.patch | pitrou, 2010年08月04日 12:07 | |||
| gc_fini2.patch | pitrou, 2010年08月04日 12:25 | |||
| gc_fini3.patch | pitrou, 2010年08月04日 23:11 | |||
| Messages (10) | |||
|---|---|---|---|
| msg61071 - (view) | Author: Tim Peters (tim.peters) * (Python committer) | Date: 2001年11月03日 20:07 | |
Here are comments from Guido, taken from a patch report that's been closed: """ In a discussion before lunch, Tim suggested that when Python exits (or better, in Py_Finalize()) a check could be made if there is any garbage in gc.garbage, and if so, a warning about this should be printed to stderr. That seems a nice feature. In that same discussion, I realized that the module cleanup behavior (where all globals in a module are set to None when the module object is deallocated) is probably no longer necessary now that we have GC. """ The point to #1 is that we let objects in unreachable cycles leak when they have __del__ methods. While we give the user ways to know about that and to clean them up (via exposing the trash in gc.garbage), a non- expert user (or an expert who simply isn't thinking about this -- whatever, you don't know unless you specifically look for it) may never know that they're leaking. |
|||
| msg77936 - (view) | Author: Antoine Pitrou (pitrou) * (Python committer) | Date: 2008年12月16日 21:41 | |
Although this dates back to 2001, I think this might still be useful. |
|||
| msg112783 - (view) | Author: Antoine Pitrou (pitrou) * (Python committer) | Date: 2010年08月04日 10:19 | |
Displaying the full list may be unwieldy if it's very large. Instead, we could by default display the following kind of message: Python warning: 5 uncollectable objects remaining at interpreter shutdown. Use gc.DEBUG_UNCOLLECTABLE to list them. And list gc.garbage only if gc.DEBUG_UNCOLLECTABLE is defined. |
|||
| msg112788 - (view) | Author: Antoine Pitrou (pitrou) * (Python committer) | Date: 2010年08月04日 11:21 | |
Here is a patch. Perhaps I should add tests too. |
|||
| msg112793 - (view) | Author: Antoine Pitrou (pitrou) * (Python committer) | Date: 2010年08月04日 12:07 | |
New patch with tests. |
|||
| msg112795 - (view) | Author: Antoine Pitrou (pitrou) * (Python committer) | Date: 2010年08月04日 12:25 | |
More thorough tests. |
|||
| msg112898 - (view) | Author: Alyssa Coghlan (ncoghlan) * (Python committer) | Date: 2010年08月04日 21:26 | |
Patch looks basically OK on an eyeball scan. A couple of suggestions: - use test.script_helper.run_python rather than rolling your own run_command (or, at least, just make run_command a thin wrapper around run_python). I've been trying to trim down the number of different ways the test suite launches interpreter subprocesses for testing purposes, and script_helper also does a bit of extra cleanup to try to eliminate false alarms regarding reference leaks. That said, I do like the way you're checking that the output went to the correct stream, so perhaps instead add a run_python variant to script_helper that returns a 3-tuple containing the exit code, stdout and stderr and make your run_command a wrapper around that (then create an issue to migrate the rest of the script_helper.run_python based tests to switch to the new version so they will also check that the output is on the correct stream rather than lumping the two streams together). - update the description of gc.DEBUG_UNCOLLECTABLE in the docs to specifically mention that the complete list of uncollectable objects will also be printed at interpreter shutdown. |
|||
| msg112915 - (view) | Author: Antoine Pitrou (pitrou) * (Python committer) | Date: 2010年08月04日 22:45 | |
> - use test.script_helper.run_python rather than rolling your own > run_command (or, at least, just make run_command a thin wrapper around > run_python). I've been trying to trim down the number of different > ways the test suite launches interpreter subprocesses for testing > purposes, and script_helper also does a bit of extra cleanup to try to > eliminate false alarms regarding reference leaks. After a quick grep, it seems script_helper is really in the minority (it's only used in three test files) while ad hoc calls to subprocess with sys.executable are all over the place. I'd rather open a separate feature request for that new script_helper function than convert all uses of subprocess in this issue. > - update the description of gc.DEBUG_UNCOLLECTABLE in the docs to > specifically mention that the complete list of uncollectable objects > will also be printed at interpreter shutdown. Ah, indeed. Thanks! |
|||
| msg112920 - (view) | Author: Antoine Pitrou (pitrou) * (Python committer) | Date: 2010年08月04日 23:11 | |
Here is a new patch with doc. |
|||
| msg113343 - (view) | Author: Antoine Pitrou (pitrou) * (Python committer) | Date: 2010年08月08日 22:21 | |
I went forward and committed the patch in r83861. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月10日 16:04:36 | admin | set | github: 35458 |
| 2010年08月08日 22:21:45 | pitrou | set | status: open -> closed resolution: fixed messages: + msg113343 |
| 2010年08月04日 23:11:07 | pitrou | set | files:
+ gc_fini3.patch messages: + msg112920 |
| 2010年08月04日 22:45:05 | pitrou | set | messages: + msg112915 |
| 2010年08月04日 21:26:10 | ncoghlan | set | messages: + msg112898 |
| 2010年08月04日 12:31:09 | pitrou | set | nosy:
+ gvanrossum, ncoghlan |
| 2010年08月04日 12:25:52 | pitrou | set | files:
+ gc_fini2.patch messages: + msg112795 |
| 2010年08月04日 12:07:41 | pitrou | set | files: - gc_fini.patch |
| 2010年08月04日 12:07:34 | pitrou | set | files:
+ gc_fini.patch messages: + msg112793 |
| 2010年08月04日 11:23:48 | pitrou | set | files:
+ gc_fini.patch stage: needs patch -> patch review |
| 2010年08月04日 11:23:37 | pitrou | set | files: - gc_fini.patch |
| 2010年08月04日 11:21:44 | pitrou | set | files:
+ gc_fini.patch keywords: + patch messages: + msg112788 |
| 2010年08月04日 10:19:37 | pitrou | set | messages:
+ msg112783 versions: - Python 2.7 |
| 2010年03月17日 17:46:04 | pitrou | set | title: New gc work -> Print warning at shutdown if gc.garbage not empty stage: needs patch versions: + Python 3.2, - Python 3.1 |
| 2010年03月17日 17:45:38 | pitrou | set | nosy:
+ flox |
| 2008年12月16日 21:41:32 | pitrou | set | nosy:
+ pitrou messages: + msg77936 components: + Interpreter Core, - None versions: + Python 3.1, Python 2.7 |
| 2001年11月03日 20:07:42 | tim.peters | create | |