bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Python mode hang.


From: David Einstein
Subject: Python mode hang.
Date: Thu, 13 Dec 2007 08:39:26 -0800 (PST)
User-agent: G2/1.0

My emacs 22 froze completely on windows XP when attempting to start
and inferior python process.  This there are a few fixes for this
symptom posted here on gnu.bug.emacs, and it apears that the symptom
is also fixed in the latest version in subversion.  However, I
believe, that the underlying problem still exists, and that emacs is
relying on the python sub process being very well behaved.  My
knowledge of both emacs lisp and python are not great, but I suspect
that the function python-send-receive in python.el is suspect.

(defun python-send-receive (string)
  "Send STRING to inferior Python (if any) and return result.
The result is what follows `_emacs_out' in the output."
  (python-send-string string)
  (let ((proc (python-proc)))
    (with-current-buffer (process-buffer proc)
      (set (make-local-variable 'python-preoutput-result) nil)
      (while (progn
               (accept-process-output proc 5)
               (null python-preoutput-result)))
      (prog1 python-preoutput-result
        (kill-local-variable 'python-preoutput-result)))))

The problem here is that if the python subprocess never returns, or
never outputs text containing '_emacs_out', emacs will be stuck in the
loop

(while (progn
               (accept-process-output proc 5)
               (null python-preoutput-result)))

Here python-preoutput-result is updated by python-preoutput-filter to
contain the text after '_emacs_out' and before the next prompt.

My understanding of emacs lisp says that this loop should hang emacs
if the python process never sets python-preoutput-result.  I doubt
that this is the intended behavior.  None of the other inferior modes
seem to be designed this way, but I have not done an exhaustive
search.

Unfortunately, I have no idea of the correct way of approaching this
problem.

              Thank You,
                      Deinst


reply via email to

[Prev in Thread] Current Thread [Next in Thread]