On 28/10/2025 23.03, John Snow wrote:
Pylint 4.x has refined checking for variable names that behave as
constants vs ones that do not; unfortunately our tricky import machinery
is perceived as these variables being re-assigned.

Add a temporary variable with an underscore and assign to the global
constants precisely once to alleviate this new nag message.

Signed-off-by: John Snow <[email protected]>
---
  python/scripts/mkvenv.py | 24 ++++++++++++++++--------
  python/setup.cfg         |  1 +
  2 files changed, 17 insertions(+), 8 deletions(-)

...> diff --git a/python/setup.cfg b/python/setup.cfg
index d7f5dc7bafe..f40f11396c9 100644
--- a/python/setup.cfg
+++ b/python/setup.cfg
@@ -159,6 +159,7 @@ good-names=i,
             c,   # for c in string: ...
             T,   # for TypeVars. See pylint#3401
             SocketAddrT,  # Not sure why this is invalid.
+           _import_ok,  # For mkvenv import trickery and compatibility pre-4.x

Out of curiosity, is it really necessary to add _import_ok to good-names, or is this just for being on the safe side for future changes in pylint?

Anyway,
Reviewed-by: Thomas Huth <[email protected]>


Reply via email to