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.

classification
Title: cgitb variable dumps a little flaky
Type: Stage:
Components: Library (Lib) Versions: Python 2.3
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: ping Nosy List: gvanrossum, jribbens, nnorwitz, ping
Priority: normal Keywords:

Created on 2002-04-26 12:11 by jribbens, last changed 2022-04-10 16:05 by admin. This issue is now closed.

Messages (7)
msg10538 - (view) Author: Jon Ribbens (jribbens) * Date: 2002-04-26 12:11
First off, easy problem: lookup() should look in 
frame.f_globals["__builtins__"] also. Along the same 
lines, I am not sure if lookup works properly with 
nested scopes, but since I don't use nested scopes in 
any of my code this is not a problem for me ;-)

Secondly, the parsing in scanvars() is somewhat hacky. 
For example, given the following line:

  foo(open(filename).read())

it will think the following variables exist:

  foo
  open
  filename
  ).read

Obviously this last one is incorrect. I am not sure if 
this is easy to fix or not.
msg10539 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2002-04-29 00:50
Logged In: YES 
user_id=6380

Nobody except Ka-Ping Ping understands the code in cgitb.py,
so I suggest that you track him down and get him to look at
this bug report. In the past I've performed this service
myself but I'm getting tired of it.
msg10540 - (view) Author: Ka-Ping Yee (ping) * (Python committer) Date: 2002-06-26 07:11
Logged In: YES 
user_id=45338

The lookup function looks in frame.f_locals, which does the right thing 
with respect to nested scopes as far as i can tell.

I tested the parser and wasn't able to reproduce the problem you described. 

Thanks for the bug report.  I have committed a change that adds the 
lookup in __builtins__.
msg10541 - (view) Author: Jon Ribbens (jribbens) * Date: 2002-06-26 10:28
Logged In: YES 
user_id=76089

I'm not quite sure why you were unable to reproduce 
the ").read" bit. Try the following code:

import cgitb; cgitb.enable()
filename = "foo"
foo(open(filename).read())

The output includes:

foo undefined, open undefined, filename = 'foo', ).read 
undefined

Do you get something different?
msg10542 - (view) Author: Neal Norwitz (nnorwitz) * (Python committer) Date: 2002-11-03 03:28
Logged In: YES 
user_id=33168

Jon, is this fixed?  Can it be closed?  If not, what do you
think needs to be done?
msg10543 - (view) Author: Jon Ribbens (jribbens) * Date: 2002-11-03 12:57
Logged In: YES 
user_id=76089

Whether it is fixed or not depends on whether you think it is a 
bug or not ;-) It could possibly be considered a feature 
request. Looking at CVS, the first point is fixed, the second is 
not. I am not sure how difficult it is to detect the variable 
names in the source code "properly" - if it's easy then I guess 
this is a bug report, if it's hard it's a feature request. I won't 
argue if this is closed.
msg10544 - (view) Author: Neal Norwitz (nnorwitz) * (Python committer) Date: 2002-11-04 01:26
Logged In: YES 
user_id=33168

I'll close this bug report.  If you want the feature added,
feel free to submit a patch. :-)

Thanks.
History
Date User Action Args
2022-04-10 16:05:16adminsetgithub: 36503
2002-04-26 12:11:11jribbenscreate