Skip to content

gh-161032: Convert BaseEventLoop._clock_resolution to asyncio.constants.CLOCK_RESOLUTION - #161033

Merged
kumaraditya303 merged 3 commits into
python:mainfrom
asvetlov:claude/clock-resolution-constant-1660dc
Nov 3, 2026
Merged

kumaraditya303 merged 3 commits into
python:mainfrom
asvetlov:claude/clock-resolution-constant-1660dc

Conversation

@asvetlov

@asvetlov asvetlov commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

BaseEventLoop.__init__ queried time.get_clock_info('monotonic').resolution for every loop and stored it in the private _clock_resolution attribute, which only _run_once reads. The value is process-wide and never changes, so compute it once as asyncio.constants.CLOCK_RESOLUTION.

🤖 Generated with Claude Code

…onstants.CLOCK_RESOLUTION

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kumaraditya303
kumaraditya303 merged commit 97ff57f into python:main Nov 3, 2026
94 of 95 checks passed
@bedevere-bot

Copy link
Copy Markdown

⚠️⚠️⚠️ Buildbot failure ⚠️⚠️⚠️

Hi! The buildbot s390x RHEL9 LTO + PGO 3.x (tier-3) has failed when building commit 97ff57f.

What do you need to do:

  1. Don't panic.
  2. Check the buildbot page in the devguide if you don't know what the buildbots are or how they work.
  3. Go to the page of the buildbot that failed (https://buildbot.python.org/#/builders/1578/builds/5937) and take a look at the build logs.
  4. Check if the failure is related to this commit (97ff57f) or if it is a false positive.
  5. If the failure is related to this commit, please, reflect that on the issue and make a new Pull Request with a fix.

You can take a look at the buildbot page here:

https://buildbot.python.org/#/builders/1578/builds/5937

Failed tests:

  • test_profiling

Summary of the results of the build (if available):

==

Click to see traceback logs
Traceback (most recent call last):
  File "/var/lib/buildbot/worker/cstratak-rhel9-s390x/3.x.cstratak-rhel9-s390x.lto-pgo/build/Lib/profiling/sampling/cli.py", line 1387, in _handle_live_run
    process = _run_with_sync(cmd, suppress_output=True)
  File "/var/lib/buildbot/worker/cstratak-rhel9-s390x/3.x.cstratak-rhel9-s390x.lto-pgo/build/Lib/profiling/sampling/cli.py", line 302, in _run_with_sync
    _wait_for_ready_signal(sync_sock, process, _SYNC_TIMEOUT_SEC)
    ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/var/lib/buildbot/worker/cstratak-rhel9-s390x/3.x.cstratak-rhel9-s390x.lto-pgo/build/Lib/profiling/sampling/cli.py", line 242, in _wait_for_ready_signal
    _check_process_died(process)
    ~~~~~~~~~~~~~~~~~~~^^^^^^^^^
  File "/var/lib/buildbot/worker/cstratak-rhel9-s390x/3.x.cstratak-rhel9-s390x.lto-pgo/build/Lib/profiling/sampling/cli.py", line 230, in _check_process_died
    raise RuntimeError(stderr_msg)
RuntimeError: Traceback (most recent call last):
  File "<frozen runpy>", line 201, in _run_module_as_main
  File "<frozen runpy>", line 87, in _run_code
  File "/var/lib/buildbot/worker/cstratak-rhel9-s390x/3.x.cstratak-rhel9-s390x.lto-pgo/build/Lib/profiling/sampling/_sync_coordinator.py", line 261, in <module>
    main()
    ~~~~^^
  File "/var/lib/buildbot/worker/cstratak-rhel9-s390x/3.x.cstratak-rhel9-s390x.lto-pgo/build/Lib/profiling/sampling/_sync_coordinator.py", line 254, in main
    _execute_script(script_path, script_args, cwd)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/var/lib/buildbot/worker/cstratak-rhel9-s390x/3.x.cstratak-rhel9-s390x.lto-pgo/build/Lib/profiling/sampling/_sync_coordinator.py", line 201, in _execute_script
    exec(code, main_module.__dict__)
    ~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/test_python_9psm0464/tmp48u9mqen.py", line 1, in <module>
    1/0
    ~^~
ZeroDivisionError: division by zero


Traceback (most recent call last):
  File "/var/lib/buildbot/worker/cstratak-rhel9-s390x/3.x.cstratak-rhel9-s390x.lto-pgo/build/Lib/test/test_profiling/test_sampling_profiler/test_live_collector_ui.py", line 904, in test_run_failed_script_live
    main()
    ~~~~^^
  File "/var/lib/buildbot/worker/cstratak-rhel9-s390x/3.x.cstratak-rhel9-s390x.lto-pgo/build/Lib/profiling/sampling/cli.py", line 1011, in main
    _main()
    ~~~~~^^
  File "/var/lib/buildbot/worker/cstratak-rhel9-s390x/3.x.cstratak-rhel9-s390x.lto-pgo/build/Lib/profiling/sampling/cli.py", line 1167, in _main
    handler(args)
    ~~~~~~~^^^^^^
  File "/var/lib/buildbot/worker/cstratak-rhel9-s390x/3.x.cstratak-rhel9-s390x.lto-pgo/build/Lib/profiling/sampling/cli.py", line 1274, in _handle_run
    _handle_live_run(args)
    ~~~~~~~~~~~~~~~~^^^^^^
  File "/var/lib/buildbot/worker/cstratak-rhel9-s390x/3.x.cstratak-rhel9-s390x.lto-pgo/build/Lib/profiling/sampling/cli.py", line 1410, in _handle_live_run
    sample_live(
    ~~~~~~~~~~~^
        process.pid,
        ^^^^^^^^^^^^
    ...<9 lines>...
        blocking=args.blocking,
        ^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/var/lib/buildbot/worker/cstratak-rhel9-s390x/3.x.cstratak-rhel9-s390x.lto-pgo/build/Lib/profiling/sampling/sample.py", line 616, in sample_live
    profiler = SampleProfiler(
        pid,
    ...<8 lines>...
        blocking=blocking,
    )
  File "/var/lib/buildbot/worker/cstratak-rhel9-s390x/3.x.cstratak-rhel9-s390x.lto-pgo/build/Lib/profiling/sampling/sample.py", line 89, in __init__
    raise SystemExit(err) from err
SystemExit: Failed to find the PyRuntime section in process 2795335 on Linux platform


Traceback (most recent call last):
  File "/var/lib/buildbot/worker/cstratak-rhel9-s390x/3.x.cstratak-rhel9-s390x.lto-pgo/build/Lib/profiling/sampling/sample.py", line 87, in __init__
    self.unwinder = self._new_unwinder(native, gc, opcodes, skip_non_matching_threads)
                    ~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/var/lib/buildbot/worker/cstratak-rhel9-s390x/3.x.cstratak-rhel9-s390x.lto-pgo/build/Lib/profiling/sampling/sample.py", line 102, in _new_unwinder
    return _remote_debugging.RemoteUnwinder(
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
        self.pid,
        ^^^^^^^^^
    ...<7 lines>...
        **kwargs
        ^^^^^^^^
    )
    ^
RuntimeError: Failed to find the PyRuntime section in process 2795335 on Linux platform


Traceback (most recent call last):
  File "/var/lib/buildbot/worker/cstratak-rhel9-s390x/3.x.cstratak-rhel9-s390x.lto-pgo/build/Lib/test/test_profiling/test_sampling_profiler/test_live_collector_ui.py", line 904, in test_run_failed_script_live
    main()
    ~~~~^^
  File "/var/lib/buildbot/worker/cstratak-rhel9-s390x/3.x.cstratak-rhel9-s390x.lto-pgo/build/Lib/profiling/sampling/cli.py", line 1011, in main
    _main()
    ~~~~~^^
  File "/var/lib/buildbot/worker/cstratak-rhel9-s390x/3.x.cstratak-rhel9-s390x.lto-pgo/build/Lib/profiling/sampling/cli.py", line 1167, in _main
    handler(args)
    ~~~~~~~^^^^^^
  File "/var/lib/buildbot/worker/cstratak-rhel9-s390x/3.x.cstratak-rhel9-s390x.lto-pgo/build/Lib/profiling/sampling/cli.py", line 1274, in _handle_run
    _handle_live_run(args)
    ~~~~~~~~~~~~~~~~^^^^^^
  File "/var/lib/buildbot/worker/cstratak-rhel9-s390x/3.x.cstratak-rhel9-s390x.lto-pgo/build/Lib/profiling/sampling/cli.py", line 1389, in _handle_live_run
    sys.exit(f"Error: {e}")
    ~~~~~~~~^^^^^^^^^^^^^^^
SystemExit: Error: Traceback (most recent call last):
  File "<frozen runpy>", line 201, in _run_module_as_main
  File "<frozen runpy>", line 87, in _run_code
  File "/var/lib/buildbot/worker/cstratak-rhel9-s390x/3.x.cstratak-rhel9-s390x.lto-pgo/build/Lib/profiling/sampling/_sync_coordinator.py", line 261, in <module>
    main()
    ~~~~^^
  File "/var/lib/buildbot/worker/cstratak-rhel9-s390x/3.x.cstratak-rhel9-s390x.lto-pgo/build/Lib/profiling/sampling/_sync_coordinator.py", line 254, in main
    _execute_script(script_path, script_args, cwd)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/var/lib/buildbot/worker/cstratak-rhel9-s390x/3.x.cstratak-rhel9-s390x.lto-pgo/build/Lib/profiling/sampling/_sync_coordinator.py", line 201, in _execute_script
    exec(code, main_module.__dict__)
    ~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/test_python_9psm0464/tmp48u9mqen.py", line 1, in <module>
    1/0
    ~^~
ZeroDivisionError: division by zero


Traceback (most recent call last):
  File "/var/lib/buildbot/worker/cstratak-rhel9-s390x/3.x.cstratak-rhel9-s390x.lto-pgo/build/Lib/unittest/case.py", line 690, in run
    with outcome.testPartExecutor(self):
         ~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
ResourceWarning: unclosed file <_io.BufferedReader name=7>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants