(self)
| 2677 | |
| 2678 | @contextlib.contextmanager |
| 2679 | def detach_readline(self): |
| 2680 | # bpo-13886: When the readline module is loaded, PyOS_Readline() uses |
| 2681 | # the readline implementation. In some cases, the Python readline |
| 2682 | # callback rlhandler() is called by readline with a string without |
| 2683 | # non-ASCII characters. |
| 2684 | # Unlink readline temporarily from PyOS_Readline() for those tests, |
| 2685 | # since test_builtin is not intended to test |
| 2686 | # the readline module, but the builtins module. |
| 2687 | if "readline" in sys.modules: |
| 2688 | c = import_module("ctypes") |
| 2689 | fp_api = "PyOS_ReadlineFunctionPointer" |
| 2690 | prev_value = c.c_void_p.in_dll(c.pythonapi, fp_api).value |
| 2691 | c.c_void_p.in_dll(c.pythonapi, fp_api).value = None |
| 2692 | try: |
| 2693 | yield |
| 2694 | finally: |
| 2695 | c.c_void_p.in_dll(c.pythonapi, fp_api).value = prev_value |
| 2696 | else: |
| 2697 | yield |
| 2698 | |
| 2699 | def test_input_tty(self): |
| 2700 | # Test input() functionality when wired to a tty |
no test coverage detected