You are right. They are not calling one another (python-shell-send-file calls comint). I think that it may that something is making them be called one after another (my bad).

Backtrace looks like this (I changed the file name to `a_file_name` since it's a company path)

  string-match-p("magit-.*: .*" "rider_now_utils.py")
  (not (string-match-p useless-regexp buf-name))
  (setq --cl-flag-- (not (string-match-p useless-regexp buf-name)))
  (progn (setq useless-regexp (car --cl-var--)) (setq --cl-flag-- (not (string-match-p useless-regexp buf-name))))
  (and (consp --cl-var--) (progn (setq useless-regexp (car --cl-var--)) (setq --cl-flag-- (not (string-match-p useless-regexp buf-name)))))
  (while (and (consp --cl-var--) (progn (setq useless-regexp (car --cl-var--)) (setq --cl-flag-- (not (string-match-p useless-regexp buf-name))))) (setq --cl-var-- (cdr --cl-var--)))
  (let* ((--cl-var-- spacemacs-useless-buffers-regexp) (useless-regexp nil) (--cl-flag-- t)) (while (and (consp --cl-var--) (progn (setq useless-regexp (car --cl-var--)) (setq --cl-flag-- (not (string-match-p useless-regexp buf-name))))) (setq --cl-var-- (cdr --cl-var--))) (if --cl-flag-- (progn t) nil))
  (or (provided-mode-derived-p (buffer-local-value 'major-mode buffer) 'comint-mode) (let* ((--cl-var-- spacemacs-useful-buffers-regexp) (useful-regexp nil) (--cl-flag-- t) --cl-var--) (while (and (consp --cl-var--) (progn (setq useful-regexp (car --cl-var--)) (setq --cl-flag-- (not (setq --cl-var-- ...))))) (setq --cl-var-- (cdr --cl-var--))) --cl-var--) (let* ((--cl-var-- spacemacs-useless-buffers-regexp) (useless-regexp nil) (--cl-flag-- t)) (while (and (consp --cl-var--) (progn (setq useless-regexp (car --cl-var--)) (setq --cl-flag-- (not (string-match-p useless-regexp buf-name))))) (setq --cl-var-- (cdr --cl-var--))) (if --cl-flag-- (progn t) nil)))
  (let ((buf-name (buffer-name buffer))) (or (provided-mode-derived-p (buffer-local-value 'major-mode buffer) 'comint-mode) (let* ((--cl-var-- spacemacs-useful-buffers-regexp) (useful-regexp nil) (--cl-flag-- t) --cl-var--) (while (and (consp --cl-var--) (progn (setq useful-regexp (car --cl-var--)) (setq --cl-flag-- (not ...)))) (setq --cl-var-- (cdr --cl-var--))) --cl-var--) (let* ((--cl-var-- spacemacs-useless-buffers-regexp) (useless-regexp nil) (--cl-flag-- t)) (while (and (consp --cl-var--) (progn (setq useless-regexp (car --cl-var--)) (setq --cl-flag-- (not ...)))) (setq --cl-var-- (cdr --cl-var--))) (if --cl-flag-- (progn t) nil))))
  spacemacs/useful-buffer-p(#<buffer rider_now_utils.py>)
  kill-buffer(#<buffer  *temp*-957895>)
  #f(compiled-function () #<bytecode -0x1c1e1505371ddc2b>)()
  python-shell-send-file("a_file_name..." #<process Python> "/var/folders/gx/6fqj2t4x5tn4zml2qp9__9mr00j58f/T/p..." t)
  #f(compiled-function (string &optional process msg) "Send STRING to inferior Python PROCESS.\nWhen optional argument MSG is non-nil, forces display of a\nuser-friendly message if there's no process running; defaults to\nt when called interactively." (interactive #f(compiled-function () #<bytecode 0x14ff04c703dd2bc5>)) #<bytecode -0x168dce9d6e1d8f8e>)("import sys, codecs, os, ast;__pyfile = codecs.open..." #<process Python>)
  apply(#f(compiled-function (string &optional process msg) "Send STRING to inferior Python PROCESS.\nWhen optional argument MSG is non-nil, forces display of a\nuser-friendly message if there's no process running; defaults to\nt when called interactively." (interactive #f(compiled-function () #<bytecode 0x14ff04c703dd2bc5>)) #<bytecode -0x168dce9d6e1d8f8e>) ("import sys, codecs, os, ast;__pyfile = codecs.open..." #<process Python>))
  python-shell-send-string("import sys, codecs, os, ast;__pyfile = codecs.open..." #<process Python>)
  python-shell-send-file("a_file_name..." #<process Python> "/var/folders/gx/6fqj2t4x5tn4zml2qp9__9mr00j58f/T/p..." t)
  #f(compiled-function (string &optional process msg) "Send STRING to inferior Python PROCESS.\nWhen optional argument MSG is non-nil, forces display of a\nuser-friendly message if there's no process running; defaults to\nt when called interactively." (interactive #f(compiled-function () #<bytecode 0x14ff04c703dd2bc5>)) #<bytecode -0x168dce9d6e1d8f8e>)("import sys, codecs, os, ast;__pyfile = codecs.open..." #<process Python>)
  apply(#f(compiled-function (string &optional process msg) "Send STRING to inferior Python PROCESS.\nWhen optional argument MSG is non-nil, forces display of a\nuser-friendly message if there's no process running; defaults to\nt when called interactively." (interactive #f(compiled-function () #<bytecode 0x14ff04c703dd2bc5>)) #<bytecode -0x168dce9d6e1d8f8e>) ("import sys, codecs, os, ast;__pyfile = codecs.open..." #<process Python>))
  python-shell-send-string("import sys, codecs, os, ast;__pyfile = codecs.open..." #<process Python>)
  python-shell-send-file("a_file_name..." #<process Python> "/var/folders/gx/6fqj2t4x5tn4zml2qp9__9mr00j58f/T/p..." t)
  #f(compiled-function (string &optional process msg) "Send STRING to inferior Python PROCESS.\nWhen optional argument MSG is non-nil, forces display of a\nuser-friendly message if there's no process running; defaults to\nt when called interactively." (interactive #f(compiled-function () #<bytecode 0x14ff04c703dd2bc5>)) #<bytecode -0x168dce9d6e1d8f8e>)("import sys, codecs, os, ast;__pyfile = codecs.open..." #<process Python>)
  apply(#f(compiled-function (string &optional process msg) "Send STRING to inferior Python PROCESS.\nWhen optional argument MSG is non-nil, forces display of a\nuser-friendly message if there's no process running; defaults to\nt when called interactively." (interactive #f(compiled-function () #<bytecode 0x14ff04c703dd2bc5>)) #<bytecode -0x168dce9d6e1d8f8e>) ("import sys, codecs, os, ast;__pyfile = codecs.open..." #<process Python>))
  python-shell-send-string("import sys, codecs, os, ast;__pyfile = codecs.open..." #<process Python>)
  python-shell-send-file("a_file_name..." #<process Python> "/var/folders/gx/6fqj2t4x5tn4zml2qp9__9mr00j58f/T/p..." t)
 


On Sun, Sep 19, 2021 at 12:42 PM Augusto Stoffel <arstoffel@gmail.com> wrote:
On Sun, 19 Sep 2021 at 12:28, 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.
>

Are you on the current master?  These two functions used to be
entangled, but now only -send-string calls -send-file.