GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GH-142591: Tachyon does not handle non-existent file/module by savannahostrowski · Pull Request #142592 · python/cpython

Conversation

@savannahostrowski

@savannahostrowski savannahostrowski commented Dec 11, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

This validates script/module/PID exists before starting the profiler. If the target doesn't exist, we now fail fast with a clear error instead of launching an empty TUI.

Screenshot 2025-12-11 at 11 00 21 AM Screenshot 2025-12-11 at 11 00 09 AM
  • Issue: Tachyon does not handle non-existent file/module #142591

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
savannahostrowski added 2 commits December 11, 2025 09:58
@savannahostrowski
Fix file does not exist
b3b6fff
@savannahostrowski
Handle module
00ef823
@savannahostrowski
savannahostrowski requested a review from pablogsal December 11, 2025 18:20
@bedevere-app bedevere-app Bot mentioned this pull request Dec 11, 2025
Tachyon does not handle non-existent file/module #142591
Closed
@bedevere-app bedevere-app Bot added the awaiting core review label Dec 11, 2025
@savannahostrowski

savannahostrowski commented Dec 11, 2025

Copy link
Copy Markdown
Member Author

Hmm, there's a better fix here. Please hold :D

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@savannahostrowski
Fail fast
2ee9bf9
savannahostrowski
savannahostrowski commented Dec 11, 2025
View reviewed changes
Comment thread Lib/profiling/sampling/_sync_coordinator.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

@savannahostrowski
Merge branch 'main' into tachyon-file-does-not-exist
8137747
@savannahostrowski savannahostrowski added the skip news label Dec 12, 2025
@savannahostrowski savannahostrowski mentioned this pull request Dec 12, 2025
Implement PEP 799 – A dedicated profiling package for organizing Python profiling tools #138122
Closed
@savannahostrowski
Merge branch 'main' into tachyon-file-does-not-exist
7fbb890
pablogsal
pablogsal reviewed Dec 14, 2025
View reviewed changes
Comment thread Lib/profiling/sampling/cli.py Outdated
"""Handle live mode for an existing process."""
# Check if process exists
try:
os.kill(pid, 0)

@pablogsal pablogsal Dec 14, 2025

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure this works on windows. On Windows, os.kill() only supports signals SIGTERM, CTRL_C_EVENT, and CTRL_BREAK_EVENT. Signal 0 (which is the Unix idiom for checking if a process exists without sending a signal) is not supported on Windows.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@pablogsal pablogsal Dec 14, 2025

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This also has a TOCTOU problem: the process may die after you check and before we attach

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@pablogsal pablogsal Dec 14, 2025

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fix probably needs to be done more on the line of https://github.com/python/cpython/pull/142655/changes (we should handle this there)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@pablogsal

pablogsal commented Dec 14, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

I've made some improvements to the implementation.

  • Refactored the sync waiting logic by extracting _check_process_died() and _wait_for_ready_signal() helper functions for better readability. Replaced select.select with selectors.DefaultSelector which has a nicer interface.

  • Changed stderr to always be captured so we can show clean error messages. Added try/except around _run_with_sync() calls to convert RuntimeError to clean sys.exit() messages so non-existent scripts/modules now show clean errors without tracebacks:

  • Also fixed absolute path validation which was incorrectly prepending cwd to absolute paths.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@pablogsal
pablogsal force-pushed the tachyon-file-does-not-exist branch 3 times, most recently from fe664f9 to 980b035 Compare December 14, 2025 03:16
@pablogsal
fixup! Merge branch 'main' into tachyon-file-does-not-exist
24086c8
@pablogsal
pablogsal force-pushed the tachyon-file-does-not-exist branch from 980b035 to 24086c8 Compare December 14, 2025 03:40
@pablogsal pablogsal mentioned this pull request Dec 14, 2025
gh-142654: show the clear error message when sampling on an unknown PID #142655
Merged
pablogsal
pablogsal approved these changes Dec 14, 2025
View reviewed changes

@pablogsal pablogsal left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Thanks a lot for the PR @savannahostrowski ❤️

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

savannahostrowski reacted with heart emoji
All reactions
  • ❤️ 1 reaction
@bedevere-app bedevere-app Bot added awaiting merge and removed awaiting core review labels Dec 14, 2025
@pablogsal
pablogsal merged commit f893e8f into python:main Dec 14, 2025
48 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app bedevere-app Bot removed the awaiting merge label Dec 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@pablogsal pablogsal pablogsal approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

skip news

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@savannahostrowski @pablogsal
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.