Skip to content

python3.15 -m profile.sample raises Error while finding module specification for 'profile.sample' #138374

Closed as not planned

Description

@alexprengere

Bug report

Bug description:

Hi! I wanted to test the new sampling profiler on 3.15, as documented in the release notes.

So after building cpython from source (optimizations enabled, but I tried without as well), on an Apple M4, I create this little script that runs forever.

# run.py
i = 0
try:
    while 1:
        i += 1
except KeyboardInterrupt:
    print(f"\nLooped {i} times")

Then when running python3.15 -m profile.sample, the error appears:

$ python3.15 run.py &
$ python3.15 -m profile.sample <PID>
/usr/local/bin/python3.15: Error while finding module specification for 'profile.sample' (ModuleNotFoundError: __path__ attribute not found on 'profile' while trying to find 'profile.sample')

CPython versions tested on:

CPython main branch

Operating systems tested on:

macOS

Activity

  1. added
    type-bug
    on Sep 2, 2025
  2. added
    stdlib
    3.15
    on Sep 2, 2025
  3. picnixz commented on Sep 2, 2025

    @picnixz
    Member
  4. picnixz commented on Sep 2, 2025

    @picnixz
    Member

    Err maybe it's actually profiling.sampling instead? Lib/profile.py doesn't seem to have that entrypoint.

  5. added
    docs
    on Sep 2, 2025
  6. pablogsal commented on Sep 2, 2025

    @pablogsal
    Member

    Yeah, this is being moved to profiling.sampling after #138122

  7. picnixz commented on Sep 2, 2025

    @picnixz
    Member

    Maybe we should change the release notes then?

  8. picnixz commented on Sep 2, 2025

    @picnixz
    Member

    Thank you for the report. We updated the changelog in #138389!

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.15docsstdlibtype-bug

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions