all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Python mode hang.
@ 2007-12-13 16:39 David Einstein
  0 siblings, 0 replies; only message in thread
From: David Einstein @ 2007-12-13 16:39 UTC (permalink / raw)
  To: bug-gnu-emacs

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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2007-12-13 16:39 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-12-13 16:39 Python mode hang David Einstein

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.