The following blocks are the result of the source below. You can see the difference in vertical spacing. Where is it coming from and how to get rid of it? 
\documentclass[a4paper]{beamer}
\usepackage{listings}
\usetheme{Warsaw}
\begin{document}
\lstset{language=Python, columns=fullflexible}
\begin{frame}[fragile]{Test}
\begin{block}{Excessive vertical space both above and below}
\begin{lstlisting}
nums = list(range(1,10))
\end{lstlisting}
\end{block}
\begin{block}{No problems with vertical spacing}
Is there?
\end{block}
\end{frame}
\end{document}
