gh-118761: Optimise import time for ``shlex`` (#132036) · python/cpython@06a26fd · GitHub
Skip to content

Commit 06a26fd

Browse files
authored
gh-118761: Optimise import time for shlex (#132036)
1 parent 984a314 commit 06a26fd

3 files changed

Lines changed: 17 additions & 7 deletions

File tree

Lib/shlex.py

Lines changed: 10 additions & 7 deletions

Lib/test/test_shlex.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import shlex
44
import string
55
import unittest
6+
from test.support import import_helper
67

78

89
# The original test data set was from shellwords, by Hartmut Goebel.
@@ -363,6 +364,9 @@ def testPunctuationCharsReadOnly(self):
363364
with self.assertRaises(AttributeError):
364365
shlex_instance.punctuation_chars = False
365366

367+
def test_lazy_imports(self):
368+
import_helper.ensure_lazy_imports('shlex', {'collections', 're', 'os'})
369+
366370

367371
# Allow this test to be used with old shlex.py
368372
if not getattr(shlex, "split", None):
Lines changed: 3 additions & 0 deletions

0 commit comments

Comments
 (0)