Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
from ... contextlib
  • Loading branch information
maurycy committed May 17, 2026
commit 0fe9ad10f334511e5ed1486aa3502e9cb092424c
11 changes: 5 additions & 6 deletions Lib/profiling/sampling/cli.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
"""Command-line interface for the sampling profiler."""

import argparse
import contextlib
import importlib.util
import locale
import os
Expand All @@ -12,7 +11,7 @@
import sys
import time
import webbrowser
from contextlib import nullcontext
from contextlib import ExitStack, nullcontext

from .errors import (
SamplingUnknownProcessError,
Expand Down Expand Up @@ -1202,7 +1201,7 @@ def _handle_attach(args):
)

server = None
with contextlib.ExitStack() as stack:
with ExitStack() as stack:

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Keeping should-be-soon-to-be-added signal (SIGUSR1, SIGUSR2 for enabling or disabling?) support in mind.

if args.control:
server = ControlServer(args.control)
try:
Expand Down Expand Up @@ -1319,7 +1318,7 @@ def _handle_run(args):
)

server = None
with contextlib.ExitStack() as stack:
with ExitStack() as stack:
stack.enter_context(_get_child_monitor_context(args, process.pid))

def _terminate_main_subprocess():
Expand Down Expand Up @@ -1380,7 +1379,7 @@ def _handle_live_attach(args, pid):

# Sample in live mode
server = None
with contextlib.ExitStack() as stack:
with ExitStack() as stack:
if args.control:
server = ControlServer(args.control)
try:
Expand Down Expand Up @@ -1438,7 +1437,7 @@ def _handle_live_run(args):
# Profile the subprocess in live mode
server = None
try:
with contextlib.ExitStack() as stack:
with ExitStack() as stack:
if args.control:
server = ControlServer(args.control)
try:
Expand Down
Loading