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

posixpath.join() and bytearray #66233

Closed
serhiy-storchaka opened this issue Jul 22, 2014 · 4 comments
Closed

posixpath.join() and bytearray #66233

serhiy-storchaka opened this issue Jul 22, 2014 · 4 comments
Assignees
Labels
stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@serhiy-storchaka
Copy link
Member

BPO 22034
Nosy @terryjreedy, @ncoghlan, @pitrou, @merwok, @bitdancer, @cjerdonek, @hynek, @serhiy-storchaka
Files
  • posixpath_join_bytearray-3.4.diff
  • posixpath_join_bytearray-3.5.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/serhiy-storchaka'
    closed_at = <Date 2014-08-24.09:25:57.795>
    created_at = <Date 2014-07-22.09:33:29.737>
    labels = ['type-bug', 'library']
    title = 'posixpath.join() and bytearray'
    updated_at = <Date 2014-08-24.09:25:57.794>
    user = 'https://github.com/serhiy-storchaka'

    bugs.python.org fields:

    activity = <Date 2014-08-24.09:25:57.794>
    actor = 'serhiy.storchaka'
    assignee = 'serhiy.storchaka'
    closed = True
    closed_date = <Date 2014-08-24.09:25:57.795>
    closer = 'serhiy.storchaka'
    components = ['Library (Lib)']
    creation = <Date 2014-07-22.09:33:29.737>
    creator = 'serhiy.storchaka'
    dependencies = []
    files = ['36028', '36029']
    hgrepos = []
    issue_num = 22034
    keywords = ['patch']
    message_count = 4.0
    messages = ['223654', '225261', '225441', '225807']
    nosy_count = 10.0
    nosy_names = ['terry.reedy', 'ncoghlan', 'pitrou', 'eric.araujo', 'Arfrever', 'r.david.murray', 'chris.jerdonek', 'python-dev', 'hynek', 'serhiy.storchaka']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue22034'
    versions = ['Python 3.4', 'Python 3.5']

    @serhiy-storchaka
    Copy link
    Member Author

    posixpath.join() raises misleading exception in case when all arguments are bytearrays:

    >>> import posixpath
    >>> posixpath.join(bytearray(b'foo'), bytearray(b'bar'))
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "/home/serhiy/py/cpython/Lib/posixpath.py", line 91, in join
        "components.") from None
    TypeError: Can't mix strings and bytes in path components.

    This bug was introduced in bpo-15377 and misleading test which provoked it was added in bpo-15180.

    I proposed two patches. Patch for 3.4 only eliminates wrong specialcasing of bytearray (none of os.path methods work with bytearray). Patch for 3.5 also adds better error messages for wrong argument types of posixpath.join (of course we can apply it to 3.4 too).

    @serhiy-storchaka serhiy-storchaka added stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error labels Jul 22, 2014
    @serhiy-storchaka
    Copy link
    Member Author

    Copied nosy list from bpo-15180 and bpo-15377.

    @serhiy-storchaka
    Copy link
    Member Author

    Could anyone please make the review?

    @serhiy-storchaka serhiy-storchaka self-assigned this Aug 17, 2014
    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Aug 24, 2014

    New changeset d9607a71456e by Serhiy Storchaka in branch '3.4':
    Issue bpo-22034: Got rid of misleading error message for bytearray arguments in
    http://hg.python.org/cpython/rev/d9607a71456e

    New changeset db600c927b2b by Serhiy Storchaka in branch 'default':
    Issue bpo-22034: Improve handling of wrong argument types in posixpath.join().
    http://hg.python.org/cpython/rev/db600c927b2b

    @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