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

Invalid flag for some code page decoders #80493

Closed
serhiy-storchaka opened this issue Mar 16, 2019 · 3 comments
Closed

Invalid flag for some code page decoders #80493

serhiy-storchaka opened this issue Mar 16, 2019 · 3 comments
Assignees
Labels
3.7 (EOL) end of life 3.8 (EOL) end of life interpreter-core (Objects, Python, Grammar, and Parser dirs) OS-windows type-bug An unexpected behavior, bug, or error

Comments

@serhiy-storchaka
Copy link
Member

BPO 36312
Nosy @malemburg, @doerwalter, @pfmoore, @tjguk, @zware, @serhiy-storchaka, @zooba, @miss-islington
PRs
  • bpo-36312: Fix decoders for some code pages. #12369
  • [3.7] bpo-36312: Fix decoders for some code pages. (GH-12369) #12475
  • 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/serhiy-storchaka'
    closed_at = <Date 2019-03-21.15:47:41.883>
    created_at = <Date 2019-03-16.08:59:08.074>
    labels = ['interpreter-core', '3.8', 'type-bug', '3.7', 'OS-windows']
    title = 'Invalid flag for some code page decoders'
    updated_at = <Date 2019-03-21.15:47:41.882>
    user = 'https://github.com/serhiy-storchaka'

    bugs.python.org fields:

    activity = <Date 2019-03-21.15:47:41.882>
    actor = 'serhiy.storchaka'
    assignee = 'serhiy.storchaka'
    closed = True
    closed_date = <Date 2019-03-21.15:47:41.883>
    closer = 'serhiy.storchaka'
    components = ['Interpreter Core', 'Windows']
    creation = <Date 2019-03-16.08:59:08.074>
    creator = 'serhiy.storchaka'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 36312
    keywords = ['patch']
    message_count = 3.0
    messages = ['338067', '338507', '338522']
    nosy_count = 8.0
    nosy_names = ['lemburg', 'doerwalter', 'paul.moore', 'tim.golden', 'zach.ware', 'serhiy.storchaka', 'steve.dower', 'miss-islington']
    pr_nums = ['12369', '12475']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue36312'
    versions = ['Python 3.7', 'Python 3.8']

    @serhiy-storchaka
    Copy link
    Member Author

    From https://docs.microsoft.com/en-us/windows/desktop/api/stringapiset/nf-stringapiset-multibytetowidechar:

    For the code pages listed below, dwFlags must be set to 0. Otherwise, the function fails with ERROR_INVALID_FLAGS.

    50220
    50221
    50222
    50225
    50227
    50229
    57002 through 57011
    65000 (UTF-7)
    42 (Symbol)
    

    But currently in PyUnicode_DecodeCodePageStateful() it is set to MB_ERR_INVALID_CHARS for all code pages except CP_UTF7. This causes an error for all other code pages list above.

    >>> codecs.code_page_decode(50220, b'abc')
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    OSError: [WinError 1004] Invalid flags

    @serhiy-storchaka serhiy-storchaka added 3.7 (EOL) end of life 3.8 (EOL) end of life interpreter-core (Objects, Python, Grammar, and Parser dirs) OS-windows type-bug An unexpected behavior, bug, or error labels Mar 16, 2019
    @serhiy-storchaka serhiy-storchaka self-assigned this Mar 16, 2019
    @serhiy-storchaka
    Copy link
    Member Author

    New changeset c1e2c28 by Serhiy Storchaka in branch 'master':
    bpo-36312: Fix decoders for some code pages. (GH-12369)
    c1e2c28

    @miss-islington
    Copy link
    Contributor

    New changeset 74829b7 by Miss Islington (bot) in branch '3.7':
    bpo-36312: Fix decoders for some code pages. (GH-12369)
    74829b7

    @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 (EOL) end of life interpreter-core (Objects, Python, Grammar, and Parser dirs) OS-windows type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants