Simple implementation of circular buffer in python extension