summaryrefslogtreecommitdiffstats
path: root/Lib/pickle.py
diff options
context:
space:
mode:
authorBénédikt Tran <10796600+picnixz@users.noreply.github.com>2025-01-14 11:26:26 (GMT)
committerGitHub <noreply@github.com>2025-01-14 11:26:26 (GMT)
commitff3e145b2770ffe86c905b1092747ce3d8381319 (patch)
tree761732d3fe2cc43937130ed9b00356b96d47d4fe /Lib/pickle.py
parent1153e66e20124b8f3484bcaddbc0e252d31161a6 (diff)
downloadcpython-ff3e145b2770ffe86c905b1092747ce3d8381319.zip
cpython-ff3e145b2770ffe86c905b1092747ce3d8381319.tar.gz
cpython-ff3e145b2770ffe86c905b1092747ce3d8381319.tar.bz2
gh-118761: Improve import time of the `pickle` module. (#128732)
Importing `pickle` is now roughly 25% faster. Importing the `re` module is no longer needed and thus `re` is no more implicitly exposed as `pickle.re`. --------- Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Diffstat (limited to 'Lib/pickle.py')
-rw-r--r--Lib/pickle.py3
1 files changed, 1 insertions, 2 deletions
diff --git a/Lib/pickle.py b/Lib/pickle.py
index 1920973..8afb4aa 100644
--- a/Lib/pickle.py
+++ b/Lib/pickle.py
@@ -31,7 +31,6 @@ from functools import partial
import sys
from sys import maxsize
from struct import pack, unpack
-import re
import io
import codecs
import _compat_pickle
@@ -188,7 +187,7 @@ BYTEARRAY8 = b'\x96' # push bytearray
NEXT_BUFFER = b'\x97' # push next out-of-band buffer
READONLY_BUFFER = b'\x98' # make top of stack readonly
-__all__.extend([x for x in dir() if re.match("[A-Z][A-Z0-9_]+$", x)])
+__all__.extend(x for x in dir() if x.isupper() and not x.startswith('_'))
class _Framer: