messagepack.decode example uses an undefined bytes variable
まだ誰も着手していません。
評価
- 難易度
- 1/5
- 見積もり時間
- 1時間未満
- 初心者へのやさしさ
- 88/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- lua
調査の方向性
messagepack/api/messagepack.script_api にある messagepack.decode の3つ目の例を読み、バイト列 d4 00 00 を使うデコードテストと比較してください。不足しているバイト列の定義と提案されたアサーションを追加し、Script API のチェックと該当するデコードテストを実行してください。定義済みの入力で例が実行され、デコードされた値を検証できれば完了です。
索引モデルが issue の本文から書いたものです。
説明
The third example for messagepack.decode in messagepack/api/messagepack.script_api passes bytes to decode, but never defines it. Copied as is, decode gets nil and fails with an argument error.
This is the example right now:
-- msgpackr (JavaScript) writes undefined as extension type 0
local UNDEFINED = setmetatable({}, {
__tostring = function() return "undefined" end
})
local options = {ext = {[0] = function() return UNDEFINED end}}
local value = messagepack.decode(bytes, options)
The decode tests already use the bytes msgpackr writes for undefined (d4 00 00, fixext 1 with type 0), so the example could build them the same way. Something like this:
-- msgpackr (JavaScript) writes undefined as extension type 0
local bytes = string.char(0xd4, 0x00, 0x00)
local UNDEFINED = setmetatable({}, {
__tostring = function() return "undefined" end
})
local options = {ext = {[0] = function() return UNDEFINED end}}
local value = messagepack.decode(bytes, options)
assert(value == UNDEFINED)
The only changes are the local bytes line and the assert at the end.
The script API test only loads each example with --check-lua, so it passes even though the snippet can't run on its own.
- 主要言語
- C++
- スター
- 6
- フォーク
- 1
- 平均マージ
- 13日 6時間
- マージ済み PR(30日)
- 1
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
メンテナーはふだん 1 日以内に返信
-
? - Needs Triage bot_watch bug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
NVIDIA/cudf-spark-jni#5594 ·
メンテナーはふだん 1 日以内に返信
-
Branch-master
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
TrinityCore/TrinityCore#32177 ·
メンテナーはふだん 10 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 82/100
mw00/project-maya#1499 ·
メンテナーはふだん 2 日以内に返信
-
bug
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
メンテナーはふだん 1 日以内に返信