emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [BUG] org-babel-script-escape mishandled empty python list
@ 2022-10-12 10:43 Jonas Bernoulli
  2022-10-12 11:49 ` Ihor Radchenko
  0 siblings, 1 reply; 2+ messages in thread
From: Jonas Bernoulli @ 2022-10-12 10:43 UTC (permalink / raw)
  To: emacs-orgmode


`org-babel-script-escape' doesn't handle an empty python list
correctly; ['a'] => ("a") but [] => [].

#+name: addheader
#+header: :var rows=""
#+begin_src python
  return []
#+end_src

#+header: :post addheader(*this*)
#+begin_src emacs-lisp :results table
  nil
#+end_src
#+RESULTS:
: []

An empty python list is turned into an empty lisp vector instead of
an empty lisp list.  At least for python, (> (length str) 2) should
probably be changed to use >=.


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [BUG] org-babel-script-escape mishandled empty python list
  2022-10-12 10:43 [BUG] org-babel-script-escape mishandled empty python list Jonas Bernoulli
@ 2022-10-12 11:49 ` Ihor Radchenko
  0 siblings, 0 replies; 2+ messages in thread
From: Ihor Radchenko @ 2022-10-12 11:49 UTC (permalink / raw)
  To: Jonas Bernoulli; +Cc: emacs-orgmode

Jonas Bernoulli <jonas@bernoul.li> writes:

> `org-babel-script-escape' doesn't handle an empty python list
> correctly; ['a'] => ("a") but [] => [].
>
> #+name: addheader
> #+header: :var rows=""
> #+begin_src python
>   return []
> #+end_src
>
> #+header: :post addheader(*this*)
> #+begin_src emacs-lisp :results table
>   nil
> #+end_src
> #+RESULTS:
> : []
>
> An empty python list is turned into an empty lisp vector instead of
> an empty lisp list.  At least for python, (> (length str) 2) should
> probably be changed to use >=.

Thanks a lot! A reproducer helps a ton.
Fixed on main.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=4c0641837c8570dd8ad7f18c2482411bdc0cda16

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-10-12 11:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-12 10:43 [BUG] org-babel-script-escape mishandled empty python list Jonas Bernoulli
2022-10-12 11:49 ` Ihor Radchenko

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).