Skip to content

bug fix to prevent io.BytesIO from accepting arbitrary keyword arguments #49699

Closed

Description

@erickt
mannequin
BPO 5449
Nosy @pitrou, @avassalotti, @benjaminp
Files
  • 0001-Fix-io.BytesIO-to-not-accept-arbitrary-keywords.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 = <Date 2009-08-04.23:21:23.779>
    created_at = <Date 2009-03-08.23:52:58.566>
    labels = ['type-bug', 'library']
    title = 'bug fix to prevent io.BytesIO from accepting arbitrary keyword arguments'
    updated_at = <Date 2009-08-04.23:21:23.777>
    user = 'https://bugs.python.org/erickt'

    bugs.python.org fields:

    activity = <Date 2009-08-04.23:21:23.777>
    actor = 'alexandre.vassalotti'
    assignee = 'none'
    closed = True
    closed_date = <Date 2009-08-04.23:21:23.779>
    closer = 'alexandre.vassalotti'
    components = ['Library (Lib)']
    creation = <Date 2009-03-08.23:52:58.566>
    creator = 'erickt'
    dependencies = []
    files = ['13271']
    hgrepos = []
    issue_num = 5449
    keywords = ['patch']
    message_count = 2.0
    messages = ['83337', '91283']
    nosy_count = 4.0
    nosy_names = ['pitrou', 'alexandre.vassalotti', 'benjamin.peterson', 'erickt']
    pr_nums = []
    priority = 'normal'
    resolution = 'accepted'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue5449'
    versions = ['Python 3.0', 'Python 3.1']

    Activity

    1. erickt commented on Mar 8, 2009

      ericktmannequin
      MannequinAuthor

      I noticed that it was possible to specify arbitrary arguments to
      io.BytesIO:

      >>> io.BytesIO(b'foo', foo=1)
      <_io.BytesIO object at 0x430150>

      But io.StringIO doesn't:

      >>> io.StringIO('foo', foo=1)
      Traceback (most recent call last):
        File "<stdin>", line 1, in <module>
      TypeError: 'foo' is an invalid keyword argument for this function

      So, I've attached a little patch that uses the same technique 3.1a1 uses
      to parse the arguments. One thing to be aware of is that I named the
      kwarg "intial_bytes" just like http://docs.python.org/3.0/library/io.html#io.BytesIO instead of
      "inital_value" like io.StringIO. I'm not sure if it'd be desirable to be
      consistent between the two.

    2. added
      stdlibStandard Library Python modules in the Lib/ directory
      type-bugAn unexpected behavior, bug, or error
      on Mar 8, 2009
    3. avassalotti commented on Aug 4, 2009

      @avassalotti
      Member

      Committed in r74316.

      Thanks!

    4. transferred this issue fromon Apr 10, 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/ directorytype-bugAn unexpected behavior, bug, or error

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions