From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id mKjIKDmqRmMQBQAAbAwnHQ (envelope-from ) for ; Wed, 12 Oct 2022 13:51:21 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id kBPuJzmqRmNXHwAAG6o9tA (envelope-from ) for ; Wed, 12 Oct 2022 13:51:21 +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 3E16F6A1D for ; Wed, 12 Oct 2022 13:51:21 +0200 (CEST) Received: from localhost ([::1]:55982 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oiaGe-0006CN-BF for larch@yhetil.org; Wed, 12 Oct 2022 07:51:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36120) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oiaEV-0006By-Hg for emacs-orgmode@gnu.org; Wed, 12 Oct 2022 07:49:07 -0400 Received: from mail-pg1-x533.google.com ([2607:f8b0:4864:20::533]:44687) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oiaET-0002AN-TI for emacs-orgmode@gnu.org; Wed, 12 Oct 2022 07:49:07 -0400 Received: by mail-pg1-x533.google.com with SMTP id q1so6992839pgl.11 for ; Wed, 12 Oct 2022 04:49:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:from:to:cc:subject:date:message-id:reply-to; bh=jRlIINM2tf/zJA2gOIS5IH1VwuV+KbGF13KWN50I13g=; b=U1MX5fpfXCFy5Lj4YmL2wYbtv1iyAKFxS2TYAMxtQ8rtKBexKTp6F8kgiDA+7OvDdZ nadpjgFGZUdp1SbEoAtDiHqZZv/FLLOK1G8R964lsxRUcqAbAcF3dxcKGdcwcULnvmGt i6IeWwNHYpdvpG/PZRfvjCbYjnod6s5Sd0OmbbdGLDlYP44MQi8aIlZJDhaCgy4wVXoB I2pV4E9warX+T6ozey8lwmU7sP3Dzx0cOiquhLS/SX4kZ2ZRu8Pb0j8S+VYPxYHBg90f JJOYdDrq0C/rpNPSIYUtqiA0H3VhS2CYMa9O2N7RAYgeb/eK6V7jCtbpPQx5ad/4cnE2 QSBA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=jRlIINM2tf/zJA2gOIS5IH1VwuV+KbGF13KWN50I13g=; b=dlebT5INLns6xChIaab+ukD2WTIBtgVWkRYwls8Y48Jtzkwi/Nk1GWSpkKNsEhEW+m JrbWEbpqEuNONcIGzkOttYvNxWDKp8WWTMbxH2Ial6Tna+E6LSKqjW6k1U5XurNxl/ZL 0CpWIBw/8dxut48xdO2c06uyRXlARo6eXjnSDMGE29QcWu/r9MVgUz4WugSEdwMKQeMI DfU2y2tHS3u8wUVWG58w3kBbtHJTTdDcKsJw1uxMouWglQzAD5jByBIRiKebb6/seCgH Ke9h0XwNs3T2m0EafYdPAtnxFbM5M7lQ5PbnKAuP7gKin7fbG0ALZukVLNvCo/x2wjq1 xSHA== X-Gm-Message-State: ACrzQf37xNWYbf+/7piJ5YJ5Y4BGHaXoeTMZcQ1JVhVDgEU2XpMCdpSi eYWg6zx18Nq5EOXwtCsReIf1I/wYE9jOnzYJsbtVxQ== X-Google-Smtp-Source: AMsMyM7QwN7FjekNuEuHIjHubi46XcYMxwZ0xLCNWVPTB6yzws3pMCchp1dC8y6DRyjBU31oBazXKA== X-Received: by 2002:a63:f349:0:b0:43a:b82b:1173 with SMTP id t9-20020a63f349000000b0043ab82b1173mr25775419pgj.534.1665575344402; Wed, 12 Oct 2022 04:49:04 -0700 (PDT) Received: from localhost ([2409:8970:af2:32f:6c23:3ad5:f37d:541b]) by smtp.gmail.com with ESMTPSA id x9-20020a17090a164900b0020af33363d3sm1289337pje.19.2022.10.12.04.49.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Oct 2022 04:49:03 -0700 (PDT) From: Ihor Radchenko To: Jonas Bernoulli Cc: emacs-orgmode@gnu.org Subject: Re: [BUG] org-babel-script-escape mishandled empty python list In-Reply-To: <87v8opfhk1.fsf@bernoul.li> References: <87v8opfhk1.fsf@bernoul.li> Date: Wed, 12 Oct 2022 19:49:52 +0800 Message-ID: <878rllw9b3.fsf@localhost> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=2607:f8b0:4864:20::533; envelope-from=yantar92@gmail.com; helo=mail-pg1-x533.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 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_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=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" X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1665575481; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=jRlIINM2tf/zJA2gOIS5IH1VwuV+KbGF13KWN50I13g=; b=Nxvn8LlMp3A/yVlSgqEhQOen0PRe3em5icUBzBZ1jJZGIlWZRCYLTz2ci4Vb1KAGQb3EoY Ps/ei8d3IVa0JzjcHb5bHXqfNbdblXqwNWi0bpICu6/AlTjwPoiaUUUGBtW11Y370X4PvD bPpBMWK6TvHEHz+mJMvQZCGzS3Rl16omhU4CE7YaBzp2+AairVSFj8/5xBIObxZ1w39vaJ AzAOcvB5T8V+dzCktn4GsIoDVUUrEIZg46kg3plQqi+lAUms81Mqa02bwOj/Z+N4ypf4LN +GM1fFGN8ny3W/CrAA6WpCHK2OipL+crrOze45clgyaYfm5kzPbH81bW/zP17A== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1665575481; a=rsa-sha256; cv=none; b=bA/VOBtGvQ/i7TmbW/9CdLn4wrAQr97tagCHACMTz6X0+lKSk8d5ARe6tn99ds1brQ/3s9 mltiEbEYwFlbBmTXpYGYE6iOv9JeAHjAafspY1cGDSfNQhv/0g7nH23BaOb8AzESsUUdfN TCmkHsoT+C+lo4iNnJPJ1Wxthdyz0DsSEeHUY/ESD+4ol/FwESN7dzzUx3MO2e2YQbmI3M sDwsWD/ZfegIKoYmGqvTYJWjw58vsgPSeAh+RPhoF6smW0aIf6/Gr4hx0Zrdhf/i8BK6xk RBpSuCfMs403es2LK7OYfsaZLKYc2026DCA5CXZbRKjaALli0KObUwkZ09g5wA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=U1MX5fpf; dmarc=pass (policy=none) header.from=gmail.com; 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" X-Migadu-Spam-Score: -4.90 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=U1MX5fpf; dmarc=pass (policy=none) header.from=gmail.com; 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" X-Migadu-Queue-Id: 3E16F6A1D X-Spam-Score: -4.90 X-Migadu-Scanner: scn0.migadu.com X-TUID: p1SMF+WekzsO Jonas Bernoulli 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 . Support Org development at , or support my work at