| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -376,7 +376,7 @@ def get_default_backend(): | |||
| 376 | 376 | ||
| 377 | 377 | def _pyrepl_available(): | |
| 378 | 378 | """return whether pdb should use _pyrepl for input""" | |
| 379 | - if not os.getenv("PYTHON_BASIC_REPL"): | ||
| 379 | + if os.getenv("PYTHON_BASIC_REPL"): | ||
| 380 | 380 | CAN_USE_PYREPL = False | |
| 381 | 381 | else: | |
| 382 | 382 | try: | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -4753,6 +4753,16 @@ def foo(self): | |||
| 4753 | 4753 | stdout, stderr = self.run_pdb_script(script, commands) | |
| 4754 | 4754 | self.assertIn("The specified object 'C.foo' is not a function", stdout) | |
| 4755 | 4755 | ||
| 4756 | + def test_pyrepl_available(self): | ||
| 4757 | + with patch.dict(os.environ, {"PYTHON_BASIC_REPL": "1"}): | ||
| 4758 | + self.assertFalse(pdb._pyrepl_available()) | ||
| 4759 | + | ||
| 4760 | + with patch.dict(os.environ, {}, clear=True): | ||
| 4761 | + mod = types.ModuleType("_pyrepl.main") | ||
| 4762 | + mod.CAN_USE_PYREPL = True | ||
| 4763 | + with patch.dict("sys.modules", {"_pyrepl.main": mod}): | ||
| 4764 | + self.assertTrue(pdb._pyrepl_available()) | ||
| 4765 | + | ||
| 4756 | 4766 | ||
| 4757 | 4767 | class ChecklineTests(unittest.TestCase): | |
| 4758 | 4768 | def setUp(self): | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,2 @@ | |||
| 1 | + Fix inverted :envvar:`PYTHON_BASIC_REPL` environment check in | ||
| 2 | + ``pdb._pyrepl_available``. | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments