From: Igor Munkin via Tarantool-patches <tarantool-patches@dev.tarantool.org> To: Sergey Kaplun <skaplun@tarantool.org> Cc: tarantool-patches@dev.tarantool.org Subject: Re: [Tarantool-patches] [PATCH luajit] Add stricter check for print() vs. tostring() shortcut. Date: Thu, 30 Jun 2022 15:09:38 +0300 [thread overview] Message-ID: <Yr2Sgm+rKyb2Gj+i@tarantool.org> (raw) In-Reply-To: <20211227102524.9410-1-skaplun@tarantool.org> Sergey, I've checked the patch into all long-term branches in tarantool/luajit and bumped a new version in master, 2.10 and 1.10. On 27.12.21, Sergey Kaplun wrote: > From: Mike Pall <mike> > > (cherry picked from 46a1b268eb0534182eda0447303c344a071632fe) > > `print()` function uses tostring to convert all incoming values to the > strings. So, if element to convert has `__tostring` metamethod it must > be used. In LuaJIT `print()` base library function has a shortcut to > detect fast path for strings and numbers. This shortcut doesn't check > metatable presence for numbers, so `__tostring` metamethod is ignored. > > This patch adds the corresponding check for metatable on base number > type, when the aforementioned shortcut is set. > > Sergey Kaplun: > * added the description and the test for the problem > > Part of tarantool/tarantool#6548 > --- > > Issue: https://github.com/tarantool/tarantool/issues/6548 > Related issue: https://github.com/tarantool/tarantool/issues/6746 > > Branch: https://github.com/tarantool/luajit/tree/skaplun/gh-noticket-print-tostring-number-mt-full-ci > Tarantool branch: https://github.com/tarantool/tarantool/tree/skaplun/gh-noticket-print-tostring-number-mt-full-ci > > CI is red due to integration tests failes (same as on master) or due to > connection errors. > > src/lib_base.c | 3 +- > .../print-tostring-number.test.lua | 45 +++++++++++++++++++ > 2 files changed, 47 insertions(+), 1 deletion(-) > create mode 100644 test/tarantool-tests/print-tostring-number.test.lua > <snipped> > -- > 2.34.1 > -- Best regards, IM
prev parent reply other threads:[~2022-06-30 12:16 UTC|newest] Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-12-27 10:25 Sergey Kaplun via Tarantool-patches 2022-06-06 15:54 ` sergos via Tarantool-patches 2022-06-15 7:00 ` Sergey Kaplun via Tarantool-patches 2022-06-23 16:19 ` Igor Munkin via Tarantool-patches 2022-06-30 12:09 ` Igor Munkin via Tarantool-patches [this message]
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=Yr2Sgm+rKyb2Gj+i@tarantool.org \ --to=tarantool-patches@dev.tarantool.org \ --cc=imun@tarantool.org \ --cc=skaplun@tarantool.org \ --subject='Re: [Tarantool-patches] [PATCH luajit] Add stricter check for print() vs. tostring() shortcut.' \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox