bytecodealliance / bytecodealliance/componentize-py

Allow dynamic imports in sandbox example

オープン
#91 コメント 10 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
Rust
スター
277
フォーク
51
平均マージ
12時間 10分
マージ済み PR(30日)
10

説明

I'd like to execute code using the sandbox example, but am running into an issue. I want to allow exec'd code to import packages, but if I don't import packages in the host script, the guest code won't run.

```python
# Guest code
import json

print(json.dumps({"message": "Hello"}))
```

```python
# Works
import sys
import json

from command import exports

class Run(exports.Run):
def run(self):
with open(sys.argv[1]) as f:
code = f.read()
exec(code)
```

```python
# Fails
import sys

from command import exports

class Run(exports.Run):
def run(self):
with open(sys.argv[1]) as f:
code = f.read()
exec(code)
```

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

Start at the sandbox example's Run.run entry point, especially where it reads the guest code and calls exec. Run the shown guest program with and without the host-side json import, then trace the import behavior. Done means guest code can dynamically import json without requiring the host script to import it first.

索引モデルが issue の本文から書いたものです。

評価

技術スタック
python
領域
security
issue の種類
機能追加
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。