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

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

Closed
erickt mannequin opened this issue Mar 8, 2009 · 2 comments
Closed

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

erickt mannequin opened this issue Mar 8, 2009 · 2 comments
Labels
stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@erickt
Copy link
Mannequin

erickt mannequin commented Mar 8, 2009

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']

    @erickt
    Copy link
    Mannequin Author

    erickt mannequin commented Mar 8, 2009

    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.

    @erickt erickt mannequin added stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error labels Mar 8, 2009
    @avassalotti
    Copy link
    Member

    Committed in r74316.

    Thanks!

    @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
    stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant