unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Michael-David Fiszer <sguibor@gmail.com>
To: Augusto Stoffel <arstoffel@gmail.com>
Cc: 50669@debbugs.gnu.org
Subject: bug#50669: 28.0.50; python-shell-send-string leads to "nesting exceeds `max-lisp-eval-depth`" error
Date: Sun, 19 Sep 2021 13:36:33 +0300	[thread overview]
Message-ID: <CAGXwvLsNdrwFQ18nTmpuVrjzxfirbsUH5oqBKqdmTBXDonnwwA@mail.gmail.com> (raw)
In-Reply-To: <CAGXwvLvKQhpeJ=rrwtKiv4JRZm9Pg1wYp-QyaWCZZwpeCwQV+g@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 5663 bytes --]

Adding more details. BTW, no issues at all (none of the two, as it looks
like there may be two different issues) if I just do:

(advice-add 'python-shell-send-string :override
#'python-shell-send-string27)

where 'python-shell-send-string27 is the python-shell-send-string function
from emacs 27.2.

(regarding the backtrace, I realize it's hard to read - is there a better
way to send it formatted in this thread?)


On Sun, Sep 19, 2021 at 12:28 PM Michael-David Fiszer <sguibor@gmail.com>
wrote:

> Hi!
>
> Thanks for the response!
>
> I'll fill in the details shortly. I wanted to add to the bug, that the
> functions being called repeatedly were `python-shell-send-string` and
> `python-shell-send-file`.
>
> They call one another and create more and more temporary files before I
> get the recursion error.
>
> As a side note, python.el really rocks. Thanks so much for the amazing
> work.
>
> On Sun, Sep 19, 2021 at 12:10 PM Augusto Stoffel <arstoffel@gmail.com>
> wrote:
>
>> On Sun, 19 Sep 2021 at 03:32, Michael-David Fiszer <sguibor@gmail.com>
>> wrote:
>>
>> > Hi,
>>
>> Hi,
>>
>> Can you try 'M-x toggle-debug-on-error', or maybe tracing some
>> functions, to discover what is being called repeatedly?
>>
>> Also, what happens if you (setq python-eldoc-get-doc nil) in the .py
>> file's buffer?
>>
>
> I'll try this asap. I thought it was eldoc, but then tried turning off
> 'eldoc-mode' off and I still had the same problem with the infinite
> recursion (and I think I still saw the weird PYDOC strings, but not sure).
>
> But I will try this today.
>

This did not change anything to the nested lisp error, but does remove the
prints of "def __PYDOC_get_help(obj)". So it looks like there may have been
two different issues here.

>
>
>>
>> Some more macos-related things that would be helpful to know:
>>
>> * On a freshly started python-shell, is are the functions
>>   __PYTHON_EL_eval and __PYTHON_EL_eval_file defined?
>>
>
> I just checked, and they both are.
>
> <function __main__.__PYTHON_EL_eval(source, filename)>
> <function __main__.__PYTHON_EL_eval_file(filename, tempname, delete)>
>
>>
>> * If you do M-x python-shell-send-string RET x="aaa...aaa" or something
>>   like that, can you evaluate Python statements that are, say, 900 and
>>   1100 characters long?
>
>
> Will try this immediately
>

So, interesting, if I write

x = "aaa....a" in my py file (calling python-shell-send-string
interactively doesn't work like that, shoud it?), it works for len(x) = 422
and not for len(x)=423 (same error "nesting exceeds").


>
>
>
>>
>> >
>> > I'm not an expert in how python.el internals work, but I started
>> getting this error every time I would
>> > send a statement to the shell. In addition I would get these weird
>> printouts of blocks of the form
>> >
>> > ```
>> >   def __PYDOC_get_help(obj):
>> >     try:
>> >         import inspect
>> >         try:
>> >             str_type = basestring
>> >             argspec_function = inspect.getargspec
>> >         except NameError:
>> >             str_type = str
>> > ```
>> >
>> > while just moving the point in my .py file.
>> >
>> > My current workaround was to simply override python-shell-send-string
>> from 28.0.50 with the one
>> > I had with my emacs 27 version, which was:
>> >
>> > ```
>> > (defun python-shell-send-string (string &optional process msg)
>> >   "Send STRING to inferior Python PROCESS.
>> > When optional argument MSG is non-nil, forces display of a
>> > user-friendly message if there's no process running; defaults to
>> > t when called interactively."
>> >   (interactive
>> >    (list (read-string "Python command: ") nil t))
>> >   (let ((process (or process (python-shell-get-process-or-error msg))))
>> >     (if (string-match ".\n+." string)   ;Multiline.
>> >         (let* ((temp-file-name (python-shell--save-temp-file string))
>> >                (file-name (or (buffer-file-name) temp-file-name)))
>> >           (python-shell-send-file file-name process temp-file-name t))
>> >       (when (or (not (string-match "\n\\'" string))
>> >                 (string-match "\n[ \t].*\n?\\'" string))
>> >         (comint-send-string process "\n")))))
>> > ```
>> >
>> > And this seems to solve the problem...
>> >
>> > In GNU Emacs 28.0.50 (build 1, x86_64-apple-darwin20.6.0, NS
>> appkit-2022.60 Version 11.6
>> > (Build 20G165))
>> >  of 2021-09-17 built on mdfz-macbookpro4.roam.corp.google.com
>> > Windowing system distributor 'Apple', version 10.3.2022
>> > System Description:  macOS 11.6
>> >
>> > Configured using:
>> >  'configure --disable-dependency-tracking --disable-silent-rules
>> >  --enable-locallisppath=/usr/local/share/emacs/site-lisp
>> >  --infodir=/usr/local/Cellar/emacs-plus@28/28.0.50/share/info/emacs
>> >  --prefix=/usr/local/Cellar/emacs-plus@28/28.0.50 --with-xml2
>> --with-gnutls
>> >  --without-dbus --with-imagemagick --with-modules --with-rsvg --with-ns
>> >  --disable-ns-self-contained'
>> >
>> > Configured features:
>> > ACL GLIB GMP GNUTLS IMAGEMAGICK JPEG JSON LCMS2 LIBXML2 MODULES NOTIFY
>> KQUEUE
>> > NS
>> > PDUMPER PNG RSVG THREADS TIFF TOOLKIT_SCROLL_BARS XIM ZLIB
>> >
>> > Important settings:
>> >   value of $LC_ALL: en_US.UTF-8
>> >   value of $LC_CTYPE: en_US.UTF-8
>> >   value of $LANG: en_US.UTF-8
>> >   locale-coding-system: utf-8-unix
>> >
>> > Major mode: mu4e-headers
>> >
>> > Memory information:
>> > ((conses 16 1905022 1639005)
>> >  (symbols 48 123242 97)
>> >  (strings 32 433582 151543)
>> >  (string-bytes 1 14825386)
>> >  (vectors 16 192606)
>> >  (vector-slots 8 3165377 831342)
>> >  (floats 8 1100 6586)
>> >  (intervals 56 34684 19693)
>> >  (buffers 992 60))
>>
>

[-- Attachment #2: Type: text/html, Size: 8429 bytes --]

  parent reply	other threads:[~2021-09-19 10:36 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-19  0:32 bug#50669: 28.0.50; python-shell-send-string leads to "nesting exceeds `max-lisp-eval-depth`" error Michael-David Fiszer
2021-09-19  9:10 ` Augusto Stoffel
2021-09-19  9:28   ` Michael-David Fiszer
2021-09-19  9:42     ` Augusto Stoffel
2021-09-19  9:52       ` Michael-David Fiszer
2021-09-19 10:36     ` Michael-David Fiszer [this message]
2021-09-19 16:12       ` Augusto Stoffel
2021-09-21 21:17         ` Michael-David Fiszer
2022-08-26 11:46 ` Lars Ingebrigtsen
2022-09-24 14:59   ` Lars Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAGXwvLsNdrwFQ18nTmpuVrjzxfirbsUH5oqBKqdmTBXDonnwwA@mail.gmail.com \
    --to=sguibor@gmail.com \
    --cc=50669@debbugs.gnu.org \
    --cc=arstoffel@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).