`FastQueue.put_nowait()` has an off-by-one capacity check and incorrect
handling of `maxSize=0`.
Current code in `pysyncobj/fast_queue.py`:
```python
if len(self.__queue) > self.__maxSize:
raise Queue.Full()
Because the condition is checked before appending:
- FastQueue(1) accepts two items, and only rejects the third;
- FastQueue(0) accepts one item, then rejects the second.
Minimal reproducer:
import queue
from pysyncobj.fast_queue import FastQueue
for max_size in (1, 0):
q = FastQueue(max_size)
q.put_nowait("first")
try:
q.put_nowait("second")
print(f"FastQueue({max_size}): second item accepted")
except queue.Full:
print(f"FastQueue({max_size}): second item rejected")
Actual output:
FastQueue(1): second item accepted
FastQueue(0): second item rejected
Expected behavior:
- For FastQueue(1), the second item should raise queue.Full.
- SyncObjConf.validate() accepts commandsQueueSize=0, and SyncObj
passes it directly to FastQueue. Following the standard Python
queue.Queue(maxsize=0) convention, zero should mean an unbounded queue,
so multiple items should be accepted.
Suggested fix:
if self.__maxSize > 0 and len(self.__queue) >= self.__maxSize:
raise Queue.Full()
This is confirmed on the current upstream master source.
Because the condition is checked before appending:
Minimal reproducer:
Actual output:
Expected behavior:
passes it directly to FastQueue. Following the standard Python
queue.Queue(maxsize=0) convention, zero should mean an unbounded queue,
so multiple items should be accepted.
Suggested fix:
This is confirmed on the current upstream master source.