We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent b8d2191 commit 9b62a4eCopy full SHA for 9b62a4e
1 file changed
src/impl_/pymodule.rs
@@ -315,14 +315,14 @@ impl PyModuleSlotsBuilder {
315
}
316
317
pub const fn build(self) -> PyModuleSlots {
318
- // Required to guarantee there's still a zeroed element
319
- // at the end
320
PyModuleSlots(UnsafeCell::new(self.values))
321
322
323
const fn push(mut self, slot: c_int, value: *mut c_void) -> Self {
+ // Required to guarantee there's still a zeroed element
+ // at the end
324
assert!(
325
- self.len + 1 <= MAX_SLOTS,
+ self.len < MAX_SLOTS,
326
"Cannot add more than MAX_SLOTS slots to a PyModuleSlots",
327
);
328
self.values[self.len] = ffi::PyModuleDef_Slot { slot, value };
0 commit comments