Skip to content

Expand tabs to spaces in C files #76331

Closed

Description

@serhiy-storchaka
BPO 32150
Nosy @gvanrossum, @serhiy-storchaka
PRs
  • bpo-32150: Expand tabs to spaces in C files. #4583
  • 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 2017-11-28.16:02:59.465>
    created_at = <Date 2017-11-27.16:40:18.392>
    labels = ['interpreter-core', '3.7']
    title = 'Expand tabs to spaces in C files'
    updated_at = <Date 2017-11-28.16:02:59.464>
    user = 'https://github.com/serhiy-storchaka'

    bugs.python.org fields:

    activity = <Date 2017-11-28.16:02:59.464>
    actor = 'serhiy.storchaka'
    assignee = 'none'
    closed = True
    closed_date = <Date 2017-11-28.16:02:59.465>
    closer = 'serhiy.storchaka'
    components = ['Interpreter Core']
    creation = <Date 2017-11-27.16:40:18.392>
    creator = 'serhiy.storchaka'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 32150
    keywords = ['patch']
    message_count = 8.0
    messages = ['307068', '307071', '307073', '307074', '307075', '307134', '307136', '307140']
    nosy_count = 2.0
    nosy_names = ['gvanrossum', 'serhiy.storchaka']
    pr_nums = ['4583']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue32150'
    versions = ['Python 3.7']

    Activity

    1. serhiy-storchaka commented on Nov 27, 2017

      @serhiy-storchaka
      MemberAuthor

      While most C files use spaces for indenting and aligning, there are few sites in which tabs are left. Sometimes mixed tabs and spaces are used in the same file.

      This adds a noise in the diff if the committer uses an editor which doesn't preserve tabs (see for example PR 4390). This can hide semantic changes in tab expansion changes.

      I reviewed many patches with accidentally expanded tabs to spaces. Usually I request removing unrelated changes from the patch. But this still happened, and tabs slowly are disappeared from the sources. There are less tabs in the current default branch than in any maintained branch.

      I think it is better to make the expansion in a single not so large commit that allow them be mixed with semantical changes. PR 4583 does this. The changes first were made automatically, and after that I have edited them manually for removing excessive indentations in some files (4 spaces are enough). Tabs have been kept only in generated file Modules/unicodedata_db.h and in imported files Modules/_ctypes/* and Modules/expat/siphash.h.

    2. gvanrossum commented on Nov 27, 2017

      @gvanrossum
      Member

      I think I'm cool with this (even though it will make blame-finding on
      GitHub a tad harder -- what's the magic URL appendage again?)

    3. gvanrossum commented on Nov 27, 2017

      @gvanrossum
      Member

      Maybe we also need (in a separate PR) a git pre-commit hook that prevents tabs in the source (except in the few exceptions you left alone).

    4. serhiy-storchaka commented on Nov 27, 2017

      @serhiy-storchaka
      MemberAuthor

      Tools/scripts/patchcheck.py does this check. It is used for .py and .rst files, and there is bpo-8912 for applying it to .c/.h files.

      patchcheck.py also checks trailing whitespaces. While I and other core developers constantly remove trailing whitespaces (the recent clean up is PR 4130), the new trailing whitespaces are constantly added (for example in PR 4150).

    5. gvanrossum commented on Nov 27, 2017

      @gvanrossum
      Member

      Yeah, some editors don't clean up trailing ws. Even with Emacs it occasionally happens to me.

    6. gvanrossum commented on Nov 28, 2017

      @gvanrossum
      Member

      OK, so I think you can go ahead with this. I was fine with the state of the patch yesterday, so whatever you added today is also fine.

    7. serhiy-storchaka commented on Nov 28, 2017

      @serhiy-storchaka
      MemberAuthor

      New changeset 598ceae by Serhiy Storchaka in branch 'master':
      bpo-32150: Expand tabs to spaces in C files. (bpo-4583)
      598ceae

    8. serhiy-storchaka commented on Nov 28, 2017

      @serhiy-storchaka
      MemberAuthor

      Thanks Guido!

      I think now we can revive bpo-8912.

    9. transferred this issue fromon Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    No one assigned

      Labels

      3.7 (EOL)end of lifeinterpreter-core(Objects, Python, Grammar, and Parser dirs)

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions