Regression in spacing before lstlisting environment with version 2018/09/02 after paragraph break

Update

This bug was fixed in listings 1.8b 2019-02-28.

Original Answer

For an unknown reason lstlistings adds a \leavevmode in the code, you can try to disable it until the problem is resolved in the code:

\documentclass{article}
\usepackage{listings}
\makeatletter 
\lst@AddToHook{PreSet}{\let\leavevmode\relax}
\makeatother
\begin{document}
Preceding paragraph.

\begin{lstlisting}{}
xxx
\end{lstlisting}


Subsequent paragraph.
\end{document}

I've run into this issue too, Debian stable (buster) contains the buggy version 2018/09/02 1.7.

The solution presented there did not work for me (I did not get the \lst@AddToHook to work), but following the advice from user siracusa (in my question Extra space before listing (Debian stretch vs. buster)?), the listings package can be installed locally into the same directory as the document as follows:

  1. Download listings.ins, listings.dtx, and lstdrvrs.dtx from here: https://www.ctan.org/texarchive/macros/latex/contrib/listings
  2. Extract the files by running etex listings.ins
  3. Compile the document as usual by running pdflatex, the local version of the listings package is preferred

Thanks for the helpful responses and hints! :)