@@ -65,9 +65,10 @@ def custom_reader(
6565 open_cb = OPEN_CALLBACK (open_func ) if open_func else NO_OPEN_CB
6666 read_cb = READ_CALLBACK (read_func )
6767 close_cb = CLOSE_CALLBACK (close_func ) if close_func else NO_CLOSE_CB
68+ seek_cb = SEEK_CALLBACK (seek_func )
6869 with new_archive_read (format_name , filter_name , passphrase ) as archive_p :
6970 if seek_func :
70- ffi .read_set_seek_callback (archive_p , SEEK_CALLBACK ( seek_func ) )
71+ ffi .read_set_seek_callback (archive_p , seek_cb )
7172 ffi .read_open (archive_p , None , open_cb , read_cb , close_cb )
7273 yield archive_read_class (archive_p )
7374
@@ -143,9 +144,10 @@ def seek_func(archive_p, context, offset, whence):
143144 open_cb = NO_OPEN_CB
144145 read_cb = READ_CALLBACK (read_func )
145146 close_cb = NO_CLOSE_CB
147+ seek_cb = SEEK_CALLBACK (seek_func )
146148 with new_archive_read (format_name , filter_name , passphrase ) as archive_p :
147149 if stream .seekable ():
148- ffi .read_set_seek_callback (archive_p , SEEK_CALLBACK ( seek_func ) )
150+ ffi .read_set_seek_callback (archive_p , seek_cb )
149151 ffi .read_open (archive_p , None , open_cb , read_cb , close_cb )
150152 yield ArchiveRead (archive_p )
151153
0 commit comments