Lisp nesting exceeds max-lisp-eval-depth

Hello! I have this simple Python test program:


#! /usr/bin/env python3
import numpy as np

x = np.array([0, 1, 2, 3])
y = np.array([0, 1, 4, 9])

def gen_segments(x, y):
    for i in range(0, len(x)-1):
        yield (x[i], x[i+1]), (y[i], y[i+1])

lines = [list(zip(s, t)) for s, t in gen_segments(x, y)] 

when I position the cursor at the end of the line starting with yield and press ENTER, Emacs gives me the following error:

"Lisp nesting exceeds ‘max-lisp-eval-depth’"

I am using Emacs version 25.2 on Ubuntu 17.04.

Here is a minimal setup to reproduce the problem: 

$ emacs -Q -l init.el t.py

where t.py is the above python program, and init.el is:

(setq debug-on-error t)
(setq package-load-list '((python-mode t)))
(package-initialize)
(setq package-enable-at-startup nil)

The Python mode that package-initialize above loads was installed with the Emacs package manager as python-mode-20170307.457 in my elpa directory. If I comment out the line (package-initialize) above, it works fine (then Emacs uses the Python mode in my /opt/emacs-25.2/share/emacs/25.2/lisp/progmodes/python.el.gz instead).


Configured using:

 'configure CFLAGS=-no-pie --with-xft --prefix=/opt/emacs-25.2'

Configured features:

XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GCONF GSETTINGS
NOTIFY ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB
TOOLKIT_SCROLL_BARS GTK3 X11

Important settings:

  value of $LC_MONETARY: nb_NO.UTF-8
  value of $LC_NUMERIC: nb_NO.UTF-8
  value of $LC_TIME: nb_NO.UTF-8
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: @im=ibus
  locale-coding-system: utf-8-unix