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

gh-149173: Fix inverted PYTHON_BASIC_REPL environment check in _pyrepl_available() by tanloong · Pull Request #149174 · 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  (2) .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
2 changes: 1 addition & 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 @@ -376,7 +376,7 @@ def get_default_backend():

def _pyrepl_available():
"""return whether pdb should use _pyrepl for input"""
if not os.getenv("PYTHON_BASIC_REPL"):
if os.getenv("PYTHON_BASIC_REPL"):
CAN_USE_PYREPL = False
else:
try:
Expand Down
10 changes: 10 additions & 0 deletions Lib/test/test_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 @@ -4753,6 +4753,16 @@ def foo(self):
stdout, stderr = self.run_pdb_script(script, commands)
self.assertIn("The specified object 'C.foo' is not a function", stdout)

def test_pyrepl_available(self):
with patch.dict(os.environ, {"PYTHON_BASIC_REPL": "1"}):
self.assertFalse(pdb._pyrepl_available())

with patch.dict(os.environ, {}, clear=True):
mod = types.ModuleType("_pyrepl.main")
mod.CAN_USE_PYREPL = True
with patch.dict("sys.modules", {"_pyrepl.main": mod}):
self.assertTrue(pdb._pyrepl_available())


class ChecklineTests(unittest.TestCase):
def setUp(self):
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 @@
Fix inverted :envvar:`PYTHON_BASIC_REPL` environment check in
``pdb._pyrepl_available``.
Loading

Back | FazBrowse Home | New Git URL