From: Victorien <65306057+Viicos@users.noreply.github.com> Date: Wed, 10 Jun 2026 20:43:09 +0000 (+0200) Subject: gh-139819: Use builtin `sentinel` in `rlcompleter` (GH-151222) X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=871047dbb82ab9a89f364a4ec62cf05f94706124;p=thirdparty%2FPython%2Fcpython.git gh-139819: Use builtin `sentinel` in `rlcompleter` (GH-151222) Co-authored-by: Ethan Furman --- diff --git a/Lib/rlcompleter.py b/Lib/rlcompleter.py index 271b77a322fd..26fcda612567 100644 --- a/Lib/rlcompleter.py +++ b/Lib/rlcompleter.py @@ -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)