GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Fix base64-codec and bz2-codec incremental decoders · Issue #71986 · python/cpython

Fix base64-codec and bz2-codec incremental decoders #71986

New issue
Copy link
New issue
Copy link
Open
Open
Fix base64-codec and bz2-codec incremental decoders#71986
Copy link
Labels
stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

Description

@vadmium
vadmium
opened on Aug 19, 2016
Issue body actions
BPO 27799
Nosy @vadmium
Files
  • base64-decoder.patch
  • 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 = None
    created_at = <Date 2016-08-19.11:52:00.605>
    labels = ['type-bug', 'library']
    title = 'Fix base64-codec and bz2-codec incremental decoders'
    updated_at = <Date 2016-08-19.11:52:00.605>
    user = 'https://github.com/vadmium'

    bugs.python.org fields:

    activity = <Date 2016-08-19.11:52:00.605>
    actor = 'martin.panter'
    assignee = 'none'
    closed = False
    closed_date = None
    closer = None
    components = ['Library (Lib)']
    creation = <Date 2016-08-19.11:52:00.605>
    creator = 'martin.panter'
    dependencies = []
    files = ['44149']
    hgrepos = []
    issue_num = 27799
    keywords = ['patch']
    message_count = 1.0
    messages = ['273106']
    nosy_count = 1.0
    nosy_names = ['martin.panter']
    pr_nums = []
    priority = 'normal'
    resolution = None
    stage = 'patch review'
    status = 'open'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue27799'
    versions = ['Python 2.7', 'Python 3.5', 'Python 3.6']

    Linked PRs

    • gh-71986: Fix the base64 and bz2 codec incremental decoders #160981

    Activity

    1. vadmium commented on Aug 19, 2016

      @vadmium
      vadmium
      on Aug 19, 2016
      MemberAuthor
      More actions

      This is split off a large patch I posted at bpo-20132. My new patch here fixes the following two flaws.

      1. There is special code in the bz2 decoder that returns an empty text str object at EOF, even though bz2-codec is a bytes-to-bytes codec:
      >>> import codecs
      >>> decoder = codecs.getincrementaldecoder("bz2")()
      >>> decoder.decode(codecs.encode(b"data", "bz2"))
      b'data'
      >>> decoder.decode(b"", final=True)  # Should return bytes object
      ''
      
      2. The base64 decoder does not handle partial sets of four codes, because it treats each input chunk as a stand-alone base64 encoding:
      >>> tuple(codecs.iterdecode((b"AA", b"AA\r\n"), "base64"))
      Traceback (most recent call last):
        File "<stdin>", line 1, in <module>
        File "/usr/lib/python3.5/codecs.py", line 1039, in iterdecode
          output = decoder.decode(input)
        File "/usr/lib/python3.5/encodings/base64_codec.py", line 35, in decode
          return base64.decodebytes(input)
        File "/usr/lib/python3.5/base64.py", line 554, in decodebytes
          return binascii.a2b_base64(s)
      binascii.Error: Incorrect padding
    2. vadmium
      added
      stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directory
      type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
      on Aug 19, 2016
    3. ezio-melotti
      transferred this issue fromon Apr 10, 2022
    4. serhiy-storchaka
      added this to Compression issues 🗜and Codecs and encodings issueson May 21, 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

      stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

      Projects

      • Compression issues 🗜
        Status
        No status
        Show more project fields
      • Codecs and encodings issues
        Status
        No status
        Show more project fields

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.