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

maxlevels -1 on compileall for unlimited recursion #63827

Closed
Sworddragon mannequin opened this issue Nov 16, 2013 · 10 comments
Closed

maxlevels -1 on compileall for unlimited recursion #63827

Sworddragon mannequin opened this issue Nov 16, 2013 · 10 comments
Labels
stdlib Python modules in the Lib dir type-feature A feature request or enhancement

Comments

@Sworddragon
Copy link
Mannequin

Sworddragon mannequin commented Nov 16, 2013

BPO 19628
Nosy @benjaminp, @bitdancer, @PCManticore, @berkerpeksag
Files
  • compileall.patch
  • issue19628.patch: Minor fixes.
  • issue19628_1.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 2014-08-19.21:13:36.739>
    created_at = <Date 2013-11-16.20:40:50.753>
    labels = ['type-feature', 'library']
    title = 'maxlevels -1 on compileall for unlimited recursion'
    updated_at = <Date 2015-10-28.08:27:28.935>
    user = 'https://bugs.python.org/Sworddragon'

    bugs.python.org fields:

    activity = <Date 2015-10-28.08:27:28.935>
    actor = 'Sworddragon'
    assignee = 'none'
    closed = True
    closed_date = <Date 2014-08-19.21:13:36.739>
    closer = 'python-dev'
    components = ['Library (Lib)']
    creation = <Date 2013-11-16.20:40:50.753>
    creator = 'Sworddragon'
    dependencies = []
    files = ['32764', '34360', '34786']
    hgrepos = []
    issue_num = 19628
    keywords = ['patch']
    message_count = 10.0
    messages = ['203081', '203685', '215897', '215935', '221619', '221621', '225541', '225542', '225544', '253591']
    nosy_count = 6.0
    nosy_names = ['benjamin.peterson', 'r.david.murray', 'Claudiu.Popa', 'Sworddragon', 'python-dev', 'berker.peksag']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue19628'
    versions = ['Python 3.5']

    @Sworddragon
    Copy link
    Mannequin Author

    Sworddragon mannequin commented Nov 16, 2013

    All functions of compileall are providing a maxlevels argument which defaults to 10. But it is currently not possible to disable this recursion limitation. Maybe it would be useful to have a special value like -1 to disable this limitation and allow to compile in an infinite amount of subdirectories.

    Also I'm noticing maxlevels is the only argument which is not available on command line. Does it default there to 10 too? Maybe it would be useful if it could be configured too (in this case it could theoretically replace -l).

    @Sworddragon Sworddragon mannequin added stdlib Python modules in the Lib dir type-feature A feature request or enhancement labels Nov 16, 2013
    @PCManticore
    Copy link
    Mannequin

    PCManticore mannequin commented Nov 21, 2013

    Here's a patch which adds support for controlling the maxlevels on command line. Currently, compileall uses a binary choice, either we don't process subdirectories or we process at most 10 subdirectories. This seems to be the case since its inception, in
    "
    Changeset:
    1828 (b464e1d0b2fb) New way of generating .pyc files, thanks to Sjoerd.
    User:
    Guido van Rossum <guido@python.org>
    Date:
    1994-08-29 10:52:58 +0000 (1994-08-29)
    "

    The patch adds a new command option, -r, where -r 0 is equivalent to specifying -l. I guess we can't modify -l to actually control the maxlevels, due to backward compatibility concerns.

    @PCManticore
    Copy link
    Mannequin

    PCManticore mannequin commented Apr 10, 2014

    Ping. :) Can someone review this patch, please?

    @PCManticore
    Copy link
    Mannequin

    PCManticore mannequin commented Apr 11, 2014

    Added patch which addresses the comments of Berker Peksag. Thanks for the review!

    @bitdancer
    Copy link
    Member

    bitdancer commented Jun 26, 2014

    Do we really want to allow infinite recursion (say a symbolic link loop)?

    @bitdancer
    Copy link
    Member

    bitdancer commented Jun 26, 2014

    Ah, bad font, I thought the -l was a -1. I see you aren't adding the infinite recursion, the just ability to control the maximum. The patch looks good to me.

    @benjaminp
    Copy link
    Contributor

    benjaminp commented Aug 19, 2014

    Why can't we just reuse the "-l" option?

    @PCManticore
    Copy link
    Mannequin

    PCManticore mannequin commented Aug 19, 2014

    Backward compatibility reasons, I guess. compileall -l completely deactivates the recursion, so using -l for controlling the number of levels seems to overwrite its original meaning.

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Aug 19, 2014

    New changeset a62368778d6c by Benjamin Peterson in branch 'default':
    allow recursion depth to be specified (closes bpo-19628)
    http://hg.python.org/cpython/rev/a62368778d6c

    @python-dev python-dev mannequin closed this as completed Aug 19, 2014
    @Sworddragon
    Copy link
    Mannequin Author

    Sworddragon mannequin commented Oct 28, 2015

    I'm wondering what the recursion limit is if -l and -r are not given. Does it default to 10 too or is there no limit? If the first is the case maybe this should also get documented.

    @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-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants