ob-python: Session returns empty string if no return value
* lisp/ob-python.el (org-babel-python--eval-ast): Change sessions to return an empty string, instead of None, if there is no return value.
This commit is contained in:
parent
a85f1603ec
commit
5fc4576548
2 changed files with 8 additions and 6 deletions
12
etc/ORG-NEWS
12
etc/ORG-NEWS
|
@ -12,13 +12,15 @@ Please send Org bug reports to mailto:emacs-orgmode@gnu.org.
|
|||
|
||||
* Version 9.4 (not yet released)
|
||||
** Incompatible changes
|
||||
*** Python session return values must be top-level expression statements
|
||||
*** Change how Python sessions handle return values
|
||||
|
||||
Python blocks with ~:session :results value~ header arguments now only
|
||||
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.
|
||||
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.
|
||||
|
||||
*** In HTML export, change on how outline-container-* is set
|
||||
|
||||
|
|
|
@ -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 = None
|
||||
__org_babel_python_final = ''
|
||||
except Exception:
|
||||
from traceback import format_exc
|
||||
__org_babel_python_final = format_exc()
|
||||
|
|
Loading…
Reference in a new issue