summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Lib/pickle.py3
-rw-r--r--Misc/NEWS.d/next/Library/2025-01-10-13-34-33.gh-issue-118761.qRB8nS.rst3
2 files changed, 4 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:
diff --git a/Misc/NEWS.d/next/Library/2025-01-10-13-34-33.gh-issue-118761.qRB8nS.rst b/Misc/NEWS.d/next/Library/2025-01-10-13-34-33.gh-issue-118761.qRB8nS.rst
new file mode 100644
index 0000000..a0a0f89
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2025-01-10-13-34-33.gh-issue-118761.qRB8nS.rst
@@ -0,0 +1,3 @@
+Improve import time of :mod:`pickle` by 25% by removing an unnecessary
+regular expression. As such, :mod:`re` is no more implicitly available
+as ``pickle.re``. Patch by Bénédikt Tran.