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

Zip files created by git archive result in a SyntaxError (due to comment?) #66518

Closed
Lekensteyn mannequin opened this issue Sep 1, 2014 · 2 comments
Closed

Zip files created by git archive result in a SyntaxError (due to comment?) #66518

Lekensteyn mannequin opened this issue Sep 1, 2014 · 2 comments
Labels
extension-modules C modules in the Modules dir type-bug An unexpected behavior, bug, or error

Comments

@Lekensteyn
Copy link
Mannequin

Lekensteyn mannequin commented Sep 1, 2014

BPO 22322
Nosy @bitdancer, @Lekensteyn
Superseder
  • bpo-5950: Make zipimport work with zipfile containing comments
  • 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 2014-09-01.16:26:14.359>
    created_at = <Date 2014-09-01.15:11:58.076>
    labels = ['extension-modules', 'type-bug']
    title = 'Zip files created by `git archive` result in a SyntaxError (due to comment?)'
    updated_at = <Date 2014-09-01.16:26:14.357>
    user = 'https://github.com/Lekensteyn'

    bugs.python.org fields:

    activity = <Date 2014-09-01.16:26:14.357>
    actor = 'r.david.murray'
    assignee = 'none'
    closed = True
    closed_date = <Date 2014-09-01.16:26:14.359>
    closer = 'r.david.murray'
    components = ['Extension Modules']
    creation = <Date 2014-09-01.15:11:58.076>
    creator = 'lekensteyn'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 22322
    keywords = []
    message_count = 2.0
    messages = ['226230', '226233']
    nosy_count = 2.0
    nosy_names = ['r.david.murray', 'lekensteyn']
    pr_nums = []
    priority = 'normal'
    resolution = 'duplicate'
    stage = 'resolved'
    status = 'closed'
    superseder = '5950'
    type = 'behavior'
    url = 'https://bugs.python.org/issue22322'
    versions = ['Python 2.7', 'Python 3.4']

    @Lekensteyn
    Copy link
    Mannequin Author

    Lekensteyn mannequin commented Sep 1, 2014

    Files created by git archive are not understood by the Python interpreter. This could be caused by the additional comment (for the commit hash) in the file.

    echo 'print(1)' > __main__.py
    git init && git add __main__.py && git commit -m init
    git archive --format=zip HEAD > y.zip
    python y.zip

    Packing it with zip x.zip __main__.py && python x.zip works.

    @Lekensteyn Lekensteyn mannequin added extension-modules C modules in the Modules dir type-bug An unexpected behavior, bug, or error labels Sep 1, 2014
    @bitdancer
    Copy link
    Member

    You are correct. zipimport does not support zip files with comments. There is already an open issue (bpo-5950) for adding support for this.

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

    No branches or pull requests

    1 participant