@@ -759,7 +759,7 @@ def send(
759759 content : dict [str , t .Any ] | None = None ,
760760 parent : dict [str , t .Any ] | None = None ,
761761 ident : bytes | list [bytes ] | None = None ,
762- buffers : list [bytes ] | None = None ,
762+ buffers : list [bytes | memoryview [ bytes ] ] | None = None ,
763763 track : bool = False ,
764764 header : dict [str , t .Any ] | None = None ,
765765 metadata : dict [str , t .Any ] | None = None ,
@@ -844,14 +844,15 @@ def send(
844844 raise TypeError (emsg ) from e
845845 # memoryview.contiguous is new in 3.3,
846846 # just skip the check on Python 2
847+ assert hasattr (view , "contiguous" ), "We should only be on python 3.9+ now"
847848 if hasattr (view , "contiguous" ) and not view .contiguous :
848849 # zmq requires memoryviews to be contiguous
849850 raise ValueError ("Buffer %i (%r) is not contiguous" % (idx , buf ))
850851
851852 if self .adapt_version :
852853 msg = adapt (msg , self .adapt_version )
853854 to_send = self .serialize (msg , ident )
854- to_send .extend (buffers )
855+ to_send .extend (buffers ) # type: ignore[arg-type]
855856 longest = max ([len (s ) for s in to_send ])
856857 copy = longest < self .copy_threshold
857858
0 commit comments