Message301111
| Author |
vstinner |
| Recipients |
vstinner |
| Date |
2017年09月01日.14:50:17 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1504277417.4.0.438645016632.issue31321@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
traceback.clear_frames():
"Clears the local variables of all the stack frames in a traceback tb by calling the clear() method of each frame object."
https://docs.python.org/dev/library/traceback.html#traceback.clear_frames
That's wrong: it only calls frame.clear() on the top frame of each traceback object.
Output of attached clear_frames_bug.py script:
---
locals:
frame locals {'z': 3}
frame locals {'y': 2}
frame locals {'x': 1}
clear_frames()
locals:
frame locals {}
frame locals {'y': 2}
frame locals {'x': 1}
---
As you can see, only the locals of the func3() frame, where the exception was raised, is clear. Locals of other frames are not cleared.
Attached PR fixes the issue.
Output with the fix:
---
locals:
frame locals {'z': 3}
frame locals {'y': 2}
frame locals {'x': 1}
clear_frames()
locals:
frame locals {}
frame locals {}
frame locals {}
--- |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2017年09月01日 14:50:17 | vstinner | set | recipients:
+ vstinner |
| 2017年09月01日 14:50:17 | vstinner | set | messageid: <1504277417.4.0.438645016632.issue31321@psf.upfronthosting.co.za> |
| 2017年09月01日 14:50:17 | vstinner | link | issue31321 messages |
| 2017年09月01日 14:50:17 | vstinner | create |
|