Lines Matching defs:_ast
2370 # bpo-41194, bpo-41261, bpo-41631: The _ast module uses a global state.
2373 # Check that the _ast module still works as expected
2378 # Create _ast.AST subclasses instances
2386 # bpo-41194: Importing the _ast module twice must not crash.
2387 with support.swap_item(sys.modules, '_ast', None):
2388 del sys.modules['_ast']
2389 import _ast as ast1
2391 del sys.modules['_ast']
2392 import _ast as ast2
2396 # Unloading the two _ast module instances must not crash.
2405 # imported the _ast module internally.
2412 with support.swap_item(sys.modules, '_ast', None):
2413 del sys.modules['_ast']
2416 # Test that compile() does not import the _ast module
2418 self.assertNotIn('_ast', sys.modules)
2421 import _ast
2422 self.assertIs(_ast, lazy_mod)
2425 # bpo-41631: Importing and using the _ast module in a subinterpreter
2428 import _ast
2434 # Create _ast.AST subclasses instances and call PyAST_Check()
2441 # Unloading the _ast module must not crash.
2442 del ast, _ast
2443 del sys.modules['ast'], sys.modules['_ast']