From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id 532D624D02 for ; Thu, 12 Sep 2019 19:24:23 -0400 (EDT) Received: from turing.freelists.org ([127.0.0.1]) by localhost (turing.freelists.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id lmI6jsMNAhhh for ; Thu, 12 Sep 2019 19:24:23 -0400 (EDT) Received: from smtp38.i.mail.ru (smtp38.i.mail.ru [94.100.177.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTPS id 095F124A7A for ; Thu, 12 Sep 2019 19:24:22 -0400 (EDT) Date: Fri, 13 Sep 2019 02:24:06 +0300 From: Alexander Turenko Subject: [tarantool-patches] Re: [PATCH v2 2/4] msgpack: make msgpackffi use encode_max_depth option Message-ID: <20190912232405.qrig7tt5dj7uvf3j@tkn_work_nb> References: <945d59a2cc72f44f66e51c29e14cff5b4acae8c0.1568055477.git.v.shpilevoy@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <945d59a2cc72f44f66e51c29e14cff5b4acae8c0.1568055477.git.v.shpilevoy@tarantool.org> Sender: tarantool-patches-bounce@freelists.org Errors-to: tarantool-patches-bounce@freelists.org Reply-To: tarantool-patches@freelists.org List-Help: List-Unsubscribe: List-software: Ecartis version 1.0.0 List-Id: tarantool-patches List-Subscribe: List-Owner: List-post: List-Archive: To: Vladislav Shpilevoy Cc: tarantool-patches@freelists.org LGTM. One small comment about the test case, see below. WBR, Alexander Turenko. > + -- > + -- gh-4434: msgpackffi does not care about msgpack serializer > + -- configuration, but it should. > + -- > + local function check_depth(depth_to_try) > + local t = nil > + for i = 1, depth_to_try do t = {t} end > + t = s.decode_unchecked(s.encode(t)) > + local level = 0 > + while t ~= nil do level = level + 1 t = t[1] end > + return level > + end > + local msgpack = require('msgpack') > + local max_depth = msgpack.cfg.encode_max_depth > + local result_depth = check_depth(max_depth + 5) > + test:is(result_depth, max_depth, > + "msgpackffi uses msgpack.cfg.encode_max_depth") > + > + msgpack.cfg({encode_max_depth = max_depth + 5}) > + result_depth = check_depth(max_depth + 5) > + test:is(result_depth, max_depth + 5, "and uses it dynamically") > + > + msgpack.cfg({encode_max_depth = max_depth}) Just in case: we recently close an [issue][1] when json module handles max depth correctly for maps, but non-correctly for arrays. I think it worth to ensure that those cases works good both for msgpackffi too. [1]: https://github.com/tarantool/tarantool/issues/4366