mirror of
https://github.com/python/cpython.git
synced 2025-07-07 19:35:27 +00:00
gh-105456: Remove 3 deprecated sre_*
modules (#135994)
This commit is contained in:
parent
12ce16bc13
commit
93809a918f
10 changed files with 11 additions and 58 deletions
|
@ -97,6 +97,8 @@ Pending removal in Python 3.15
|
||||||
After eight years in the :mod:`typing` module,
|
After eight years in the :mod:`typing` module,
|
||||||
it has yet to be supported by any major type checker.
|
it has yet to be supported by any major type checker.
|
||||||
|
|
||||||
|
* :mod:`!sre_compile`, :mod:`!sre_constants` and :mod:`!sre_parse` modules.
|
||||||
|
|
||||||
* :mod:`wave`:
|
* :mod:`wave`:
|
||||||
|
|
||||||
* The ``getmark()``, ``setmark()`` and ``getmarkers()`` methods of
|
* The ``getmark()``, ``setmark()`` and ``getmarkers()`` methods of
|
||||||
|
|
|
@ -89,8 +89,6 @@ although there is currently no date scheduled for their removal.
|
||||||
underscore.
|
underscore.
|
||||||
(Contributed by Serhiy Storchaka in :gh:`91760`.)
|
(Contributed by Serhiy Storchaka in :gh:`91760`.)
|
||||||
|
|
||||||
* :mod:`!sre_compile`, :mod:`!sre_constants` and :mod:`!sre_parse` modules.
|
|
||||||
|
|
||||||
* :mod:`shutil`: :func:`~shutil.rmtree`'s *onerror* parameter is deprecated in
|
* :mod:`shutil`: :func:`~shutil.rmtree`'s *onerror* parameter is deprecated in
|
||||||
Python 3.12; use the *onexc* parameter instead.
|
Python 3.12; use the *onexc* parameter instead.
|
||||||
|
|
||||||
|
|
|
@ -252,6 +252,13 @@ platform
|
||||||
(Contributed by Alexey Makridenko in :gh:`133604`.)
|
(Contributed by Alexey Makridenko in :gh:`133604`.)
|
||||||
|
|
||||||
|
|
||||||
|
sre_*
|
||||||
|
-----
|
||||||
|
|
||||||
|
* Removed :mod:`!sre_compile`, :mod:`!sre_constants` and :mod:`!sre_parse` modules.
|
||||||
|
(Contributed by Stan Ulbrych in :gh:`135994`.)
|
||||||
|
|
||||||
|
|
||||||
sysconfig
|
sysconfig
|
||||||
---------
|
---------
|
||||||
|
|
||||||
|
|
|
@ -1,7 +0,0 @@
|
||||||
import warnings
|
|
||||||
warnings.warn(f"module {__name__!r} is deprecated",
|
|
||||||
DeprecationWarning,
|
|
||||||
stacklevel=2)
|
|
||||||
|
|
||||||
from re import _compiler as _
|
|
||||||
globals().update({k: v for k, v in vars(_).items() if k[:2] != '__'})
|
|
|
@ -1,7 +0,0 @@
|
||||||
import warnings
|
|
||||||
warnings.warn(f"module {__name__!r} is deprecated",
|
|
||||||
DeprecationWarning,
|
|
||||||
stacklevel=2)
|
|
||||||
|
|
||||||
from re import _constants as _
|
|
||||||
globals().update({k: v for k, v in vars(_).items() if k[:2] != '__'})
|
|
|
@ -1,7 +0,0 @@
|
||||||
import warnings
|
|
||||||
warnings.warn(f"module {__name__!r} is deprecated",
|
|
||||||
DeprecationWarning,
|
|
||||||
stacklevel=2)
|
|
||||||
|
|
||||||
from re import _parser as _
|
|
||||||
globals().update({k: v for k, v in vars(_).items() if k[:2] != '__'})
|
|
|
@ -11,7 +11,6 @@ from types import FunctionType, MethodType, BuiltinFunctionType
|
||||||
import pyclbr
|
import pyclbr
|
||||||
from unittest import TestCase, main as unittest_main
|
from unittest import TestCase, main as unittest_main
|
||||||
from test.test_importlib import util as test_importlib_util
|
from test.test_importlib import util as test_importlib_util
|
||||||
import warnings
|
|
||||||
|
|
||||||
|
|
||||||
StaticMethodType = type(staticmethod(lambda: None))
|
StaticMethodType = type(staticmethod(lambda: None))
|
||||||
|
@ -246,9 +245,6 @@ class PyclbrTest(TestCase):
|
||||||
# These were once some of the longest modules.
|
# These were once some of the longest modules.
|
||||||
cm('random', ignore=('Random',)) # from _random import Random as CoreGenerator
|
cm('random', ignore=('Random',)) # from _random import Random as CoreGenerator
|
||||||
cm('pickle', ignore=('partial', 'PickleBuffer'))
|
cm('pickle', ignore=('partial', 'PickleBuffer'))
|
||||||
with warnings.catch_warnings():
|
|
||||||
warnings.simplefilter('ignore', DeprecationWarning)
|
|
||||||
cm('sre_parse', ignore=('dump', 'groups', 'pos')) # from sre_constants import *; property
|
|
||||||
with temporary_main_spec():
|
with temporary_main_spec():
|
||||||
cm(
|
cm(
|
||||||
'pdb',
|
'pdb',
|
||||||
|
|
|
@ -5,7 +5,6 @@ from test.support import (gc_collect, bigmemtest, _2G,
|
||||||
import locale
|
import locale
|
||||||
import re
|
import re
|
||||||
import string
|
import string
|
||||||
import sys
|
|
||||||
import unittest
|
import unittest
|
||||||
import warnings
|
import warnings
|
||||||
from re import Scanner
|
from re import Scanner
|
||||||
|
@ -2927,33 +2926,6 @@ class ImplementationTest(unittest.TestCase):
|
||||||
pat = re.compile("")
|
pat = re.compile("")
|
||||||
check_disallow_instantiation(self, type(pat.scanner("")))
|
check_disallow_instantiation(self, type(pat.scanner("")))
|
||||||
|
|
||||||
def test_deprecated_modules(self):
|
|
||||||
deprecated = {
|
|
||||||
'sre_compile': ['compile', 'error',
|
|
||||||
'SRE_FLAG_IGNORECASE', 'SUBPATTERN',
|
|
||||||
'_compile_info'],
|
|
||||||
'sre_constants': ['error', 'SRE_FLAG_IGNORECASE', 'SUBPATTERN',
|
|
||||||
'_NamedIntConstant'],
|
|
||||||
'sre_parse': ['SubPattern', 'parse',
|
|
||||||
'SRE_FLAG_IGNORECASE', 'SUBPATTERN',
|
|
||||||
'_parse_sub'],
|
|
||||||
}
|
|
||||||
for name in deprecated:
|
|
||||||
with self.subTest(module=name):
|
|
||||||
sys.modules.pop(name, None)
|
|
||||||
with self.assertWarns(DeprecationWarning) as w:
|
|
||||||
__import__(name)
|
|
||||||
self.assertEqual(str(w.warning),
|
|
||||||
f"module {name!r} is deprecated")
|
|
||||||
self.assertEqual(w.filename, __file__)
|
|
||||||
self.assertIn(name, sys.modules)
|
|
||||||
mod = sys.modules[name]
|
|
||||||
self.assertEqual(mod.__name__, name)
|
|
||||||
self.assertEqual(mod.__package__, '')
|
|
||||||
for attr in deprecated[name]:
|
|
||||||
self.assertHasAttr(mod, attr)
|
|
||||||
del sys.modules[name]
|
|
||||||
|
|
||||||
@cpython_only
|
@cpython_only
|
||||||
def test_case_helpers(self):
|
def test_case_helpers(self):
|
||||||
import _sre
|
import _sre
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
Removed :mod:`!sre_compile`, :mod:`!sre_constants` and :mod:`!sre_parse`
|
||||||
|
modules.
|
3
Python/stdlib_module_names.h
generated
3
Python/stdlib_module_names.h
generated
|
@ -245,9 +245,6 @@ static const char* _Py_stdlib_module_names[] = {
|
||||||
"socket",
|
"socket",
|
||||||
"socketserver",
|
"socketserver",
|
||||||
"sqlite3",
|
"sqlite3",
|
||||||
"sre_compile",
|
|
||||||
"sre_constants",
|
|
||||||
"sre_parse",
|
|
||||||
"ssl",
|
"ssl",
|
||||||
"stat",
|
"stat",
|
||||||
"statistics",
|
"statistics",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue