Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

inspect.py: still infinite recursion inspecting frames #43601

Closed
dqsearchlores mannequin opened this issue Jul 3, 2006 · 7 comments
Closed

inspect.py: still infinite recursion inspecting frames #43601

dqsearchlores mannequin opened this issue Jul 3, 2006 · 7 comments
Assignees
Labels
stdlib Python modules in the Lib dir

Comments

@dqsearchlores
Copy link
Mannequin

dqsearchlores mannequin commented Jul 3, 2006

BPO 1516184
Nosy @pjeby

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = 'https://github.com/pjeby'
closed_at = <Date 2006-07-20.15:56:07.000>
created_at = <Date 2006-07-03.08:39:49.000>
labels = ['library']
title = 'inspect.py: still infinite recursion inspecting frames'
updated_at = <Date 2006-07-20.15:56:07.000>
user = 'https://bugs.python.org/dqsearchlores'

bugs.python.org fields:

activity = <Date 2006-07-20.15:56:07.000>
actor = 'pje'
assignee = 'pje'
closed = True
closed_date = None
closer = None
components = ['Library (Lib)']
creation = <Date 2006-07-03.08:39:49.000>
creator = 'dq_searchlores'
dependencies = []
files = []
hgrepos = []
issue_num = 1516184
keywords = []
message_count = 7.0
messages = ['29022', '29023', '29024', '29025', '29026', '29027', '29028']
nosy_count = 4.0
nosy_names = ['nnorwitz', 'pje', 'connelly', 'dq_searchlores']
pr_nums = []
priority = 'normal'
resolution = 'fixed'
stage = None
status = 'closed'
superseder = None
type = None
url = 'https://bugs.python.org/issue1516184'
versions = ['Python 2.5']

@dqsearchlores
Copy link
Mannequin Author

dqsearchlores mannequin commented Jul 3, 2006

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

@dqsearchlores dqsearchlores mannequin closed this as completed Jul 3, 2006
@dqsearchlores dqsearchlores mannequin closed this as completed Jul 3, 2006
@dqsearchlores dqsearchlores mannequin assigned pjeby Jul 3, 2006
@dqsearchlores dqsearchlores mannequin added stdlib Python modules in the Lib dir labels Jul 3, 2006
@nnorwitz
Copy link
Mannequin

nnorwitz mannequin commented Jul 5, 2006

Logged In: YES
user_id=33168

Phillip any comments?

@pjeby
Copy link
Mannequin

pjeby mannequin commented Jul 10, 2006

Logged In: YES
user_id=56214

Fixed in revision 50526.

@connelly
Copy link
Mannequin

connelly mannequin commented Jul 20, 2006

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'))

@nnorwitz
Copy link
Mannequin

nnorwitz mannequin commented Jul 20, 2006

Logged In: YES
user_id=33168

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

@dqsearchlores
Copy link
Mannequin Author

dqsearchlores mannequin commented Jul 20, 2006

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.

@pjeby
Copy link
Mannequin

pjeby mannequin commented Jul 20, 2006

Logged In: YES
user_id=56214

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

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stdlib Python modules in the Lib dir
Projects
None yet
Development

No branches or pull requests

0 participants