]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
GH-137466: Remove deprecated and undocumented `glob.glob0()` and `glob1()` (#137467)
authorBarney Gale <barney.gale@gmail.com>
Wed, 6 Aug 2025 16:13:58 +0000 (17:13 +0100)
committerGitHub <noreply@github.com>
Wed, 6 Aug 2025 16:13:58 +0000 (17:13 +0100)
Doc/whatsnew/3.15.rst
Lib/glob.py
Lib/test/test_glob.py
Misc/NEWS.d/next/Library/2025-08-06-16-13-47.gh-issue-137466.Whv0-A.rst [new file with mode: 0644]

index 54964da473760db6250e70d17fe47ec3a54c983b..89644a509a0bb4aa55e3fad1a4cfd84620364e9b 100644 (file)
@@ -418,6 +418,15 @@ ctypes
   (Contributed by Bénédikt Tran in :gh:`133866`.)
 
 
+glob
+----
+
+* Removed the undocumented :func:`!glob.glob0` and :func:`!glob.glob1`
+  functions, which have been deprecated since Python 3.13. Use
+  :func:`glob.glob` and pass a directory to its *root_dir* argument instead.
+  (Contributed by Barney Gale in :gh:`137466`.)
+
+
 http.server
 -----------
 
index 1e48fe431672007b59e086cbadb27d4457f78d3f..5d42077003a24011a39a6b9f5617f400a6904690 100644 (file)
@@ -122,21 +122,6 @@ def _glob0(dirname, basename, dir_fd, dironly, include_hidden=False):
             return [basename]
     return []
 
-_deprecated_function_message = (
-    "{name} is deprecated and will be removed in Python {remove}. Use "
-    "glob.glob and pass a directory to its root_dir argument instead."
-)
-
-def glob0(dirname, pattern):
-    import warnings
-    warnings._deprecated("glob.glob0", _deprecated_function_message, remove=(3, 15))
-    return _glob0(dirname, pattern, None, False)
-
-def glob1(dirname, pattern):
-    import warnings
-    warnings._deprecated("glob.glob1", _deprecated_function_message, remove=(3, 15))
-    return _glob1(dirname, pattern, None, False)
-
 # This helper function recursively yields relative pathnames inside a literal
 # directory.
 
index d0ed5129253cdfb625ae092bb0e89f1b4c96dda4..9e4e82b2542c157386f76e6baab7e3d84d8fa871 100644 (file)
@@ -4,7 +4,6 @@ import re
 import shutil
 import sys
 import unittest
-import warnings
 
 from test.support import is_wasi, Py_DEBUG
 from test.support.os_helper import (TESTFN, skip_unless_symlink,
@@ -393,36 +392,6 @@ class GlobTests(unittest.TestCase):
             for it in iters:
                 self.assertEqual(next(it), p)
 
-    def test_glob0(self):
-        with self.assertWarns(DeprecationWarning):
-            glob.glob0(self.tempdir, 'a')
-
-        with warnings.catch_warnings():
-            warnings.simplefilter('ignore')
-            eq = self.assertSequencesEqual_noorder
-            eq(glob.glob0(self.tempdir, 'a'), ['a'])
-            eq(glob.glob0(self.tempdir, '.bb'), ['.bb'])
-            eq(glob.glob0(self.tempdir, '.b*'), [])
-            eq(glob.glob0(self.tempdir, 'b'), [])
-            eq(glob.glob0(self.tempdir, '?'), [])
-            eq(glob.glob0(self.tempdir, '*a'), [])
-            eq(glob.glob0(self.tempdir, 'a*'), [])
-
-    def test_glob1(self):
-        with self.assertWarns(DeprecationWarning):
-            glob.glob1(self.tempdir, 'a')
-
-        with warnings.catch_warnings():
-            warnings.simplefilter('ignore')
-            eq = self.assertSequencesEqual_noorder
-            eq(glob.glob1(self.tempdir, 'a'), ['a'])
-            eq(glob.glob1(self.tempdir, '.bb'), ['.bb'])
-            eq(glob.glob1(self.tempdir, '.b*'), ['.bb'])
-            eq(glob.glob1(self.tempdir, 'b'), [])
-            eq(glob.glob1(self.tempdir, '?'), ['a'])
-            eq(glob.glob1(self.tempdir, '*a'), ['a', 'aaa'])
-            eq(glob.glob1(self.tempdir, 'a*'), ['a', 'aaa', 'aab'])
-
     def test_translate_matching(self):
         match = re.compile(glob.translate('*')).match
         self.assertIsNotNone(match('foo'))
diff --git a/Misc/NEWS.d/next/Library/2025-08-06-16-13-47.gh-issue-137466.Whv0-A.rst b/Misc/NEWS.d/next/Library/2025-08-06-16-13-47.gh-issue-137466.Whv0-A.rst
new file mode 100644 (file)
index 0000000..918019a
--- /dev/null
@@ -0,0 +1,3 @@
+Remove undocumented :func:`!glob.glob0` and :func:`!glob.glob1` functions,
+which have been deprecated since Python 3.13. Use :func:`glob.glob` and pass
+a directory to its *root_dir* argument instead.