diff --git a/dune/python/istl/bvector.hh b/dune/python/istl/bvector.hh
index ec822af38e635aefd9e6ebc5e14c307b8e896cdf..742d9583b61f727067e9e5c8df3201ce8b571444 100644
--- a/dune/python/istl/bvector.hh
+++ b/dune/python/istl/bvector.hh
@@ -57,12 +57,13 @@ namespace Dune
       inline static void copy ( pybind11::buffer buffer, BlockVector &v )
       {
         typedef typename BlockVector::field_type field_type;
+        typedef typename BlockVector::size_type  size_type;
 
         pybind11::buffer_info info = buffer.request();
 
         if( info.format != pybind11::format_descriptor< field_type >::format() )
           throw pybind11::value_error( "Incompatible buffer format." );
-        if( info.ndim != blockLevel<BlockVector>() )
+        if( size_type(info.ndim) != blockLevel<BlockVector>() )
           throw pybind11::value_error( "Block vectors can only be initialized from one-dimensional buffers." );
 
         copy( static_cast< const char * >( info.ptr ), info.shape.data(), info.strides.data(), v );