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

Add a new -X dev option: "developer mode" #76224

Closed
vstinner opened this issue Nov 16, 2017 · 7 comments
Closed

Add a new -X dev option: "developer mode" #76224

vstinner opened this issue Nov 16, 2017 · 7 comments
Labels
3.7 interpreter-core type-feature

Comments

@vstinner
Copy link
Member

@vstinner vstinner commented Nov 16, 2017

BPO 32043
Nosy @warsaw, @vstinner
PRs
  • #4413
  • #4478
  • 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 2017-11-21.03:03:29.377>
    created_at = <Date 2017-11-16.02:43:27.272>
    labels = ['interpreter-core', 'type-feature', '3.7']
    title = 'Add a new -X dev option: "developer mode"'
    updated_at = <Date 2017-11-21.03:03:29.376>
    user = 'https://github.com/vstinner'

    bugs.python.org fields:

    activity = <Date 2017-11-21.03:03:29.376>
    actor = 'vstinner'
    assignee = 'none'
    closed = True
    closed_date = <Date 2017-11-21.03:03:29.377>
    closer = 'vstinner'
    components = ['Interpreter Core']
    creation = <Date 2017-11-16.02:43:27.272>
    creator = 'vstinner'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 32043
    keywords = ['patch']
    message_count = 7.0
    messages = ['306330', '306331', '306351', '306357', '306619', '306620', '306621']
    nosy_count = 2.0
    nosy_names = ['barry', 'vstinner']
    pr_nums = ['4413', '4478']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue32043'
    versions = ['Python 3.7']

    @vstinner
    Copy link
    Member Author

    @vstinner vstinner commented Nov 16, 2017

    I propose to add a new "developer mode": a new "-X dev" command line option.

    In short:
    python3 -X dev script.py
    behaves as:
    PYTHONMALLOC=debug python3 -W default -X faulthandler script.py

    For the rationale, please see:
    https://mail.python.org/pipermail/python-dev/2017-November/150514.html

    @vstinner vstinner added 3.7 interpreter-core type-feature labels Nov 16, 2017
    @vstinner
    Copy link
    Member Author

    @vstinner vstinner commented Nov 16, 2017

    I rewrote Py_Main() in bpo-32030 to make it very easy to implement this new feature.

    I wrote PR 4413 to implement -X dev.

    @vstinner
    Copy link
    Member Author

    @vstinner vstinner commented Nov 16, 2017

    New changeset ccb0442 by Victor Stinner in branch 'master':
    bpo-32043: New "developer mode": "-X dev" option (bpo-4413)
    ccb0442

    @vstinner
    Copy link
    Member Author

    @vstinner vstinner commented Nov 16, 2017

    Antoine Pitrou asked me to document the performance and memory overhead of -X dev:

    https://mail.python.org/pipermail/python-dev/2017-November/150578.html

    For example, I measured an increase of +50% on the peak memory usage (measured by tracemalloc) when running test_os.

    Antoine proposed:

    """Currently, developer mode adds negligible CPU time overhead, but can
    increase memory consumption significantly if many small objects are
    allocated. This is subject to change in the future."""

    https://mail.python.org/pipermail/python-dev/2017-November/150579.html

    @vstinner
    Copy link
    Member Author

    @vstinner vstinner commented Nov 21, 2017

    I created bpo-32101: Add PYTHONDEVMODE=1 to enable the developer mode.

    @vstinner
    Copy link
    Member Author

    @vstinner vstinner commented Nov 21, 2017

    New changeset bc9b6e2 by Victor Stinner in branch 'master':
    bpo-32043: Rephrase -X dev documentation (bpo-4478)
    bc9b6e2

    @vstinner
    Copy link
    Member Author

    @vstinner vstinner commented Nov 21, 2017

    While the discussion is not done, I close this issue to focus on other more specific issues.

    I completed the documentation and fixed warnings filters (bpo-32089). The option now also enables asyncio debug mode (bpo-32047).

    It was proposed to add an environment variable to enable the developer mode: see bpo-32101 ("Add PYTHONDEVMODE=1 to enable the developer mode").

    Note: I also fixed subprocess._args_from_interpreter_flags: bpo-32094.

    @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
    3.7 interpreter-core type-feature
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant