Skip to content

inspect.getsource returns incorrect source for classes when class definition is part of multiline strings #79294

@tirkarthi

Description

@tirkarthi
BPO 35113
Nosy @ambv, @serhiy-storchaka, @1st1, @pablogsal, @Windsooon, @tirkarthi, @cdonovick, @akulakov
PRs
  • bpo-35113: Fix inspect.getsource to return correct source for inner classes #10307
  • bpo-35113: Attempt to optimize inspect.getsource() for classes #19587
  • bpo-35113: inspect: clean up a duplicate import and comment #27073
  • 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 2020-04-29.03:59:29.423>
    created_at = <Date 2018-10-30.12:32:57.221>
    labels = ['type-bug', 'library', '3.9']
    title = 'inspect.getsource returns incorrect source for classes when class definition is part of multiline strings'
    updated_at = <Date 2021-07-13.13:43:05.880>
    user = 'https://github.com/tirkarthi'

    bugs.python.org fields:

    activity = <Date 2021-07-13.13:43:05.880>
    actor = 'lukasz.langa'
    assignee = 'none'
    closed = True
    closed_date = <Date 2020-04-29.03:59:29.423>
    closer = 'xtreak'
    components = ['Library (Lib)']
    creation = <Date 2018-10-30.12:32:57.221>
    creator = 'xtreak'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 35113
    keywords = ['patch']
    message_count = 15.0
    messages = ['328909', '329097', '329112', '329180', '329181', '329182', '329183', '329187', '329202', '329203', '329204', '329205', '366727', '367620', '397399']
    nosy_count = 8.0
    nosy_names = ['lukasz.langa', 'serhiy.storchaka', 'yselivanov', 'pablogsal', 'Windson Yang', 'xtreak', 'donovick', 'andrei.avk']
    pr_nums = ['10307', '19587', '27073']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue35113'
    versions = ['Python 3.9']

    Metadata

    Metadata

    Assignees

    No one assigned

      Labels

      3.9 (EOL)end of lifestdlibStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or error

      Projects

      No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions