[3.7] bpo-40807: Backport test_codeop change [GH-19670] by miss-islington · Pull Request #20647 · python/cpython
from codeop import compile_command, PyCF_DONT_IMPLY_DEDENT import io
if is_jython: if support.is_jython: import sys
def unify_callables(d):
def assertValid(self, str, symbol='single'): '''succeed iff str is a valid piece of code''' if is_jython: if support.is_jython: code = compile_command(str, "<input>", symbol) self.assertTrue(code) if symbol == "single":
# special case if not is_jython: if not support.is_jython: self.assertEqual(compile_command(""), compile("pass", "<input>", 'single', PyCF_DONT_IMPLY_DEDENT))