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: inspect module bug for modules with same filename
Type: behavior Stage: resolved
Components: Extension Modules Versions: Python 2.7
process
Status: closed Resolution: duplicate
Dependencies: Superseder: inspect.findsource raises IndexError
View: 17735
Assigned To: Nosy List: cqxz, ezio.melotti, yselivanov
Priority: normal Keywords:

Created on 2014-01-17 21:08 by cqxz, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
mod.py cqxz, 2014-01-17 21:08 foo/mod.py
Messages (1)
msg208362 - (view) Author: cqxz (cqxz) Date: 2014-01-17 21:08
When two files have the same name and the first changes directory to the second, the inspect module can retrieve the source code for the latter incorrectly, so a simple call to inspect.stack() can be incorrect, and will fail if there are less lines in the nested module (foo/bar/mod.py) than in the calling module (foo/mod.py)

foo/mod.py
foo/bar/mod.py

(the foo/bar/mod.py need only contain a single line, e.g. print "hello")
History
Date User Action Args
2022-04-11 14:57:57adminsetgithub: 64489
2021-04-26 12:09:20iritkatrielsetstatus: open -> closed
superseder: inspect.findsource raises IndexError
resolution: duplicate
stage: resolved
2014-02-15 15:39:32ezio.melottisetnosy: + ezio.melotti, yselivanov
type: crash -> behavior
2014-01-17 21:08:16cqxzcreate