https://github.com/python/cpython/commit/883c2f682bab38344bf8c2bc345d52a9325543cc
commit: 883c2f682bab38344bf8c2bc345d52a9325543cc
branch: main
author: Bénédikt Tran <10796600+picn...@users.noreply.github.com>
committer: brandtbucher <brandtbuc...@gmail.com>
date: 2025-03-20T16:59:41-07:00
summary:

GH-131331: Rename "not" to "invert" (GH-131334)

files:
M Include/internal/pycore_optimizer.h
M Python/optimizer_symbols.c

diff --git a/Include/internal/pycore_optimizer.h 
b/Include/internal/pycore_optimizer.h
index 03c2708e0a0505..4af1fa63ac1f1a 100644
--- a/Include/internal/pycore_optimizer.h
+++ b/Include/internal/pycore_optimizer.h
@@ -202,7 +202,7 @@ typedef struct _jit_opt_tuple {
 
 typedef struct {
     uint8_t tag;
-    bool not;
+    bool invert;
     uint16_t value;
 } JitOptTruthiness;
 
diff --git a/Python/optimizer_symbols.c b/Python/optimizer_symbols.c
index c50f98cb99b396..e8a4f87031b76a 100644
--- a/Python/optimizer_symbols.c
+++ b/Python/optimizer_symbols.c
@@ -115,7 +115,7 @@ _Py_uop_sym_is_const(JitOptContext *ctx, JitOptSymbol *sym)
         if (truthiness < 0) {
             return false;
         }
-        make_const(sym, (truthiness ^ sym->truthiness.not) ? Py_True : 
Py_False);
+        make_const(sym, (truthiness ^ sym->truthiness.invert) ? Py_True : 
Py_False);
         return true;
     }
     return false;
@@ -140,7 +140,7 @@ _Py_uop_sym_get_const(JitOptContext *ctx, JitOptSymbol *sym)
         if (truthiness < 0) {
             return NULL;
         }
-        PyObject *res = (truthiness ^ sym->truthiness.not) ? Py_True : 
Py_False;
+        PyObject *res = (truthiness ^ sym->truthiness.invert) ? Py_True : 
Py_False;
         make_const(sym, res);
         return res;
     }
@@ -291,7 +291,7 @@ _Py_uop_sym_set_const(JitOptContext *ctx, JitOptSymbol 
*sym, PyObject *const_val
             }
             JitOptSymbol *value = allocation_base(ctx) + sym->truthiness.value;
             PyTypeObject *type = _Py_uop_sym_get_type(value);
-            if (const_val == (sym->truthiness.not ? Py_False : Py_True)) {
+            if (const_val == (sym->truthiness.invert ? Py_False : Py_True)) {
                 // value is truthy. This is only useful for bool:
                 if (type == &PyBool_Type) {
                     _Py_uop_sym_set_const(ctx, value, Py_True);
@@ -498,7 +498,7 @@ _Py_uop_sym_truthiness(JitOptContext *ctx, JitOptSymbol 
*sym)
             if (truthiness < 0) {
                 return truthiness;
             }
-            truthiness ^= sym->truthiness.not;
+            truthiness ^= sym->truthiness.invert;
             make_const(sym, truthiness ? Py_True : Py_False);
             return truthiness;
     }
@@ -592,8 +592,8 @@ JitOptSymbol *
 _Py_uop_sym_new_truthiness(JitOptContext *ctx, JitOptSymbol *value, bool 
truthy)
 {
     // It's clearer to invert this in the signature:
-    bool not = !truthy;
-    if (value->tag == JIT_SYM_TRUTHINESS_TAG && value->truthiness.not == not) {
+    bool invert = !truthy;
+    if (value->tag == JIT_SYM_TRUTHINESS_TAG && value->truthiness.invert == 
invert) {
         return value;
     }
     JitOptSymbol *res = sym_new(ctx);
@@ -603,11 +603,11 @@ _Py_uop_sym_new_truthiness(JitOptContext *ctx, 
JitOptSymbol *value, bool truthy)
     int truthiness = _Py_uop_sym_truthiness(ctx, value);
     if (truthiness < 0) {
         res->tag = JIT_SYM_TRUTHINESS_TAG;
-        res->truthiness.not = not;
+        res->truthiness.invert = invert;
         res->truthiness.value = (uint16_t)(value - allocation_base(ctx));
     }
     else {
-        make_const(res, (truthiness ^ not) ? Py_True : Py_False);
+        make_const(res, (truthiness ^ invert) ? Py_True : Py_False);
     }
     return res;
 }

_______________________________________________
Python-checkins mailing list -- python-checkins@python.org
To unsubscribe send an email to python-checkins-le...@python.org
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: arch...@mail-archive.com

Reply via email to