[ python-Bugs-1516184 ] inspect.py: still infinite recursion inspecting frames

SourceForge.net noreply at sourceforge.net
Thu Jul 20 17:56:08 CEST 2006


Bugs item #1516184, was opened at 2006-07-03 08:39
Message generated for change (Comment added) made by pje
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1516184&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Library
Group: Python 2.5
>Status: Closed
>Resolution: Fixed
Priority: 5
Submitted By: Don Quijote (dq_searchlores)
Assigned to: Phillip J. Eby (pje)
Summary: inspect.py: still infinite recursion inspecting frames

Initial Comment:
Using python 2.5 beta 1 on Windows XP, and py2exe 0.6.5.

After packing and compressing a project via py2exe,
there's still an infinite recursion involving functions
getsourcefile, getmodule and getabsfile in module
inspect.py.

I was able to fix this infinite recursion by

1) changing the declaration of getabsfile & getmodule to:
def getabsfile(object, filename=None):
def getmodule(object, filename=None):

2) including the "filename" parameter in all calls to
getabsfile inside of function getmodule.

3) having getabsfile return the absolute and normalized
filename if not null.

Perhaps this change helps to clean up the 'ugliness'
introduced in version 45822.

Kind regards,
Don Quijote 

----------------------------------------------------------------------

>Comment By: Phillip J. Eby (pje)
Date: 2006-07-20 15:56

Message:
Logged In: YES 
user_id=56214

Added a test for the new issue and fixed in revision 50719.


----------------------------------------------------------------------

Comment By: Don Quijote (dq_searchlores)
Date: 2006-07-20 12:36

Message:
Logged In: YES 
user_id=1118684

A possible simple fix:
In function getabsfile(), test _filename explicitly with:
...abspath(_filename is not None or getsourcefile...

In your case, _filename is ''. This is the value returned
from getfile(), when using attribute .co_filename from the
code object.

----------------------------------------------------------------------

Comment By: Neal Norwitz (nnorwitz)
Date: 2006-07-20 06:59

Message:
Logged In: YES 
user_id=33168

Confirmed this is bad: 
inspect.getmodule(compile('a=10','','single'))

----------------------------------------------------------------------

Comment By: Connelly (connelly)
Date: 2006-07-20 06:40

Message:
Logged In: YES 
user_id=1039782

I tried pje's Revision 50526 and this still causes infinite recursion with:

>>> inspect.getmodule(compile('a=10','','single'))


----------------------------------------------------------------------

Comment By: Phillip J. Eby (pje)
Date: 2006-07-10 19:05

Message:
Logged In: YES 
user_id=56214

Fixed in revision 50526.

----------------------------------------------------------------------

Comment By: Neal Norwitz (nnorwitz)
Date: 2006-07-05 01:53

Message:
Logged In: YES 
user_id=33168

Phillip any comments?

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1516184&group_id=5470


More information about the Python-bugs-list mailing list