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

Minimal cleanup of run.py #41903

Closed
mdehoon mannequin opened this issue Apr 26, 2005 · 2 comments
Closed

Minimal cleanup of run.py #41903

mdehoon mannequin opened this issue Apr 26, 2005 · 2 comments
Assignees

Comments

@mdehoon
Copy link
Mannequin

mdehoon mannequin commented Apr 26, 2005

BPO 1190163
Nosy @kbkaiser
Files
  • run.py.diff: Patch to run.py in Lib/idlelib
  • 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/kbkaiser'
    closed_at = <Date 2005-05-05.23:30:33.000>
    created_at = <Date 2005-04-26.10:50:29.000>
    labels = ['expert-IDLE']
    title = 'Minimal cleanup of run.py'
    updated_at = <Date 2005-05-05.23:30:33.000>
    user = 'https://bugs.python.org/mdehoon'

    bugs.python.org fields:

    activity = <Date 2005-05-05.23:30:33.000>
    actor = 'kbk'
    assignee = 'kbk'
    closed = True
    closed_date = None
    closer = None
    components = ['IDLE']
    creation = <Date 2005-04-26.10:50:29.000>
    creator = 'mdehoon'
    dependencies = []
    files = ['6633']
    hgrepos = []
    issue_num = 1190163
    keywords = ['patch']
    message_count = 2.0
    messages = ['48261', '48262']
    nosy_count = 2.0
    nosy_names = ['kbk', 'mdehoon']
    pr_nums = []
    priority = 'normal'
    resolution = 'accepted'
    stage = None
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue1190163'
    versions = []

    @mdehoon
    Copy link
    Mannequin Author

    mdehoon mannequin commented Apr 26, 2005

    In the main function in run.py in Lib/idlelib, we have

    try:
    seq, request = rpc.request_queue.get(0)
    except Queue.Empty:
    time.sleep(0.05)
    continue

    The get method of rpc.request_queue already has the
    option of a timeout, so we can use that instead of
    inlining time.sleep:

    try:
    seq, request = rpc.request_queue.get(block=True,

     timeout=0.05)
    

    except Queue.Empty:
    continue

    resulting in a (small) simplication of the code. The
    patch was tested on Windows, Linux, and Mac OS X.

    In case you are wondering why I care about this:
    My real interest is in PyOS_InputHook, a pointer to a
    function which is called ten times per second when
    Python is idle (e.g., waiting for user input).
    Currently, calls to PyOS_InputHook are missing in some
    cases where Python goes idle. I am going through the
    code to fix this. Now, since both the original code in
    run.py and rpc.request_queue.get cause Python to go
    idle (by calling the sleep function), it means that I
    would have to fix both cases. By making use of the
    existing code in rpc.request_queue.get, I need to fix
    this routine only (which I will do in a later patch),
    and avoids having calls to PyOS_InputHook all over the
    place.

    @mdehoon mdehoon mannequin closed this as completed Apr 26, 2005
    @mdehoon mdehoon mannequin assigned kbkaiser Apr 26, 2005
    @mdehoon mdehoon mannequin added the topic-IDLE label Apr 26, 2005
    @kbkaiser
    Copy link
    Contributor

    kbkaiser commented May 5, 2005

    Logged In: YES
    user_id=149084

    run.py rev 1.32

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 9, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant