Skip to content

Commit 4a1aa23

Browse files
committed
PYCBC-1828: Propagate OOM failures from init_pycbc_dict_keys
Changes -------- * Change init_pycbc_dict_keys to return int, checking each of the ~130 interned dict-key globals and returning -1 on the first PyUnicode_FromString failure instead of leaving the global permanently null with no signal to the caller * Update the pycbc_dict_keys.hxx/.cxx Jinja2 templates to match, and regenerate the bindings so the checked-in output stays in sync * Check init_pycbc_dict_keys's return value in PyInit__core, failing module init cleanly (Py_DECREF(module); return nullptr) on the same pattern already used for cache_exception_classes and the other init steps, instead of silently continuing with null interned keys Change-Id: I2919a3dbada81e6e79de1584eed7ce4f38b9aadf Reviewed-on: https://review.couchbase.org/c/couchbase-python-client/+/250070 Tested-by: Build Bot <build@couchbase.com> Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>
1 parent d29be2f commit 4a1aa23

5 files changed

Lines changed: 379 additions & 9 deletions

File tree

src/module.cxx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,10 @@ PyInit__core(void)
180180
return nullptr;
181181
}
182182

183-
init_pycbc_dict_keys();
183+
if (init_pycbc_dict_keys() < 0) {
184+
Py_DECREF(module);
185+
return nullptr;
186+
}
184187

185188
return module;
186189
}

0 commit comments

Comments
 (0)