]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-139819: Use builtin `sentinel` in `rlcompleter` (GH-151222)
authorVictorien <65306057+Viicos@users.noreply.github.com>
Wed, 10 Jun 2026 20:43:09 +0000 (22:43 +0200)
committerGitHub <noreply@github.com>
Wed, 10 Jun 2026 20:43:09 +0000 (13:43 -0700)
Co-authored-by: Ethan Furman <ethan@stoneleaf.us>
Lib/rlcompleter.py

index 271b77a322fdd2bde530623b14d06d8e560eaa2f..26fcda612567ea43662c45a4f9e5fdbb2cb39a43 100644 (file)
@@ -41,7 +41,7 @@ import types
 __all__ = ["Completer"]
 
 # Sentinel object to distinguish "missing" from "present but None"
-_SENTINEL = object()
+_MISSING = sentinel("MISSING")
 
 class Completer:
     def __init__(self, namespace = None):
@@ -200,9 +200,9 @@ class Completer:
                        ):
                         value = thisobject.__dict__.get(word)
                     else:
-                        value = getattr(thisobject, word, _SENTINEL)
+                        value = getattr(thisobject, word, _MISSING)
 
-                    if value is not _SENTINEL:
+                    if value is not _MISSING:
                         matches.append(self._callable_postfix(value, match))
                     elif word in getattr(type(thisobject), '__slots__', ()):
                         matches.append(match)