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

IDLE: require encoding argument for textview.view_file #77018

Closed
terryjreedy opened this issue Feb 12, 2018 · 4 comments
Closed

IDLE: require encoding argument for textview.view_file #77018

terryjreedy opened this issue Feb 12, 2018 · 4 comments
Assignees
Labels
3.7 (EOL) end of life 3.8 only security fixes topic-IDLE type-bug An unexpected behavior, bug, or error

Comments

@terryjreedy
Copy link
Member

BPO 32837
Nosy @terryjreedy, @miss-islington
PRs
  • bpo-32837: IDLE - require encoding argument for textview.view_file. #5646
  • [3.7] bpo-32837: IDLE - require encoding argument for textview.view_file. (GH-5646) #5647
  • [3.6] bpo-32837: IDLE - require encoding argument for textview.view_file. (GH-5646) #5648
  • 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/terryjreedy'
    closed_at = <Date 2018-02-13.06:28:23.918>
    created_at = <Date 2018-02-12.22:07:39.772>
    labels = ['3.8', 'expert-IDLE', 'type-bug', '3.7']
    title = 'IDLE: require encoding argument for textview.view_file'
    updated_at = <Date 2018-02-13.06:28:23.917>
    user = 'https://github.com/terryjreedy'

    bugs.python.org fields:

    activity = <Date 2018-02-13.06:28:23.917>
    actor = 'terry.reedy'
    assignee = 'terry.reedy'
    closed = True
    closed_date = <Date 2018-02-13.06:28:23.918>
    closer = 'terry.reedy'
    components = ['IDLE']
    creation = <Date 2018-02-12.22:07:39.772>
    creator = 'terry.reedy'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 32837
    keywords = ['patch']
    message_count = 4.0
    messages = ['312085', '312087', '312089', '312090']
    nosy_count = 2.0
    nosy_names = ['terry.reedy', 'miss-islington']
    pr_nums = ['5646', '5647', '5648']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue32837'
    versions = ['Python 3.6', 'Python 3.7', 'Python 3.8']

    @terryjreedy
    Copy link
    Member Author

    Built-in open has an encoding parameter whose default value depends on the system: 'ascii' for some POSIX locales; 'latin1' or similar for most Windows sold in the USA or western Europe; and ???. In idlelib.textview, the signature for view_file currently includes 'encoding=None'. There have been 2 issues, bpo-32826 and another, about tests using the default failing because of 'Löwis' on line 27 of CREDITS.txt. It therefore seems an error for a global cross-platform application to use the default encoding.

    To prevent this, we should remove '=None' from the encoding part of the view_file definition and make view_file calls explicitly pass an encoding. For IDLE itself, this will be 'ascii' or 'utf-8'.

    This expands upon a note by Cheryl Sabella in bpo-32826 about one of the three calls that fail with the change until fixed.

    I will not default to 'utf-8' because 'ascii' catches erroneous non-ascii characters in ascii-only files. For instance, a draft of README.txt was prepared with an editor that replaced ascii " and " with left and right quotes. I will not restricting the encoding otherwise because there might be external uses of the file that use other encodings.

    PR to follow as soon as I get bpo number.

    @terryjreedy terryjreedy added 3.7 (EOL) end of life 3.8 only security fixes labels Feb 12, 2018
    @terryjreedy terryjreedy self-assigned this Feb 12, 2018
    @terryjreedy terryjreedy added topic-IDLE type-bug An unexpected behavior, bug, or error labels Feb 12, 2018
    @terryjreedy
    Copy link
    Member Author

    New changeset 688722c by Terry Jan Reedy in branch 'master':
    bpo-32837: IDLE - require encoding argument for textview.view_file. (GH-5646)
    688722c

    @miss-islington
    Copy link
    Contributor

    New changeset 65c32bb by Miss Islington (bot) in branch '3.7':
    bpo-32837: IDLE - require encoding argument for textview.view_file. (GH-5646)
    65c32bb

    @miss-islington
    Copy link
    Contributor

    New changeset 9fad857 by Miss Islington (bot) in branch '3.6':
    bpo-32837: IDLE - require encoding argument for textview.view_file. (GH-5646)
    9fad857

    @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
    3.7 (EOL) end of life 3.8 only security fixes topic-IDLE type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants