https://github.com/python/cpython/commit/871047dbb82ab9a89f364a4ec62cf05f94706124
commit: 871047dbb82ab9a89f364a4ec62cf05f94706124
branch: main
author: Victorien <[email protected]>
committer: ethanfurman <[email protected]>
date: 2026-06-10T13:43:09-07:00
summary:

gh-139819: Use builtin `sentinel` in `rlcompleter` (GH-151222)

Co-authored-by: Ethan Furman <[email protected]>

files:
M Lib/rlcompleter.py

diff --git a/Lib/rlcompleter.py b/Lib/rlcompleter.py
index 271b77a322fdd2..26fcda612567ea 100644
--- a/Lib/rlcompleter.py
+++ b/Lib/rlcompleter.py
@@ -41,7 +41,7 @@
 __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 @@ def attr_matches(self, text):
                        ):
                         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)

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]

Reply via email to