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.getsource can't get source code if provided function isn't from a file #68679

Closed
zorceta mannequin opened this issue Jun 23, 2015 · 2 comments
Closed

inspect.getsource can't get source code if provided function isn't from a file #68679

zorceta mannequin opened this issue Jun 23, 2015 · 2 comments
Labels
type-bug An unexpected behavior, bug, or error

Comments

@zorceta
Copy link
Mannequin

zorceta mannequin commented Jun 23, 2015

BPO 24491
Nosy @ned-deily
Superseder
  • bpo-12920: inspect.getsource only works for objects loaded from files, not interactive session
  • 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 = None
    closed_at = <Date 2015-06-24.04:04:41.564>
    created_at = <Date 2015-06-23.16:46:56.407>
    labels = ['type-bug']
    title = "inspect.getsource can't get source code if provided function isn't from a file"
    updated_at = <Date 2015-06-24.04:04:41.562>
    user = 'https://bugs.python.org/zorceta'

    bugs.python.org fields:

    activity = <Date 2015-06-24.04:04:41.562>
    actor = 'ned.deily'
    assignee = 'none'
    closed = True
    closed_date = <Date 2015-06-24.04:04:41.564>
    closer = 'ned.deily'
    components = []
    creation = <Date 2015-06-23.16:46:56.407>
    creator = 'zorceta'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 24491
    keywords = []
    message_count = 2.0
    messages = ['245694', '245715']
    nosy_count = 2.0
    nosy_names = ['ned.deily', 'zorceta']
    pr_nums = []
    priority = 'normal'
    resolution = 'duplicate'
    stage = 'resolved'
    status = 'closed'
    superseder = '12920'
    type = 'behavior'
    url = 'https://bugs.python.org/issue24491'
    versions = ['Python 3.4']

    @zorceta
    Copy link
    Mannequin Author

    zorceta mannequin commented Jun 23, 2015

    Both python.exe and IDLE can't. IPython is able to, as it inserts REPL input into linecache.

    @zorceta zorceta mannequin added the type-bug An unexpected behavior, bug, or error label Jun 23, 2015
    @ned-deily
    Copy link
    Member

    bpo-12920 is currently open with a suggestion to change the documentation for inspect.getsource.

    @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
    type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant