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

StreamReader broken for byte string to byte string codecs #42201

Closed
pysquared mannequin opened this issue Jul 20, 2005 · 2 comments
Closed

StreamReader broken for byte string to byte string codecs #42201

pysquared mannequin opened this issue Jul 20, 2005 · 2 comments
Labels
stdlib Python modules in the Lib dir

Comments

@pysquared
Copy link
Mannequin

pysquared mannequin commented Jul 20, 2005

BPO 1241507
Nosy @doerwalter
Files
  • streamreadbug.py: Exercise the bug
  • 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 2005-07-20.22:53:20.000>
    created_at = <Date 2005-07-20.11:47:03.000>
    labels = ['library']
    title = 'StreamReader broken for byte string to byte string codecs'
    updated_at = <Date 2005-07-20.22:53:20.000>
    user = 'https://bugs.python.org/pysquared'

    bugs.python.org fields:

    activity = <Date 2005-07-20.22:53:20.000>
    actor = 'doerwalter'
    assignee = 'none'
    closed = True
    closed_date = None
    closer = None
    components = ['Library (Lib)']
    creation = <Date 2005-07-20.11:47:03.000>
    creator = 'pysquared'
    dependencies = []
    files = ['1744']
    hgrepos = []
    issue_num = 1241507
    keywords = []
    message_count = 2.0
    messages = ['25838', '25839']
    nosy_count = 2.0
    nosy_names = ['doerwalter', 'pysquared']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = None
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue1241507'
    versions = ['Python 2.4']

    @pysquared
    Copy link
    Mannequin Author

    pysquared mannequin commented Jul 20, 2005

    print sys.version
    2.4.1 (#2, Jul 12 2005, 09:22:25)
    [GCC 4.0.1 (Debian 4.0.1-1)]

    Decoding to what (according to the documentation)
    should be a byte string (using StreamReader) does one
    of 2 incorrect things, depending on the default encoding:

    1. If the byte string has values not in the current
      default encoding then StreamReader.read() incorrectly
      triggers an exception.

    2. If the byte string can be accomodated by the current
      default encoding then StreamReader.read() incorrectly
      returns a unicode object.

    The documentation says in lib/standard-encodings.html:
    "The result of the ``decoding'' direction is listed
    as operand type in the table."
    "base64_codec ... byte string"

    (This bug does not exist in python2.2 or 2.3)

    The attached script demonstrates the 2 related bugs.

    Many thanks,
    Graham

    @pysquared pysquared mannequin closed this as completed Jul 20, 2005
    @pysquared pysquared mannequin added the stdlib Python modules in the Lib dir label Jul 20, 2005
    @pysquared pysquared mannequin closed this as completed Jul 20, 2005
    @pysquared pysquared mannequin added the stdlib Python modules in the Lib dir label Jul 20, 2005
    @doerwalter
    Copy link
    Contributor

    Logged In: YES
    user_id=89016

    Checked in a fix as:

    Lib/codecs.py 1.46
    Lib/test/test_codecs.py 1.24
    Lib/codecs.py 1.35.2.8
    Lib/test/test_codecs.py 1.15.2.6

    Thanks for the report.

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 9, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    stdlib Python modules in the Lib dir
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant