Is there any way I can get rid of the empty new row produced by lstlisting inside a tabular?

Here's a minimum working example:
\documentclass[11pt]{article}
\usepackage{listings}
\lstset{
language=python,
showspaces=false,
showtabs=false,
tabsize=4,
frame=trbl,
frameround=tttt,
basicstyle=\ttfamily,
showstringspaces=false,
numbers=left,
breaklines=true,
}
\begin{document}
\begin{tabular}{l | p{0.8\textwidth}}
test &
\begin{lstlisting}
somecode
\end{lstlisting}
\end{tabular}
rest of text
\end{document}
I'm using TexShop with xelatex.
Follow-up question: It also seems to break when I'm using longtable: The tables don't continue into other pages, instead it creates huge gaps and I'm suspecting it has to do with lstlisting.