Summary
seqlock_begin_write increments the generation counter using normal integer addition, while seqlock_end_write already uses wrapping_add.
Location
apis/python/node/src/lib.rs
Current behavior
The write-begin path increments the generation counter using:
The write-end path already uses:
This creates inconsistent overflow handling.
In debug builds, normal integer addition can panic on overflow, whereas wrapping_add preserves the intended wrapping semantics of the sequence counter.
Suggested fix
Replace
with
pre_write_gen.wrapping_add(1)
to make both write paths use consistent overflow behavior.
Summary
seqlock_begin_writeincrements the generation counter using normal integer addition, whileseqlock_end_writealready useswrapping_add.Location
apis/python/node/src/lib.rsCurrent behavior
The write-begin path increments the generation counter using:
pre_write_gen + 1The write-end path already uses:
This creates inconsistent overflow handling.
In debug builds, normal integer addition can panic on overflow, whereas
wrapping_addpreserves the intended wrapping semantics of the sequence counter.Suggested fix
Replace
pre_write_gen + 1with
to make both write paths use consistent overflow behavior.