gh-118761: Improve import time of tomllib (#128907)

Improve import time of `tomllib`  (in sync with upstream)
This commit is contained in:
Taneli Hukkinen 2025-01-17 04:48:42 +02:00 committed by GitHub
parent c879de71eb
commit ea6cc26e75
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 35 additions and 14 deletions

View file

@ -5,6 +5,7 @@
import copy
import datetime
from decimal import Decimal as D
import importlib
from pathlib import Path
import sys
import tempfile
@ -113,3 +114,11 @@ class TestMiscellaneous(unittest.TestCase):
nest_count=nest_count):
recursive_table_toml = nest_count * "key = {" + nest_count * "}"
tomllib.loads(recursive_table_toml)
def test_types_import(self):
"""Test that `_types` module runs.
The module is for type annotations only, so it is otherwise
never imported by tests.
"""
importlib.import_module(f"{tomllib.__name__}._types")