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 2015年07月09日 13:31 by petr.viktorin, last changed 2022年04月11日 14:58 by admin. This issue is now closed.
| Pull Requests | |||
|---|---|---|---|
| URL | Status | Linked | Edit |
| PR 7918 | merged | ZackerySpytz, 2018年06月25日 22:59 | |
| PR 8069 | merged | miss-islington, 2018年07月03日 19:48 | |
| PR 8070 | merged | miss-islington, 2018年07月03日 19:48 | |
| Messages (6) | |||
|---|---|---|---|
| msg246491 - (view) | Author: Petr Viktorin (petr.viktorin) * (Python committer) | Date: 2015年07月09日 13:31 | |
When this program is invoked as a script (`python reproducer.py`), the __del__ is never called:
---
class ClassWithDel:
def __del__(self):
print('__del__ called')
a = ClassWithDel()
a.link = a
raise SystemExit(0)
---
Raising a different exception, moving the code to a function, importing the module, or invoking with -m (or even -c), causes __del__ to be called normally.
|
|||
| msg246498 - (view) | Author: Antoine Pitrou (pitrou) * (Python committer) | Date: 2015年07月09日 13:55 | |
It's likely that your global variable gets caught in the traceback attached to the SystemExit, and that either never gets deallocated, or gets deallocated too late. |
|||
| msg246502 - (view) | Author: Antoine Pitrou (pitrou) * (Python committer) | Date: 2015年07月09日 14:10 | |
Actually, the problem is in PyRun_SimpleFileExFlags(). The executed module is decref'ed after calling PyErr_Print(), but the latter never returns when the exception is a SystemExit. |
|||
| msg321001 - (view) | Author: Antoine Pitrou (pitrou) * (Python committer) | Date: 2018年07月03日 19:47 | |
New changeset d8cba5d16f1333fd625726fc72e66afbd45b8d00 by Antoine Pitrou (Zackery Spytz) in branch 'master': bpo-24596: Decref module in PyRun_SimpleFileExFlags() on SystemExit (GH-7918) https://github.com/python/cpython/commit/d8cba5d16f1333fd625726fc72e66afbd45b8d00 |
|||
| msg321003 - (view) | Author: Antoine Pitrou (pitrou) * (Python committer) | Date: 2018年07月03日 20:13 | |
New changeset 20ae4c60258479a0732d12af292f422679444e2c by Antoine Pitrou (Miss Islington (bot)) in branch '3.7': bpo-24596: Decref module in PyRun_SimpleFileExFlags() on SystemExit (GH-7918) (GH-8070) https://github.com/python/cpython/commit/20ae4c60258479a0732d12af292f422679444e2c |
|||
| msg321004 - (view) | Author: Antoine Pitrou (pitrou) * (Python committer) | Date: 2018年07月03日 20:17 | |
New changeset e1ebf51f76037b7e02711aaeb9bf66c9147f4c74 by Antoine Pitrou (Miss Islington (bot)) in branch '3.6': bpo-24596: Decref module in PyRun_SimpleFileExFlags() on SystemExit (GH-7918) (GH-8069) https://github.com/python/cpython/commit/e1ebf51f76037b7e02711aaeb9bf66c9147f4c74 |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:58:18 | admin | set | github: 68784 |
| 2018年07月03日 20:18:03 | pitrou | set | status: open -> closed resolution: fixed stage: patch review -> resolved |
| 2018年07月03日 20:17:48 | pitrou | set | messages: + msg321004 |
| 2018年07月03日 20:13:32 | pitrou | set | messages: + msg321003 |
| 2018年07月03日 19:48:48 | miss-islington | set | pull_requests: + pull_request7680 |
| 2018年07月03日 19:48:01 | miss-islington | set | pull_requests: + pull_request7679 |
| 2018年07月03日 19:47:31 | pitrou | set | messages: + msg321001 |
| 2018年06月25日 23:02:52 | ZackerySpytz | set | nosy:
+ ZackerySpytz versions: + Python 3.7, Python 3.8, - Python 3.4, Python 3.5 |
| 2018年06月25日 22:59:09 | ZackerySpytz | set | keywords:
+ patch stage: patch review pull_requests: + pull_request7524 |
| 2015年07月09日 14:10:29 | pitrou | set | nosy:
+ ncoghlan messages: + msg246502 |
| 2015年07月09日 13:55:52 | pitrou | set | nosy:
+ pitrou messages: + msg246498 |
| 2015年07月09日 13:31:32 | petr.viktorin | create | |