Skip to content

Commit 93809a9

Browse files
gh-105456: Remove 3 deprecated sre_* modules (#135994)
1 parent 12ce16b commit 93809a9

File tree

10 files changed

+11
-58
lines changed

10 files changed

+11
-58
lines changed

Doc/deprecations/pending-removal-in-3.15.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,8 @@ Pending removal in Python 3.15
9797
After eight years in the :mod:`typing` module,
9898
it has yet to be supported by any major type checker.
9999

100+
* :mod:`!sre_compile`, :mod:`!sre_constants` and :mod:`!sre_parse` modules.
101+
100102
* :mod:`wave`:
101103

102104
* The ``getmark()``, ``setmark()`` and ``getmarkers()`` methods of

Doc/deprecations/pending-removal-in-future.rst

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,6 @@ although there is currently no date scheduled for their removal.
8989
underscore.
9090
(Contributed by Serhiy Storchaka in :gh:`91760`.)
9191

92-
* :mod:`!sre_compile`, :mod:`!sre_constants` and :mod:`!sre_parse` modules.
93-
9492
* :mod:`shutil`: :func:`~shutil.rmtree`'s *onerror* parameter is deprecated in
9593
Python 3.12; use the *onexc* parameter instead.
9694

Doc/whatsnew/3.15.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,13 @@ platform
252252
(Contributed by Alexey Makridenko in :gh:`133604`.)
253253

254254

255+
sre_*
256+
-----
257+
258+
* Removed :mod:`!sre_compile`, :mod:`!sre_constants` and :mod:`!sre_parse` modules.
259+
(Contributed by Stan Ulbrych in :gh:`135994`.)
260+
261+
255262
sysconfig
256263
---------
257264

Lib/sre_compile.py

Lines changed: 0 additions & 7 deletions
This file was deleted.

Lib/sre_constants.py

Lines changed: 0 additions & 7 deletions
This file was deleted.

Lib/sre_parse.py

Lines changed: 0 additions & 7 deletions
This file was deleted.

Lib/test/test_pyclbr.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
import pyclbr
1212
from unittest import TestCase, main as unittest_main
1313
from test.test_importlib import util as test_importlib_util
14-
import warnings
1514

1615

1716
StaticMethodType = type(staticmethod(lambda: None))
@@ -246,9 +245,6 @@ def test_others(self):
246245
# These were once some of the longest modules.
247246
cm('random', ignore=('Random',)) # from _random import Random as CoreGenerator
248247
cm('pickle', ignore=('partial', 'PickleBuffer'))
249-
with warnings.catch_warnings():
250-
warnings.simplefilter('ignore', DeprecationWarning)
251-
cm('sre_parse', ignore=('dump', 'groups', 'pos')) # from sre_constants import *; property
252248
with temporary_main_spec():
253249
cm(
254250
'pdb',

Lib/test/test_re.py

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import locale
66
import re
77
import string
8-
import sys
98
import unittest
109
import warnings
1110
from re import Scanner
@@ -2927,33 +2926,6 @@ def test_disallow_instantiation(self):
29272926
pat = re.compile("")
29282927
check_disallow_instantiation(self, type(pat.scanner("")))
29292928

2930-
def test_deprecated_modules(self):
2931-
deprecated = {
2932-
'sre_compile': ['compile', 'error',
2933-
'SRE_FLAG_IGNORECASE', 'SUBPATTERN',
2934-
'_compile_info'],
2935-
'sre_constants': ['error', 'SRE_FLAG_IGNORECASE', 'SUBPATTERN',
2936-
'_NamedIntConstant'],
2937-
'sre_parse': ['SubPattern', 'parse',
2938-
'SRE_FLAG_IGNORECASE', 'SUBPATTERN',
2939-
'_parse_sub'],
2940-
}
2941-
for name in deprecated:
2942-
with self.subTest(module=name):
2943-
sys.modules.pop(name, None)
2944-
with self.assertWarns(DeprecationWarning) as w:
2945-
__import__(name)
2946-
self.assertEqual(str(w.warning),
2947-
f"module {name!r} is deprecated")
2948-
self.assertEqual(w.filename, __file__)
2949-
self.assertIn(name, sys.modules)
2950-
mod = sys.modules[name]
2951-
self.assertEqual(mod.__name__, name)
2952-
self.assertEqual(mod.__package__, '')
2953-
for attr in deprecated[name]:
2954-
self.assertHasAttr(mod, attr)
2955-
del sys.modules[name]
2956-
29572929
@cpython_only
29582930
def test_case_helpers(self):
29592931
import _sre
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Removed :mod:`!sre_compile`, :mod:`!sre_constants` and :mod:`!sre_parse`
2+
modules.

Python/stdlib_module_names.h

Lines changed: 0 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)