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

utf_8_sig streamreader bug, patch, and test #45785

Closed
jgsack mannequin opened this issue Nov 15, 2007 · 5 comments
Closed

utf_8_sig streamreader bug, patch, and test #45785

jgsack mannequin opened this issue Nov 15, 2007 · 5 comments
Assignees
Labels
topic-unicode type-crash A hard crash of the interpreter, possibly with a core dump

Comments

@jgsack
Copy link
Mannequin

jgsack mannequin commented Nov 15, 2007

BPO 1444
Nosy @doerwalter
Files
  • u8sig26.diff
  • test_utf8sig_stream.py
  • diff-u.py26_utf8sig
  • 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/doerwalter'
    closed_at = <Date 2007-11-19.12:50:17.300>
    created_at = <Date 2007-11-15.08:06:32.305>
    labels = ['expert-unicode', 'type-crash']
    title = 'utf_8_sig streamreader bug, patch, and test'
    updated_at = <Date 2007-11-19.12:50:17.298>
    user = 'https://bugs.python.org/jgsack'

    bugs.python.org fields:

    activity = <Date 2007-11-19.12:50:17.298>
    actor = 'doerwalter'
    assignee = 'doerwalter'
    closed = True
    closed_date = <Date 2007-11-19.12:50:17.300>
    closer = 'doerwalter'
    components = ['Unicode']
    creation = <Date 2007-11-15.08:06:32.305>
    creator = 'jgsack'
    dependencies = []
    files = ['8749', '8750', '8764']
    hgrepos = []
    issue_num = 1444
    keywords = ['patch']
    message_count = 5.0
    messages = ['57520', '57523', '57524', '57582', '57633']
    nosy_count = 2.0
    nosy_names = ['doerwalter', 'jgsack']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = None
    status = 'closed'
    superseder = None
    type = 'crash'
    url = 'https://bugs.python.org/issue1444'
    versions = ['Python 2.6', 'Python 2.5']

    @jgsack
    Copy link
    Mannequin Author

    jgsack mannequin commented Nov 15, 2007

    The streamreader in utf_8_sig.py fails when asked to read a specified
    bytelength of data that ends up in the middle of a multibyte utf8 code.

    I will attached a atandalone unittest (which does work from autotest, but
    doesn't use test_support), test_utf8sig_stream.py.

    I will attach a patch (applied to the trunk 2.6 version), u8sig26.diff.

    Regards,
    ..jim

    @jgsack jgsack mannequin added topic-unicode type-crash A hard crash of the interpreter, possibly with a core dump labels Nov 15, 2007
    @jgsack
    Copy link
    Mannequin Author

    jgsack mannequin commented Nov 15, 2007

    Oops, it looks like my patch may have broken test_partial in test_codecs. I
    will try to figure out what the test_partial does in the next day or so,
    unless someone else can add some insignt in the meantime.

    .jim

    @jgsack
    Copy link
    Mannequin Author

    jgsack mannequin commented Nov 15, 2007

    One additional clue: test_codecs succeeds in verbose mode but fails in non-
    verbose mode (autotest "verbosity") .. I think. My eyes are getting
    blurry. More tomorrow, I guess.

    ..j

    @jgsack
    Copy link
    Mannequin Author

    jgsack mannequin commented Nov 16, 2007

    I found the errror in my previous patch. It lacked a self.decode=.. line
    in the StreamReader.decode elif branch.

    I attach a replacement patch diff-u.py26_utf8sig (apply to the 2.6 version
    of utf_8_sig.py. (If allowed, I will next remove the incorrect patch.)

    This one passes test_codecs.py as well as my previously attached test
    module.

    The resulting utf_8_sig.py may benefit from further refctoring, but I
    didn't want to do more than necessary to fix the immediate bug.

    Regards,
    ..jim

    @doerwalter
    Copy link
    Contributor

    Checked in your change and the test as r59049 (trunk) and r59050 (2.5).
    Thanks for the patch.

    @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
    topic-unicode type-crash A hard crash of the interpreter, possibly with a core dump
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant