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

IndentationError for unexpected indent #43273

Closed
rcmiller mannequin opened this issue Apr 24, 2006 · 3 comments
Closed

IndentationError for unexpected indent #43273

rcmiller mannequin opened this issue Apr 24, 2006 · 3 comments
Assignees
Labels
interpreter-core (Objects, Python, Grammar, and Parser dirs)

Comments

@rcmiller
Copy link
Mannequin

rcmiller mannequin commented Apr 24, 2006

BPO 1475845
Nosy @loewis, @birkenfeld
Files
  • patch_indent_error: patch for IndendationError
  • 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/loewis'
    closed_at = <Date 2006-05-04.05:51:45.000>
    created_at = <Date 2006-04-24.23:12:04.000>
    labels = ['interpreter-core']
    title = 'IndentationError for unexpected indent'
    updated_at = <Date 2006-05-04.05:51:45.000>
    user = 'https://bugs.python.org/rcmiller'

    bugs.python.org fields:

    activity = <Date 2006-05-04.05:51:45.000>
    actor = 'loewis'
    assignee = 'loewis'
    closed = True
    closed_date = None
    closer = None
    components = ['Interpreter Core']
    creation = <Date 2006-04-24.23:12:04.000>
    creator = 'rcmiller'
    dependencies = []
    files = ['7198']
    hgrepos = []
    issue_num = 1475845
    keywords = ['patch']
    message_count = 3.0
    messages = ['50106', '50107', '50108']
    nosy_count = 3.0
    nosy_names = ['loewis', 'georg.brandl', 'rcmiller']
    pr_nums = []
    priority = 'normal'
    resolution = 'accepted'
    stage = None
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue1475845'
    versions = ['Python 2.5']

    @rcmiller
    Copy link
    Mannequin Author

    rcmiller mannequin commented Apr 24, 2006

    This patch raises an IndentationError rather than a
    generic "invalid syntax" error for unexpected
    indentation. Code to do this was already in
    pythonrun.c:err_input() but was not being reached due
    to a failure to pass the INDENT token in the perrdetail
    structure. The patch also adds tests for the 3 kinds
    of indentation errors (unexpected indent, no indent
    where required, invalid outdent level) to test_syntax.py .

    @rcmiller rcmiller mannequin closed this as completed Apr 24, 2006
    @rcmiller rcmiller mannequin assigned loewis Apr 24, 2006
    @rcmiller rcmiller mannequin added the interpreter-core (Objects, Python, Grammar, and Parser dirs) label Apr 24, 2006
    @birkenfeld
    Copy link
    Member

    Logged In: YES
    user_id=849994

    Martin, do we want to change this? I myself have always
    wondered what IndentationError was for if it was not raised
    in these cases.

    @loewis
    Copy link
    Mannequin

    loewis mannequin commented May 4, 2006

    Logged In: YES
    user_id=21627

    IndentationError is already raised for bad indentation, e.g.
    for

    "def f():\nreturn"

    or

    if 1:\nfoo()" (which is the test_no_indent)

    However, the patch is right in filling the token in this
    case, also; I accepted it as r45897. As it changes the
    exceptio behaviour, I don't think it should be backported.

    @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
    interpreter-core (Objects, Python, Grammar, and Parser dirs)
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant