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

PEP 338 implementation #42889

Closed
ncoghlan opened this issue Feb 11, 2006 · 13 comments
Closed

PEP 338 implementation #42889

ncoghlan opened this issue Feb 11, 2006 · 13 comments

Comments

@ncoghlan
Copy link
Contributor

BPO 1429601
Nosy @ncoghlan
Files
  • runpy_demo.zip: Demo hierarchy for trying out runpy
  • pep338_switch.diff: Integrate -m switch with runpy module (version 2)
  • runpy.py: PEP 338 implementation (version 6)
  • test_runpy.py: Version 2 of unit tests for runpy.py
  • 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 2006-03-17.10:06:29.000>
    created_at = <Date 2006-02-11.09:04:49.000>
    labels = []
    title = 'PEP 338 implementation'
    updated_at = <Date 2006-03-17.10:06:29.000>
    user = 'https://github.com/ncoghlan'

    bugs.python.org fields:

    activity = <Date 2006-03-17.10:06:29.000>
    actor = 'ncoghlan'
    assignee = 'none'
    closed = True
    closed_date = None
    closer = None
    components = ['None']
    creation = <Date 2006-02-11.09:04:49.000>
    creator = 'ncoghlan'
    dependencies = []
    files = ['6997', '6998', '6999', '7000']
    hgrepos = []
    issue_num = 1429601
    keywords = ['patch']
    message_count = 13.0
    messages = ['49457', '49458', '49459', '49460', '49461', '49462', '49463', '49464', '49465', '49466', '49467', '49468', '49469']
    nosy_count = 1.0
    nosy_names = ['ncoghlan']
    pr_nums = []
    priority = 'normal'
    resolution = None
    stage = None
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue1429601'
    versions = []

    @ncoghlan
    Copy link
    Contributor Author

    This PEP implementation contains three parts - a
    separate Python module (runpy.py) that implements the
    PEP-338 functionality, a corresponding test module
    (test_runpy.py) and a patch against current subversion
    to integrate the module with the -m command line switch.

    The documentation for the new module will be submitted
    as a separate patch (since the review cycle is a bit
    different).

    @ncoghlan
    Copy link
    Contributor Author

    Logged In: YES
    user_id=1038590

    Updated to avoid trying to hide exec's quirks.

    @ncoghlan
    Copy link
    Contributor Author

    Logged In: YES
    user_id=1038590

    Version 3 of implementation. Fixed emulator to generate an
    ImportError for non-packages (instead of an AttributeError
    in some cases).

    Removed extraneous print statements from emulator.

    @ncoghlan
    Copy link
    Contributor Author

    Logged In: YES
    user_id=1038590

    Added basic test suite. Could use beefing up in the area of
    actually checking that running modules inside packages works
    correctly (I'm currently checking that bit manually).

    @ncoghlan
    Copy link
    Contributor Author

    Logged In: YES
    user_id=1038590

    Version 4 of implementation. Fixes problem with not handling
    nested packages and raises ImportError in run_module when no
    loader is found.

    @ncoghlan
    Copy link
    Contributor Author

    Logged In: YES
    user_id=1038590

    Version 5. Removed an import that is now redundant, added a
    comment header with author information.

    @ncoghlan
    Copy link
    Contributor Author

    Logged In: YES
    user_id=1038590

    Added patch to main.c for integration with command line switch.

    @ncoghlan
    Copy link
    Contributor Author

    Logged In: YES
    user_id=1038590

    I've attached a zip archive of the directory tree I've been
    using to check that the runpy module works correctly. For
    each of these command lines:

    python -m runpy_demo.test
    python -m runpy_demo.pkg.test
    python -m runpy_demo.pkg.pkg.test
    python -m runpy_demo.pkg.zip_pkg.test

    The message "Running runpy_demo.test" should then print to
    the console (with the second part of the message changing as
    appropriate for the other 3 modules).

    The last one obviously won't work if zlib isn't installed,
    and all 4 require that both runpy and runpy_demo be on
    sys.path (e.g in site-packages, or in the Lib directory).

    On older Python versions (or without applying the patch),
    invoking runpy directly is enough to make it work

    python -m runpy runpy_demo.test
    python -m runpy runpy_demo.pkg.test
    python -m runpy runpy_demo.pkg.pkg.test
    python -m runpy runpy_demo.pkg.zip_pkg.test

    @ncoghlan
    Copy link
    Contributor Author

    Logged In: YES
    user_id=1038590

    Fixed error handling in main.c when the function call
    results in an exception. (version 2 of integration diff).

    @ncoghlan
    Copy link
    Contributor Author

    Logged In: YES
    user_id=1038590

    PEP-338 has been updated as of 18-Feb-2006. Those changes
    are still to be incorporated into this implementation.

    @ncoghlan
    Copy link
    Contributor Author

    Logged In: YES
    user_id=1038590

    Updated module to match Feb 18 version of PEP (version 6 of
    module)

    @ncoghlan
    Copy link
    Contributor Author

    Logged In: YES
    user_id=1038590

    Updated unit tests to match Feb 18 version of PEP and to
    cover executing both source and compiled files from the file
    system.

    (version 2 of test_runpy module)

    @ncoghlan
    Copy link
    Contributor Author

    Logged In: YES
    user_id=1038590

    Slightly updated version of patch committed in SVN

    @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
    None yet
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant