summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Python/context.c8
-rw-r--r--Python/hamt.c2
2 files changed, 6 insertions, 4 deletions
diff --git a/Python/context.c b/Python/context.c
index 5439531..d90ed25 100644
--- a/Python/context.c
+++ b/Python/context.c
@@ -134,7 +134,9 @@ PyContextVar_New(const char *name, PyObject *def)
if (pyname == NULL) {
return NULL;
}
- return contextvar_new(pyname, def);
+ PyContextVar *var = contextvar_new(pyname, def);
+ Py_DECREF(pyname);
+ return var;
}
@@ -741,8 +743,8 @@ contextvar_new(PyObject *name, PyObject *def)
var->var_cached_tsid = 0;
var->var_cached_tsver = 0;
- if (_PyObject_GC_IS_TRACKED(name) ||
- (def != NULL && _PyObject_GC_IS_TRACKED(def)))
+ if (_PyObject_GC_MAY_BE_TRACKED(name) ||
+ (def != NULL && _PyObject_GC_MAY_BE_TRACKED(def)))
{
PyObject_GC_Track(var);
}
diff --git a/Python/hamt.c b/Python/hamt.c
index df3b109..79c42c0 100644
--- a/Python/hamt.c
+++ b/Python/hamt.c
@@ -449,7 +449,7 @@ hamt_bitcount(uint32_t i)
*/
i = i - ((i >> 1) & 0x55555555);
i = (i & 0x33333333) + ((i >> 2) & 0x33333333);
- return ((i + (i >> 4) & 0xF0F0F0F) * 0x1010101) >> 24;
+ return (((i + (i >> 4)) & 0xF0F0F0F) * 0x1010101) >> 24;
}
static inline uint32_t