Title: cgitb fails when frame arguments are deleted (due to inspect bug I think)
Type: behavior Stage: patch review
Components: Library (Lib) Versions: Python 2.7
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: Andrew.Lutomirski, ezio.melotti
Priority: normal Keywords: patch

Created on 2013-02-19 22:22 by Andrew.Lutomirski, last changed 2013-02-22 22:59 by ezio.melotti.

File name Uploaded Description Edit Andrew.Lutomirski, 2013-02-19 22:22 Short script demonstrating the problem
issue17246.diff ezio.melotti, 2013-02-22 22:59 Proof of concept against 2.7.
Messages (2)
msg182446 - (view) Author: Andrew Lutomirski (Andrew.Lutomirski) Date: 2013-02-19 22:22
inspect.formatargvalues assumes (incorrectly) that every argument in args is a key in values.  This isn't very hard to break -- see the attachment for a complete example.
msg182705 - (view) Author: Ezio Melotti (ezio.melotti) * (Python committer) Date: 2013-02-22 22:59
The bug seems to be in inspect indeed:

import inspect
def fun(x):
    del x
    return inspect.currentframe()


Attached a proof-of-concept patch that replaces the missing value with <deleted>.  If the approach is ok, the same fix might have to be applied to other functions and/or other types of arguments.
Date User Action Args
2013-02-22 22:59:09ezio.melottisetfiles: + issue17246.diff

type: behavior

keywords: + patch
nosy: + ezio.melotti
messages: + msg182705
stage: patch review
2013-02-19 22:22:36Andrew.Lutomirskicreate