Skip to content

Commit 9a07f3b

Browse files
author
Forest
committed
imaplib: move import statement to where it's used
This import is only needed if external code tries to use an attribute that it shouldn't be using. Making it a local import reduces module loading time in supported cases.
1 parent 40e607a commit 9a07f3b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Lib/imaplib.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
import binascii, errno, random, re, socket, subprocess, sys, time, calendar
2727
from datetime import datetime, timezone, timedelta
2828
from io import DEFAULT_BUFFER_SIZE
29-
import warnings
3029

3130
try:
3231
import ssl
@@ -328,6 +327,7 @@ def file(self):
328327
# Nevertheless, we provide this property for now, to avoid suddenly
329328
# breaking any code in the wild that might have been using it in a
330329
# harmless way.
330+
import warnings
331331
warnings.warn(
332332
'IMAP4.file is unsupported, can cause errors, and may be removed.',
333333
RuntimeWarning)

0 commit comments

Comments
 (0)