FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-156774: Speed up pdb startup with asyncio guard by brittanyrey · Pull Request #156775 · python/cpython · GitHub

Repository navigation

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .py  (1) .rst  (1) All 2 file types selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
7 changes: 6 additions & 1 deletion Lib/pdb.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@
import signal
import socket
import typing
import asyncio
import inspect
import weakref
import builtins
Expand All @@ -102,6 +101,8 @@
from types import CodeType
from warnings import deprecated

lazy import asyncio

try:
import _pyrepl.utils
except ModuleNotFoundError:
Expand Down Expand Up @@ -902,6 +903,10 @@ def _hold_exceptions(self, exceptions):
self._chained_exception_index = 0

def _get_asyncio_task(self):
# If asyncio has never been imported there cannot be a running task,
# so skip the import rather than pay for it on every interaction.
if 'asyncio' not in sys.modules:
return None
try:
task = asyncio.current_task()
except RuntimeError:
Expand Down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Speed up :mod:`pdb` startup by only importing :mod:`asyncio` when the program
being debugged has already imported it.
Loading

Back | FazBrowse Home | New Git URL