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

distutils.file_util.move_file unpacks wrongly an exception #66378

Closed
PCManticore mannequin opened this issue Aug 11, 2014 · 5 comments
Closed

distutils.file_util.move_file unpacks wrongly an exception #66378

PCManticore mannequin opened this issue Aug 11, 2014 · 5 comments
Assignees
Labels
stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@PCManticore
Copy link
Mannequin

PCManticore mannequin commented Aug 11, 2014

BPO 22182
Nosy @merwok, @PCManticore, @berkerpeksag, @dstufft
Files
  • distutils_unpacking_exception.patch
  • issue22182.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 = 'https://github.com/berkerpeksag'
    closed_at = <Date 2014-08-29.04:10:21.653>
    created_at = <Date 2014-08-11.12:38:56.131>
    labels = ['type-bug', 'library']
    title = 'distutils.file_util.move_file unpacks wrongly an exception'
    updated_at = <Date 2014-08-29.04:10:21.651>
    user = 'https://github.com/PCManticore'

    bugs.python.org fields:

    activity = <Date 2014-08-29.04:10:21.651>
    actor = 'berker.peksag'
    assignee = 'berker.peksag'
    closed = True
    closed_date = <Date 2014-08-29.04:10:21.653>
    closer = 'berker.peksag'
    components = ['Distutils']
    creation = <Date 2014-08-11.12:38:56.131>
    creator = 'Claudiu.Popa'
    dependencies = []
    files = ['36345', '36346']
    hgrepos = []
    issue_num = 22182
    keywords = ['patch']
    message_count = 5.0
    messages = ['225184', '225185', '225894', '226049', '226050']
    nosy_count = 5.0
    nosy_names = ['eric.araujo', 'Claudiu.Popa', 'python-dev', 'berker.peksag', 'dstufft']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue22182'
    versions = ['Python 3.4', 'Python 3.5']

    @PCManticore
    Copy link
    Mannequin Author

    PCManticore mannequin commented Aug 11, 2014

    Hi. When os.rename fails inside distutils.file_util.move_file, the exception is unpacked using (num, msg) = e. While this was valid in Python 2, in Python 3 it should be e.args. The attached patched fixes this.

    @PCManticore PCManticore mannequin added stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error labels Aug 11, 2014
    @PCManticore
    Copy link
    Mannequin Author

    PCManticore mannequin commented Aug 11, 2014

    Mm, it seems there's another instance of unpacking later on, when os.unlink fails. Here's the updated patch.

    @berkerpeksag
    Copy link
    Member

    LGTM. The second test should be named different, but I will fix it myself. Thanks for the patch!

    @berkerpeksag berkerpeksag self-assigned this Aug 25, 2014
    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Aug 29, 2014

    New changeset a3452677a386 by Berker Peksag in branch '3.4':
    Issue bpo-22182: Use e.args to unpack exceptions correctly in distutils.file_util.move_file.
    http://hg.python.org/cpython/rev/a3452677a386

    New changeset f01413758114 by Berker Peksag in branch 'default':
    Issue bpo-22182: Use e.args to unpack exceptions correctly in distutils.file_util.move_file.
    http://hg.python.org/cpython/rev/f01413758114

    @berkerpeksag
    Copy link
    Member

    Thanks Claudiu.

    @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