diff options
author | Bastien <bzg@gnu.org> | 2020-02-17 23:46:49 +0100 |
---|---|---|
committer | Bastien <bzg@gnu.org> | 2020-02-17 23:46:49 +0100 |
commit | fc3f1e6b28d91671eb6457cb14a51179136c24ce (patch) | |
tree | e9aad94294de5ca273770ec57f10ad01b1222b38 | |
parent | b8a2ad9288594af2d1cca6beceafb89e5375956c (diff) | |
download | org-mode-fc3f1e6b28d91671eb6457cb14a51179136c24ce.tar.gz |
Revert "ob-python: Session returns empty string if no return value"
This reverts commit 5fc45765483f80cbfbdb4f07a21588ef3392dccc.
-rw-r--r-- | etc/ORG-NEWS | 12 | ||||
-rw-r--r-- | lisp/ob-python.el | 2 |
2 files changed, 6 insertions, 8 deletions
diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS index 9ef8a07..51392c1 100644 --- a/etc/ORG-NEWS +++ b/etc/ORG-NEWS @@ -12,15 +12,13 @@ Please send Org bug reports to mailto:emacs-orgmode@gnu.org. * Version 9.4 (not yet released) ** Incompatible changes -*** Change how Python sessions handle return values +*** Python session return values must be top-level expression statements Python blocks with ~:session :results value~ header arguments now only -return a value if the last line is a top-level expression -statement. If the last line is not a top-level expression statement, -the block will return a blank (empty) result. - -Also, a return value of ~None~ will now show up under "#+RESULTS:", as -it already did for non-session blocks. +return a value if the last line is a top-level expression statement, +otherwise the result is None. Also, None will now show up under +"#+RESULTS:", as it already did with ~:results value~ for non-session +blocks. *** In HTML export, change on how outline-container-* is set diff --git a/lisp/ob-python.el b/lisp/ob-python.el index b9e36db..de718b0 100644 --- a/lisp/ob-python.el +++ b/lisp/ob-python.el @@ -260,7 +260,7 @@ try: __org_babel_python_final.value), '<string>', 'eval')) else: exec(compile(__org_babel_python_ast, '<string>', 'exec')) - __org_babel_python_final = '' + __org_babel_python_final = None except Exception: from traceback import format_exc __org_babel_python_final = format_exc() |