Only one surprise here in c5fe5d32921c0f62cd5ca3ca0fb68d14bd950251. To quote from its commit message:
Mypy couldn't see that state.tagbuf is not None in
crypto_secretstream_xchacha20poly1305_pull, so I used a cast. I
think it's correct to treat this as an Optional[bytes], because the
docstrings mark many cffi unsigned char[] types as bytes. I'd
appreciate a sanity check though!
In particular I'm not familiar with the mechanics of CFFI: My understanding is that the buffer objects it handles aren't regular bytes objects per-se, so I don't know if c5fe5d32921c0f62cd5ca3ca0fb68d14bd950251 is sound.
Alternatively, we could
type ignore the error mentioned in the quote
change the ensure call in that function to something that mypy can understand (i.e. a plain if state.tagbuf is None: raise ...)
Only one surprise here in c5fe5d32921c0f62cd5ca3ca0fb68d14bd950251. To quote from its commit message:
In particular I'm not familiar with the mechanics of CFFI: My understanding is that the
buffer
objects it handles aren't regularbytes
objects per-se, so I don't know if c5fe5d32921c0f62cd5ca3ca0fb68d14bd950251 is sound.Alternatively, we could
ensure
call in that function to something that mypy can understand (i.e. a plainif state.tagbuf is None: raise ...
)