(self)
| 2727 | |
| 2728 | @contextlib.contextmanager |
| 2729 | def detach_readline(self): |
| 2730 | # bpo-13886: When the readline module is loaded, PyOS_Readline() uses |
| 2731 | # the readline implementation. In some cases, the Python readline |
| 2732 | # callback rlhandler() is called by readline with a string without |
| 2733 | # non-ASCII characters. |
| 2734 | # Unlink readline temporarily from PyOS_Readline() for those tests, |
| 2735 | # since test_builtin is not intended to test |
| 2736 | # the readline module, but the builtins module. |
| 2737 | if "readline" in sys.modules: |
| 2738 | c = import_module("ctypes") |
| 2739 | fp_api = "PyOS_ReadlineFunctionPointer" |
| 2740 | prev_value = c.c_void_p.in_dll(c.pythonapi, fp_api).value |
| 2741 | c.c_void_p.in_dll(c.pythonapi, fp_api).value = None |
| 2742 | try: |
| 2743 | yield |
| 2744 | finally: |
| 2745 | c.c_void_p.in_dll(c.pythonapi, fp_api).value = prev_value |
| 2746 | else: |
| 2747 | yield |
| 2748 | |
| 2749 | def test_input_tty(self): |
| 2750 | # Test input() functionality when wired to a tty |
no test coverage detected