cpython/Lib
Gregory P. Smith 300de1e98a
gh-86519: Add prefixmatch APIs to the re module (GH-31137)
Adds `prefixmatch` APIs to the re module as an alternate name for our long existing `match` APIs to help alleviate a common Python confusion for those coming from other languages regular expression libraries.

These alleviate common confusion around what "match" means as Python is different than other popular languages regex libraries in our use of the term as an API name.  The original `match` names are **NOT being deprecated**.  Source tooling like linters, IDEs, and LLMs could suggest using `prefixmatch` instead of match to improve code health and reduce cognitive burden of understanding the intent of code when configured for a modern minimum Python version.

See the documentation changes for a better description.

Discussions took place in the PR, in the issue, and finally at https://discuss.python.org/t/add-re-prefixmatch-deprecate-re-match/105927

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 17:43:39 -08:00
..
__phello__
_pyrepl gh-142349: Implement PEP 810 - Explicit lazy imports (#142351) 2026-02-12 00:15:33 +00:00
asyncio gh-143952: Fix asyncio tools to work with the new remote debugging API (#143954) 2026-01-17 19:16:12 -05:00
collections gh-140911: Ensure that UserString.index() and UserString.rindex() accept UserString as argument (GH-140945) 2025-11-25 15:25:46 +02:00
compression gh-132983: Split `_zstd_set_c_parameters` (#133921) 2025-05-28 14:45:08 +00:00
concurrent Fix pyflakes warnings: variable is assigned to but never used (#142294) 2025-12-08 14:00:31 +01:00
ctypes gh-76007: Deprecate __version__ attribute in ctypes (#142679) 2025-12-15 13:30:23 +02:00
curses gh-133575: eliminate legacy checks in Lib/curses/__init__.py (#133576) 2025-05-07 20:28:32 +02:00
dbm Fix typo: 'exept' -> 'except' in Lib/dbm/dumb.py (GH-144060) 2026-01-20 08:50:34 +02:00
email gh-144125: email: verify headers are sound in BytesGenerator 2026-01-23 14:59:35 +00:00
encodings Fix pyflakes warnings: variable is assigned to but never used (#142294) 2025-12-08 14:00:31 +01:00
ensurepip gh-144278: Enable overriding sys.implementation's name and cache_tag when building sysmodule.c (GH-144293) 2026-02-10 00:01:17 +00:00
html gh-140875: Fix handling of unclosed charrefs before EOF in HTMLParser (GH-140904) 2025-11-19 13:55:10 +02:00
http gh-143919: Reject control characters in http cookies 2026-01-20 21:23:42 +00:00
idlelib gh-144285: Improve AttributeError attribute suggestions (#144299) 2026-02-12 14:12:49 +00:00
importlib gh-142349: Implement PEP 810 - Explicit lazy imports (#142351) 2026-02-12 00:15:33 +00:00
json GH-141686: Break cycles created by JSONEncoder.iterencode (GH-141687) 2025-11-18 09:51:18 -08:00
logging gh-135852: Remove out of tree pywin32 dependency for NTEventLogHandler (GH-137860) 2025-12-31 12:50:50 +02:00
multiprocessing gh-141860: Add on_error= keyword arg to multiprocessing.set_forkserver_preload (GH-141859) 2026-01-18 14:04:18 -08:00
pathlib GH-139174: Prepare pathlib.Path.info for new methods (part 2) (#140155) 2025-10-18 02:13:25 +01:00
profiling gh-144342: Use time.sleep in profiling.sampling (#144343) 2026-01-30 15:13:21 +00:00
pydoc_data Python 3.15.0a6 2026-02-11 14:23:15 +02:00
re gh-86519: Add prefixmatch APIs to the re module (GH-31137) 2026-02-15 17:43:39 -08:00
site-packages
sqlite3 gh-133390: sqlite3 CLI completion for tables, columns, indices, triggers, views, functions, schemata (GH-136101) 2025-10-24 08:26:36 +02:00
string GH-132661: Add `string.templatelib.convert()` (#135217) 2025-07-15 11:56:42 +02:00
sysconfig Replace obsolete platforms with more recent examples (#132455) 2025-10-10 05:38:13 +00:00
test gh-86519: Add prefixmatch APIs to the re module (GH-31137) 2026-02-15 17:43:39 -08:00
tkinter gh-143754: Add Tkinter methods pack_content(), place_content() and grid_content() (GH-143845) 2026-01-20 09:16:36 +02:00
tomllib gh-142956: Update tomllib to parse TOML 1.1.0 (#144243) 2026-02-03 13:41:57 +01:00
turtledemo gh-128062: Fix the font size and shortcut display of the turtledemo menu (#128063) 2024-12-19 15:24:47 -05:00
unittest gh-74453: Deprecate os.path.commonprefix (#144436) 2026-02-05 22:37:05 +02:00
urllib gh-144148: Update the urllib.parse documentation (GH-144497) 2026-02-05 16:32:17 +02:00
venv Fix pyflakes warnings: variable is assigned to but never used (#142294) 2025-12-08 14:00:31 +01:00
wsgiref gh-143916: Allow HTAB in wsgiref header values 2026-02-12 20:40:21 +00:00
xml gh-142306: Improve errors for Element.remove() (GH-142308) 2026-01-12 11:49:18 +02:00
xmlrpc gh-136839: Refactor simple dict.update calls (#136811) 2025-07-19 10:12:10 -07:00
zipfile gh-144278: Enable overriding sys.implementation's name and cache_tag when building sysmodule.c (GH-144293) 2026-02-10 00:01:17 +00:00
zoneinfo gh-143241: Fix infinite loop in zoneinfo._common.load_data (#143243) 2025-12-28 15:48:43 +01:00
__future__.py
__hello__.py
_aix_support.py
_android_support.py gh-144415: Android testbed fixes (#142912) 2026-02-03 16:37:34 +08:00
_apple_support.py gh-126925: Modify how iOS test results are gathered (#127592) 2024-12-09 13:28:57 +08:00
_ast_unparse.py gh-138774: use value to ast.unparse code when str is None in ast.Interpolation (#139415) 2025-10-23 13:56:05 +00:00
_collections_abc.py gh-118803: Make ByteString deprecations louder; remove ByteString from typing.__all__ and collections.abc.__all__ (#139127) 2025-09-18 18:58:16 +00:00
_colorize.py gh-138122: Integrate live profiler TUI with _colorize theming system (#142360) 2026-01-01 21:10:52 +00:00
_compat_pickle.py gh-142349: Implement PEP 810 - Explicit lazy imports (#142351) 2026-02-12 00:15:33 +00:00
_ios_support.py
_markupbase.py _markupbase.py: Use a permalink for the analysis of MS-Word extensions (GH-129017) 2025-02-06 11:40:43 +01:00
_opcode_metadata.py gh-142982: Specialize CALL_FUNCTION_EX (GH-143391) 2026-01-06 20:34:08 +00:00
_osx_support.py
_py_abc.py
_py_warnings.py Fix pyflakes warnings: variable is assigned to but never used (#142294) 2025-12-08 14:00:31 +01:00
_pydatetime.py gh-97517: Add documentation links to datetime strftime/strptime docstrings (#138559) 2025-09-15 19:50:46 +01:00
_pydecimal.py gh-76007: Deprecate __version__ attribute in decimal (#140302) 2025-10-26 12:01:04 +01:00
_pyio.py gh-143602: Fix duplicate buffer exports in io.BytesIO.write (#143629) 2026-01-15 16:08:55 +01:00
_pylong.py
_sitebuiltins.py gh-138897: Use _pyrepl.pager for _sitebuiltins._Printer (GH-138898) 2026-01-02 16:24:48 +01:00
_strptime.py gh-140715: Add %F format code support to strptime() (GH-140647) 2026-02-09 13:24:15 +01:00
_threading_local.py Fix pyflakes warnings: variable is assigned to but never used (#142294) 2025-12-08 14:00:31 +01:00
_weakrefset.py
abc.py
annotationlib.py gh-143831: Compare cells by identity in forward references (#143848) 2026-01-18 21:29:11 -08:00
antigravity.py
argparse.py GH-142950: Process format specifiers before colourization in argparse help (#142960) 2026-01-07 17:39:47 +00:00
ast.py gh-135801: Add the module parameter to compile() etc (GH-139652) 2025-11-13 13:21:32 +02:00
base64.py gh-101178: Add Ascii85, Base85, and Z85 support to binascii (GH-102753) 2026-02-06 16:43:16 +02:00
bdb.py gh-136057: Allow step and next to step over for loops (#136160) 2025-11-16 13:57:07 -08:00
bisect.py
bz2.py gh-132983: Introduce compression package and move _compression module (GH-133018) 2025-04-27 14:41:30 -07:00
calendar.py gh-140212: Add html for year-month option in Calendar (#140230) 2025-10-31 17:28:53 +02:00
cmd.py gh-133363: Fix Cmd completion for lines beginning with ! (#133364) 2025-05-03 22:50:37 -04:00
code.py gh-135103: Remove an unused local variable in Lib/code.py (GH-135104) 2025-06-04 13:57:31 +09:00
codecs.py gh-52876: Implement missing parameter in codecs.StreamReaderWriter functions (#136498) 2025-07-10 17:42:14 +02:00
codeop.py Fix pyflakes warnings: variable is assigned to but never used (#142294) 2025-12-08 14:00:31 +01:00
colorsys.py
compileall.py gh-144278: Enable overriding sys.implementation's name and cache_tag when building sysmodule.c (GH-144293) 2026-02-10 00:01:17 +00:00
configparser.py gh-136282: Configparser: create unnamed sections via mapping protocol access (GH-136313) 2025-12-19 13:44:03 +01:00
contextlib.py gh-144386: Add support for descriptors in ExitStack and AsyncExitStack (#144420) 2026-02-04 13:20:18 +02:00
contextvars.py gh-126451: Register contextvars.Context to collections.abc.Mapping (#126452) 2024-11-07 01:12:45 +03:00
copy.py gh-143445: Optimize deepcopy for 1.04x speedup (#143449) 2026-01-08 16:28:02 +01:00
copyreg.py gh-132882: Fix copying of unions with members that do not support __or__ (#132883) 2025-04-24 16:49:09 +00:00
cProfile.py Remove unused imports (#142320) 2025-12-06 11:27:31 +00:00
csv.py gh-137627: Make csv.Sniffer.sniff() delimiter detection 1.6x faster (#137628) 2025-10-23 15:28:29 +03:00
dataclasses.py gh-142214: Fix two regressions in dataclasses (#142223) 2025-12-04 20:04:42 -08:00
datetime.py
decimal.py gh-76007: Deprecate __version__ attribute in decimal (#140302) 2025-10-26 12:01:04 +01:00
difflib.py gh-142939: difflib.get_close_matches performance (#142940) 2025-12-30 07:15:59 +00:00
dis.py gh-142349: Implement PEP 810 - Explicit lazy imports (#142351) 2026-02-12 00:15:33 +00:00
doctest.py gh-69113: Fix doctest to report line numbers for __test__ strings (#141624) 2025-12-06 15:47:08 -05:00
enum.py gh-140806: add docs for enum.bin function (#140807) 2026-01-12 13:34:18 +02:00
filecmp.py
fileinput.py
fnmatch.py gh-133306: Use \z instead of \Z in fnmatch.translate() and glob.translate() (GH-133338) 2025-05-03 17:58:21 +03:00
fractions.py gh-87790: support thousands separators for formatting fractional part of Fraction (#132204) 2025-07-07 11:16:31 +03:00
ftplib.py Fix pyflakes warnings: variable is assigned to but never used (#142294) 2025-12-08 14:00:31 +01:00
functools.py gh-144030: Add check that argument is callable to Python version of functools.lru_cache (#144031) 2026-01-21 15:19:19 +01:00
genericpath.py gh-74453: Deprecate os.path.commonprefix (#144436) 2026-02-05 22:37:05 +02:00
getopt.py gh-126946: Improve error message in getopt.do_longs based on existing comment (GH-126871) 2024-11-26 10:54:02 +02:00
getpass.py gh-138514: getpass: restrict echo_char to a single ASCII character (#138591) 2025-09-16 16:21:55 +02:00
gettext.py gettext: Remove outdated "TODO" comment (#130890) 2025-03-06 23:41:03 +00:00
glob.py docs: be clearer that glob results are unordered (#140184) 2025-10-19 16:16:35 -04:00
graphlib.py GH-143948: Explain graphlib's cycle-finding code (#143950) 2026-01-20 19:28:48 -06:00
gzip.py Remove some dead code from gzip and tarfile (#138123) 2025-08-25 16:23:47 +03:00
hashlib.py gh-136565: use SHA-256 for hashlib.__doc__ example instead of MD5 (#138157) 2025-08-26 10:38:53 +00:00
heapq.py Remove unnecessary slice in heapq.py (gh-139087) 2025-09-18 00:52:46 -05:00
hmac.py gh-142451: correctly copy HMAC attributes in HMAC.copy() (#142510) 2025-12-14 09:45:36 +01:00
imaplib.py gh-143921: Reject control characters in IMAP commands 2026-01-20 20:45:42 +00:00
inspect.py gh-120321: Add gi_state, cr_state, and ag_state attributes (gh-144409) 2026-02-03 13:06:32 -05:00
io.py gh-132952: Speed up startup by importing _io instead of io (#132957) 2025-04-28 08:38:56 -07:00
ipaddress.py gh-141497: Make ipaddress.IP{v4,v6}Network.hosts() always returning an iterator (GH-141547) 2025-11-17 19:29:06 +02:00
keyword.py gh-142349: Implement PEP 810 - Explicit lazy imports (#142351) 2026-02-12 00:15:33 +00:00
linecache.py gh-122255: Synchronize warnings in C and Python implementations of the warnings module (GH-122824) 2025-11-14 16:49:28 +02:00
locale.py gh-130796: Undeprecate locale.getdefaultlocale() (#143069) 2025-12-23 16:31:10 +01:00
lzma.py gh-132983: Introduce compression package and move _compression module (GH-133018) 2025-04-27 14:41:30 -07:00
mailbox.py gh-143010: Prevent a TOCTOU issue by only calling open once (#143011) 2025-12-22 12:48:11 -05:00
mimetypes.py gh-144212: Add image/jxl to mimetypes (GH-144213) 2026-01-26 15:26:55 +01:00
modulefinder.py gh-84530: fix namespace package support in modulefinder (#29196) 2025-12-09 15:50:50 +00:00
netrc.py Fix pyflakes warnings: variable is assigned to but never used (#142294) 2025-12-08 14:00:31 +01:00
ntpath.py Fix pyflakes warnings: variable is assigned to but never used (#142294) 2025-12-08 14:00:31 +01:00
nturl2path.py GH-125866: Deprecate nturl2path module (#131432) 2025-03-19 19:33:01 +00:00
numbers.py gh-122450: Expand documentation for `Rational and Fraction` (#136800) 2025-08-04 02:15:59 +00:00
opcode.py gh-142982: Specialize CALL_FUNCTION_EX (GH-143391) 2026-01-06 20:34:08 +00:00
operator.py
optparse.py Fix pyflakes warnings: variable is assigned to but never used (#142294) 2025-12-08 14:00:31 +01:00
os.py gh-120057: add os.reload_environ to __all__ (#140763) 2025-10-29 21:21:26 +00:00
pdb.py gh-143874: Use self.message instead of raw print in _exec_in_closure() (#143875) 2026-01-19 16:11:07 -08:00
pickle.py gh-77188: Add support for pickling private methods and nested classes (GH-21480) 2026-02-05 19:50:51 +00:00
pickletools.py gh-131178: Add tests for pickletools command-line interface (#131287) 2025-11-22 19:17:06 +02:00
pkgutil.py gh-131152, pkgutil: Remove unused imports (#131149) 2025-03-12 15:03:36 +01:00
platform.py Fix pyflakes warnings: variable is assigned to but never used (#142294) 2025-12-08 14:00:31 +01:00
plistlib.py gh-143214: Add the wrapcol parameter in binascii.b2a_base64() and base64.b64encode() (GH-143216) 2026-01-14 14:44:53 +02:00
poplib.py gh-143923: Reject control characters in POP3 commands 2026-01-20 20:46:32 +00:00
posixpath.py gh-74453: Deprecate os.path.commonprefix (#144436) 2026-02-05 22:37:05 +02:00
pprint.py GH-90117: Check for list and tuple before MappingView in pprint (GH-135779) 2025-06-24 14:41:41 -07:00
profile.py GH-65961: Stop setting __cached__ on modules (GH-142165) 2025-12-11 11:44:46 -08:00
pstats.py gh-140137: Handle empty collections in profiling.sampling (#140154) 2025-10-15 14:59:12 +01:00
pty.py
py_compile.py gh-144278: Enable overriding sys.implementation's name and cache_tag when building sysmodule.c (GH-144293) 2026-02-10 00:01:17 +00:00
pyclbr.py Fix pyflakes warnings: variable is assigned to but never used (#142294) 2025-12-08 14:00:31 +01:00
pydoc.py gh-138568: Make help mode in PyREPL not exit on empty line input (#143512) 2026-01-07 16:30:58 +01:00
queue.py Fix Queue.shutdown docs for condition to unblock a join (gh-137088) 2025-07-25 07:56:28 -06:00
quopri.py
random.py Minor edit: Move comments closer to the code they describe (gh-136477) 2025-07-09 10:23:46 -07:00
reprlib.py gh-135487: fix reprlib.Repr.repr_int when given very large integers (#135506) 2025-06-24 11:09:46 +00:00
rlcompleter.py gh-142349: Implement PEP 810 - Explicit lazy imports (#142351) 2026-02-12 00:15:33 +00:00
runpy.py GH-65961: Stop setting __cached__ on modules (GH-142165) 2025-12-11 11:44:46 -08:00
sched.py
secrets.py
selectors.py
shelve.py Drop three unused imports (#141875) 2025-11-23 16:33:05 +00:00
shlex.py gh-138804: Check type in shlex.quote (GH-138809) 2025-09-12 14:26:21 -04:00
shutil.py gh-132983: Add missing references to Zstandard in shutil docstrings (GH-136617) 2025-07-23 18:09:53 +00:00
signal.py
site.py GH-65961: Stop setting __cached__ on modules (GH-142165) 2025-12-11 11:44:46 -08:00
smtplib.py gh-139434: Update selected RFC 2822 references to RFC 5322 (#139435) 2025-11-04 14:46:07 -05:00
socket.py gh-99813: Start using SSL_sendfile when available (#99907) 2025-07-12 12:42:35 +00:00
socketserver.py gh-76007: Deprecate __version__ attribute (#138675) 2025-09-29 12:03:23 +03:00
ssl.py gh-143214: Add the wrapcol parameter in binascii.b2a_base64() and base64.b64encode() (GH-143216) 2026-01-14 14:44:53 +02:00
stat.py gh-144050: Fix stat.filemode pure Python file type detection (GH-144059) 2026-01-20 14:05:42 +02:00
statistics.py gh-140938: Raise ValueError for infinite inputs to stdev/pstdev (GH-141531) 2025-11-14 23:25:45 +00:00
stringprep.py
struct.py
subprocess.py gh-83069: Use efficient event-driven subprocess.Popen.wait() on Linux / macOS / BSD (#144047) 2026-01-28 15:04:40 +01:00
symtable.py gh-143504: Expose CELL status of a symbol in symtable (#143549) 2026-01-25 15:21:27 +00:00
tabnanny.py gh-76007: Deprecate __version__ attribute (#138675) 2025-09-29 12:03:23 +03:00
tarfile.py gh-57911: Sanitize symlink targets in tarfile on win32 (GH-138309) 2025-09-05 16:19:47 +02:00
tempfile.py Fix pyflakes warnings: variable is assigned to but never used (#142294) 2025-12-08 14:00:31 +01:00
textwrap.py gh-139065: Fix trailing space before long word in textwrap (GH-139070) 2025-10-10 16:29:18 +03:00
this.py
threading.py gh-114827: clarify threading.Event.wait timeout behavior (#114834) 2025-10-14 11:34:53 +03:00
timeit.py gh-139374: colorize traceback when using timeit command-line interface (#139375) 2025-09-28 11:49:18 +00:00
token.py gh-131507: Add support for syntax highlighting in PyREPL (GH-133247) 2025-05-02 20:22:31 +02:00
tokenize.py Fix pyflakes warnings: variable is assigned to but never used (#142294) 2025-12-08 14:00:31 +01:00
trace.py GH-65961: Stop setting __cached__ on modules (GH-142165) 2025-12-11 11:44:46 -08:00
traceback.py gh-144285: Improve AttributeError attribute suggestions (#144299) 2026-02-12 14:12:49 +00:00
tracemalloc.py
tty.py
turtle.py Fix pyflakes warnings: variable is assigned to but never used (#142294) 2025-12-08 14:00:31 +01:00
types.py gh-142349: Implement PEP 810 - Explicit lazy imports (#142351) 2026-02-12 00:15:33 +00:00
typing.py gh-144321: Fix named tuple bug when input is a non-sequence iterable (#144600) 2026-02-11 12:44:22 +00:00
uuid.py gh-76760: test that uuid.uuid1() sets the version field (#139033) 2025-09-17 13:31:51 +00:00
warnings.py gh-128384: Use a context variable for warnings.catch_warnings (gh-130010) 2025-04-09 16:18:54 -07:00
wave.py gh-141968: use bytearray.take_bytes in wave._byteswap (#141973) 2025-11-26 21:15:12 +05:30
weakref.py
webbrowser.py gh-130645: Add color to stdlib argparse CLIs (gh-133380) 2025-05-05 19:46:46 +02:00
zipapp.py gh-130645: Add color to stdlib argparse CLIs (gh-133380) 2025-05-05 19:46:46 +02:00
zipimport.py gh-135801: Add the module parameter to compile() etc (GH-139652) 2025-11-13 13:21:32 +02:00