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

bytearray.translate() should support None first argument #49009

Closed
birkenfeld opened this issue Dec 27, 2008 · 4 comments
Closed

bytearray.translate() should support None first argument #49009

birkenfeld opened this issue Dec 27, 2008 · 4 comments
Assignees
Labels
interpreter-core (Objects, Python, Grammar, and Parser dirs) type-bug An unexpected behavior, bug, or error

Comments

@birkenfeld
Copy link
Member

BPO 4759
Nosy @birkenfeld, @pitrou, @benjaminp
Files
  • bytearray-translate.diff
  • 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/birkenfeld'
    closed_at = <Date 2008-12-28.11:55:39.811>
    created_at = <Date 2008-12-27.23:28:50.931>
    labels = ['interpreter-core', 'type-bug']
    title = 'bytearray.translate() should support None first argument'
    updated_at = <Date 2008-12-28.11:55:39.802>
    user = 'https://github.com/birkenfeld'

    bugs.python.org fields:

    activity = <Date 2008-12-28.11:55:39.802>
    actor = 'georg.brandl'
    assignee = 'georg.brandl'
    closed = True
    closed_date = <Date 2008-12-28.11:55:39.811>
    closer = 'georg.brandl'
    components = ['Interpreter Core']
    creation = <Date 2008-12-27.23:28:50.931>
    creator = 'georg.brandl'
    dependencies = []
    files = ['12476']
    hgrepos = []
    issue_num = 4759
    keywords = ['patch']
    message_count = 4.0
    messages = ['78390', '78392', '78396', '78397']
    nosy_count = 3.0
    nosy_names = ['georg.brandl', 'pitrou', 'benjamin.peterson']
    pr_nums = []
    priority = 'normal'
    resolution = 'accepted'
    stage = 'patch review'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue4759'
    versions = ['Python 3.1', 'Python 2.7']

    @birkenfeld
    Copy link
    Member Author

    bytes.translate() does. Patch attached.

    @birkenfeld birkenfeld added interpreter-core (Objects, Python, Grammar, and Parser dirs) type-bug An unexpected behavior, bug, or error labels Dec 27, 2008
    @benjaminp
    Copy link
    Contributor

    Looks good to me. I don't think it should be applied to 3.0, though.

    @pitrou
    Copy link
    Member

    pitrou commented Dec 28, 2008

    Looks like there's a problem:

    >>> bytearray().translate(None, None)
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    TypeError: Type NoneType doesn't support the buffer API
    >>> bytearray().translate(None, None)
    Erreur de segmentation

    Also, the patch should probably be backported to trunk.

    @birkenfeld
    Copy link
    Member Author

    You're right (but the segfault isn't introduced by the patch).

    Fixed segfault in 3.0 and 2.6 in r67975 and r67977.
    Applied path in 3k and trunk in r67974 and r67976.

    @birkenfeld birkenfeld assigned birkenfeld and unassigned pitrou Dec 28, 2008
    @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
    interpreter-core (Objects, Python, Grammar, and Parser dirs) type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    3 participants