From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:403:4789::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id kGRbHvox6GTpjgAASxT56A (envelope-from ) for ; Fri, 25 Aug 2023 06:45:46 +0200 Received: from aspmx1.migadu.com ([2001:41d0:403:4789::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id mF5AHvox6GQ+awEAauVa8A (envelope-from ) for ; Fri, 25 Aug 2023 06:45:46 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 052474B670 for ; Fri, 25 Aug 2023 06:45:45 +0200 (CEST) Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=A1pURcaP; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1692938746; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=J1R88SfP98kb8HI4T9f37INWmr/onq5eWTmTpw7IQzI=; b=o2Ajmgju+QJ2sGH1nldKKrUnUeVlr8mUsOGpELIaZ/y51gHhabS1chExWzUOXaRPu3aCLL qgvAVG1Ob0RDRwt8d/UKPekxZ1o0G+fraPkTXg0aqXBqDB/PG+i5FDC9ZkB1sDNhUjKaVR EmGbQA80x3RP9Rghu7gk1BNppeBlTghCqd32pxTDFft5TkkC/HSCohqsxtkO232XEOCJH4 S9duYrWTpN46xGtOXBjOrIbB5qXviaxJFWyu+xOBszX9IEZ3GKt6JZh9un7yeuG+DdFgxu kqWvD3sGfU9e3TXgd3ZPt9AMtw9KIN9zOtevANIenkdjXWlFwWmPNpckkvC4+Q== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1692938746; a=rsa-sha256; cv=none; b=sYtNc7/7OO9TMfd1neZWSGDLYwYGEXKO/uwNv5PDbldI1BYXdK+AjtZhK/BFy3JfcW6it3 KNr5VOgjqB0cSWQ6l+XdOeABGcwmDYQRtRdVUkKFnye2kOdirZqzXpuuzqke38M70e/juk Ud20Ni8lGKsOyHOHMcIWTWCJg7gZxpaxdudT7D4ZUftA89rs7aCJdOYDg1n2vtImV2ZEmh HboUCRdUhTWm0gWcopDIYIYUqFFbbKJbl1UfExfRRDs/ND8DlT/YfnWWbae4hdoNP+DxL6 0ezlaNQ8Lhyv05FDglZ7qfaR//19nCIv7RIWHbrcQfy8d48LQPmsIaO7lSywrA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=A1pURcaP; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=gmail.com Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qZOga-0004ZX-7G; Fri, 25 Aug 2023 00:44:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qZOgU-0004ZJ-OZ for emacs-orgmode@gnu.org; Fri, 25 Aug 2023 00:44:34 -0400 Received: from mail-lf1-x136.google.com ([2a00:1450:4864:20::136]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qZOgR-0000ET-DJ for emacs-orgmode@gnu.org; Fri, 25 Aug 2023 00:44:33 -0400 Received: by mail-lf1-x136.google.com with SMTP id 2adb3069b0e04-4ff8a1746e0so753731e87.0 for ; Thu, 24 Aug 2023 21:44:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1692938667; x=1693543467; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=J1R88SfP98kb8HI4T9f37INWmr/onq5eWTmTpw7IQzI=; b=A1pURcaPij9k4cUyOd2BZhmQdm2zRgL8Hzu59u2SciFCCD+flPVScuRCDRBYDoWsy/ VHt4TVb02e146btP7yv5FbZxUzPBg7g2ARMdSx5gxYLR/Plv/Zmp9+VvMXOCwawzgkPB hLvKicAnH0p8x5S2MSIPj9a/1WpjSiAhqs6YXmpdpkbpIcBR3oU1ouzp0/413790XMmg 6PTcuxGaEW3VkYUhcfy3oHX3K1igBU+xa/6O1kg7tHH7MAxkTtXUpmiNWsi/N3YZVfM2 8buL/O/j/amq+/4tzPkATDgZZpiyTMAy9wAlOQ0qYymhum0nK9dJWAAcGIQ1a8iB5+nI UT3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692938667; x=1693543467; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=J1R88SfP98kb8HI4T9f37INWmr/onq5eWTmTpw7IQzI=; b=PXO6kJIUgydq5boakQ6oMw1IsCYLMuaz9sDeotqn0OZPX4oa2e/1pqP0ZY4m4SDySV LCfdUnCvglKk2c0+C8wBpSnvL+62o6WcOH9mIZ+VmDFbZwr/JCtd+MlYnGDYhGiE7Ii3 BxiDFAjxYAzWeN9gGRpfoT56ZDDbsHhz5OClED5jNHOu0p/xBOwTWt/eHtDdYt+jxBTx +XKOhkBUPt0qhXeEF2g08DWi2CYS5OXa90c6vhYl3HiWInaz7IxoZ0EQqEEy/FyhgKmX l2lwF5/d5snC3qQfnZpym+BJ4k4YSCXt/+Vw2aHChLPwiNe/DvrBZnXFVoucDFcoGs/4 nlMw== X-Gm-Message-State: AOJu0YyROM5CHBzz5EujSA9GKwuf5Rcq5dQ9FWLB6EShtYW74SD+8yGk r435xZMuxS2P1QsGqFm1/zKe3iFhmIW9KkCEmoEfjbzrcX4= X-Google-Smtp-Source: AGHT+IGIoq8TgqW3nK795Bx523lPkr2o11pVE3P6pC7IyFRfNHyc5rCah5EMdzlwQZg29MG7Ff30YZZPvhOhK1aB50Y= X-Received: by 2002:a05:6512:689:b0:4fb:9631:4bb with SMTP id t9-20020a056512068900b004fb963104bbmr15704399lfe.11.1692938667299; Thu, 24 Aug 2023 21:44:27 -0700 (PDT) MIME-Version: 1.0 From: Peter Mao Date: Thu, 24 Aug 2023 21:44:16 -0700 Message-ID: Subject: [BUG] ob-python hangs on second start [9.5.4 (release_9.5.4-763-g06373a @ ~/emacs/org-mode/lisp/)] To: org-mode-email Content-Type: multipart/alternative; boundary="000000000000e417c10603b7ffc4" Received-SPF: pass client-ip=2a00:1450:4864:20::136; envelope-from=peter.mao@gmail.com; helo=mail-lf1-x136.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: emacs-orgmode-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Spam-Score: -9.58 X-Spam-Score: -9.58 X-Migadu-Queue-Id: 052474B670 X-Migadu-Scanner: mx1.migadu.com X-TUID: jYMy1nea2h0A --000000000000e417c10603b7ffc4 Content-Type: text/plain; charset="UTF-8" Expectation: When running ob-python code blocks, I should be able to kill the python session in the *Python* buffer and run another code block (or the same one). Problem: ob-python works fine on the first execution, but after `exit()`ing the python session, it hangs without executing the code. After a `C-g`, the prompt in the *Python* session shows up, but one then has to re-execute the code block, as none of it has run. The following three code blocks demonstrate the problem. I have bisected the problem, finding 06373a64 as the first bad commit. I tried to reproduce the problem on Emacs 28.2, but this commit of Org won't compile on Emacs 28.2 for me. #+begin_src elisp :results none (org-babel-do-load-languages 'org-babel-load-languages '((python . t))) (setq-local org-confirm-babel-evaluate nil) #+end_src #+begin_src python :results output print("Running first, this one issues a warning but competes successfully.") exit() #+end_src #+begin_src python :results output print("Running second, this one hangs until user enters C-g.") print("None of the code executes.") exit() #+end_src Emacs : GNU Emacs 29.1 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.33, cairo version 1.16.0) of 2023-07-31 Package: Org mode version 9.5.4 (release_9.5.4-763-g06373a @ /home/peterm/emacs/org-mode/lisp/) current state: ============== (setq org-link-elisp-confirm-function 'yes-or-no-p org-bibtex-headline-format-function #[257 "\300 \236A\207" [:title] 3 "\n\n(fn ENTRY)"] org-persist-after-read-hook '(org-element--cache-persist-after-read) org-export-before-parsing-hook '(org-attach-expand-links) org-cycle-tab-first-hook '(org-babel-hide-result-toggle-maybe org-babel-header-arg-expand) org-archive-hook '(org-attach-archive-delete-maybe) org-cycle-hook '(org-cycle-hide-archived-subtrees org-cycle-show-empty-lines org-cycle-optimize-window-after-visibility-change) org-persist-before-read-hook '(org-element--cache-persist-before-read) org-mode-hook '(#[0 "\300\301\302\303\304$\207" [add-hook change-major-mode-hook org-fold-show-all append local] 5] #[0 "\300\301\302\303\304$\207" [add-hook change-major-mode-hook org-babel-show-result-all append local] 5] org-babel-result-hide-spec org-babel-hide-all-hashes) org-babel-load-languages '((python . t)) org-confirm-shell-link-function 'yes-or-no-p outline-isearch-open-invisible-function 'outline-isearch-open-invisible org-agenda-before-write-hook '(org-agenda-add-entry-text) org-babel-tangle-lang-exts '(("python" . "py") ("emacs-lisp" . "el") ("elisp" . "el")) org-src-mode-hook '(org-src-babel-configure-edit-buffer org-src-mode-configure-edit-buffer) org-confirm-elisp-link-function 'yes-or-no-p org-speed-command-hook '(org-speed-command-activate org-babel-speed-command-activate) org-fold-core-isearch-open-function 'org-fold--isearch-reveal org-persist-before-write-hook '(org-element--cache-persist-before-write) org-tab-first-hook '(org-babel-hide-result-toggle-maybe org-babel-header-arg-expand) org-link-shell-confirm-function 'yes-or-no-p org-babel-pre-tangle-hook '(save-buffer) org-agenda-loop-over-headlines-in-active-region nil org-occur-hook '(org-first-headline-recenter) org-metadown-hook '(org-babel-pop-to-session-maybe) org-link-parameters '(("attachment" :follow org-attach-follow :complete org-attach-complete-link) ("id" :follow org-id-open) ("eww" :follow org-eww-open :store org-eww-store-link) ("rmail" :follow org-rmail-open :store org-rmail-store-link) ("mhe" :follow org-mhe-open :store org-mhe-store-link) ("irc" :follow org-irc-visit :store org-irc-store-link :export org-irc-export) ("info" :follow org-info-open :export org-info-export :store org-info-store-link :insert-description org-info-description-as-command) ("gnus" :follow org-gnus-open :store org-gnus-store-link) ("docview" :follow org-docview-open :export org-docview-export :store org-docview-store-link) ("bibtex" :follow org-bibtex-open :store org-bibtex-store-link) ("bbdb" :follow org-bbdb-open :export org-bbdb-export :complete org-bbdb-complete-link :store org-bbdb-store-link) ("w3m" :store org-w3m-store-link) ("doi" :follow org-link-doi-open :export org-link-doi-export) ("file+sys") ("file+emacs") ("shell" :follow org-link--open-shell) ("news" :follow #[514 "\301\300\302 Q \"\207" ["news" browse-url ":"] 6 "\n\n(fn URL ARG)"] ) ("mailto" :follow #[514 "\301\300\302 Q \"\207" ["mailto" browse-url ":"] 6 "\n\n(fn URL ARG)"] ) ("https" :follow #[514 "\301\300\302 Q \"\207" ["https" browse-url ":"] 6 "\n\n(fn URL ARG)"] ) ("http" :follow #[514 "\301\300\302 Q \"\207" ["http" browse-url ":"] 6 "\n\n(fn URL ARG)"] ) ("ftp" :follow #[514 "\301\300\302 Q \"\207" ["ftp" browse-url ":"] 6 "\n\n(fn URL ARG)"] ) ("help" :follow org-link--open-help :store org-link--store-help) ("file" :complete org-link-complete-file) ("elisp" :follow org-link--open-elisp)) org-metaup-hook '(org-babel-load-in-session-maybe) ) --000000000000e417c10603b7ffc4 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Expectation: =C2=A0When running ob-python code blocks, I s= hould be able to
kill the python session in the *Python* buffer and run = another code
block (or the same one).

Problem: =C2=A0ob-python wo= rks fine on the first execution, but after
`exit()`ing the python sessio= n, it hangs without executing the code.
After a `C-g`, the prompt in the= *Python* session shows up, but one then
has to re-execute the code bloc= k, as none of it has run.

The following three code blocks demonstrat= e the problem.=C2=A0 I have
bisected the problem, finding 06373a64 as th= e first bad commit.=C2=A0 I tried
to reproduce the problem on Emacs 28.2= , but this commit of Org won't
compile on Emacs 28.2 for me.

= #+begin_src elisp :results none
=C2=A0 (org-babel-do-load-languages '= ;org-babel-load-languages '((python . t)))
=C2=A0 (setq-local org-co= nfirm-babel-evaluate nil)
#+end_src

#+begin_src python :results o= utput
=C2=A0 print("Running first, this one issues a warning but co= mpetes successfully.")
=C2=A0 exit()
#+end_src

#+begin_sr= c python :results output
=C2=A0 print("Running second, this one han= gs until user enters C-g.")
=C2=A0 print("None of the code exe= cutes.")
=C2=A0 exit()
#+end_src



Emacs =C2=A0: GN= U Emacs 29.1 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.33, cairo ver= sion 1.16.0)
=C2=A0of 2023-07-31
Package: Org mode version 9.5.4 (rel= ease_9.5.4-763-g06373a @ /home/peterm/emacs/org-mode/lisp/)

current = state:
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
(setq
=C2=A0org-= link-elisp-confirm-function 'yes-or-no-p
=C2=A0org-bibtex-headline-f= ormat-function #[257 "\300 \236A\207" [:title] 3 "\n\n(fn EN= TRY)"]
=C2=A0org-persist-after-read-hook '(org-element--cache-p= ersist-after-read)
=C2=A0org-export-before-parsing-hook '(org-attach= -expand-links)
=C2=A0org-cycle-tab-first-hook '(org-babel-hide-resul= t-toggle-maybe
=C2=A0 =C2=A0org-babel-header-arg-expand)
=C2=A0or= g-archive-hook '(org-attach-archive-delete-maybe)
=C2=A0org-cycle-ho= ok '(org-cycle-hide-archived-subtrees org-cycle-show-empty-lines
= =C2=A0org-cycle-optimize-window-after-visibility-change)
=C2=A0org-persi= st-before-read-hook '(org-element--cache-persist-before-read)
=C2=A0= org-mode-hook '(#[0 "\300\301\302\303\304$\207"
=C2=A0 = [add-hook change-major-mode-hook org-fold-show-all append
=C2=A0 =C2= =A0local]
=C2=A0 5]
#[0 "\300\301\302\303\304$\207" =C2=A0 [add-hook change-major-mode-hook org-babel-show-result-all
= =C2=A0 =C2=A0append local]
=C2=A0 5]
org-babel-result-hide-sp= ec org-babel-hide-all-hashes)
=C2=A0org-babel-load-languages '((pyth= on . t))
=C2=A0org-confirm-shell-link-function 'yes-or-no-p
=C2= =A0outline-isearch-open-invisible-function 'outline-isearch-open-invisi= ble
=C2=A0org-agenda-before-write-hook '(org-agenda-add-entry-text)<= br>=C2=A0org-babel-tangle-lang-exts '(("python" . "py&qu= ot;) ("emacs-lisp" . "el")
=C2=A0 =C2=A0 =C2=A0(= "elisp" . "el"))
=C2=A0org-src-mode-hook '(org-s= rc-babel-configure-edit-buffer
=C2=A0 =C2=A0 org-src-mode-configure-e= dit-buffer)
=C2=A0org-confirm-elisp-link-function 'yes-or-no-p
= =C2=A0org-speed-command-hook '(org-speed-command-activate
=C2=A0= org-babel-speed-command-activate)
=C2=A0org-fold-core-isearch-open-funct= ion 'org-fold--isearch-reveal
=C2=A0org-persist-before-write-hook &#= 39;(org-element--cache-persist-before-write)
=C2=A0org-tab-first-hook &#= 39;(org-babel-hide-result-toggle-maybe
=C2=A0 =C2=A0 =C2=A0org-babel-= header-arg-expand)
=C2=A0org-link-shell-confirm-function 'yes-or-no-= p
=C2=A0org-babel-pre-tangle-hook '(save-buffer)
=C2=A0org-agenda= -loop-over-headlines-in-active-region nil
=C2=A0org-occur-hook '(org= -first-headline-recenter)
=C2=A0org-metadown-hook '(org-babel-pop-to= -session-maybe)
=C2=A0org-link-parameters '(("attachment" = :follow org-attach-follow :complete
org-attach-complete-link)
= =C2=A0 =C2=A0 =C2=A0 ("id" :follow org-id-open)
=C2=A0 =C2= =A0 =C2=A0 ("eww" :follow org-eww-open :store org-eww-store-link)=
=C2=A0 =C2=A0 =C2=A0 ("rmail" :follow org-rmail-open :stor= e
org-rmail-store-link)
=C2=A0 =C2=A0 =C2=A0 ("mhe" := follow org-mhe-open :store org-mhe-store-link)
=C2=A0 =C2=A0 =C2=A0 (= "irc" :follow org-irc-visit :store org-irc-store-link
:expo= rt org-irc-export)
=C2=A0 =C2=A0 =C2=A0 ("info" :follow org= -info-open :export org-info-export
:store org-info-store-link :insert= -description
org-info-description-as-command)
=C2=A0 =C2=A0 =C2= =A0 ("gnus" :follow org-gnus-open :store
org-gnus-store-lin= k)
=C2=A0 =C2=A0 =C2=A0 ("docview" :follow org-docview-open= :export
org-docview-export :store org-docview-store-link)
=C2= =A0 =C2=A0 =C2=A0 ("bibtex" :follow org-bibtex-open :store
= org-bibtex-store-link)
=C2=A0 =C2=A0 =C2=A0 ("bbdb" :follow= org-bbdb-open :export org-bbdb-export
:complete org-bbdb-complete-li= nk :store
org-bbdb-store-link)
=C2=A0 =C2=A0 =C2=A0 ("w3m&= quot; :store org-w3m-store-link)
=C2=A0 =C2=A0 =C2=A0 ("doi"= ; :follow org-link-doi-open :export
org-link-doi-export)
=C2=A0= =C2=A0 =C2=A0 ("file+sys") ("file+emacs")
=C2=A0= =C2=A0 =C2=A0 ("shell" :follow org-link--open-shell)
=C2= =A0 =C2=A0 =C2=A0 ("news" :follow
#[514 "\301\300\302 = Q \"\207"
=C2=A0["news" browse-url ":"= ] 6 "\n\n(fn URL ARG)"]
)
=C2=A0 =C2=A0 =C2=A0 ("= ;mailto" :follow
#[514 "\301\300\302 Q \"\207" =C2=A0["mailto" browse-url ":"] 6 "\n\n(fn UR= L ARG)"]
)
=C2=A0 =C2=A0 =C2=A0 ("https" :follow=
#[514 "\301\300\302 Q \"\207"
=C2=A0["htt= ps" browse-url ":"] 6 "\n\n(fn URL ARG)"]
)<= br> =C2=A0 =C2=A0 =C2=A0 ("http" :follow
#[514 "\301= \300\302 Q \"\207"
=C2=A0["http" browse-url &quo= t;:"] 6 "\n\n(fn URL ARG)"]
)
=C2=A0 =C2=A0 =C2= =A0 ("ftp" :follow
#[514 "\301\300\302 Q \"\207&q= uot; ["ftp" browse-url ":"]
=C2=A06 "\n\n(f= n URL ARG)"]
)
=C2=A0 =C2=A0 =C2=A0 ("help" :fol= low org-link--open-help :store
org-link--store-help)
=C2=A0 =C2= =A0 =C2=A0 ("file" :complete org-link-complete-file)
=C2=A0= =C2=A0 =C2=A0 ("elisp" :follow org-link--open-elisp))
=C2=A0o= rg-metaup-hook '(org-babel-load-in-session-maybe)
=C2=A0)
--000000000000e417c10603b7ffc4--