Browse Source

Revert "ob-python: Session returns empty string if no return value"

This reverts commit 5fc45765483f80cbfbdb4f07a21588ef3392dccc.
Bastien 5 years ago
parent
commit
fc3f1e6b28
2 changed files with 6 additions and 8 deletions
  1. 5 7
      etc/ORG-NEWS
  2. 1 1
      lisp/ob-python.el

+ 5 - 7
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
 

+ 1 - 1
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()