bbcmicrobit / bbcmicrobit/PythonEditor

Blocks: "change <variable> by" block causes import error

未關閉
#45 2 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
bug
主要語言
JavaScript
星號
201
分支
126
PR 合併指標
30 天內沒有已合併 PR

描述

The 'change variable by' block causes the following import statement to be emitted:
```from numbers import Number```

Which in turn causes an ImportError on the device.

It also generates rather confusing code:
```
count = (count if isinstance(count, Number) else 0) + -1
```

See the following program as an example of failure:
![image](https://cloud.githubusercontent.com/assets/147113/24100039/2f15c360-0d6a-11e7-817b-1b5885706e2f.png)

貢獻指南

開啟貢獻指南

研究方向

在編輯器中重現連結的範例,並檢查產生的 Python 中的 import 和變數變更運算式。追蹤該程式區塊的程式碼產生路徑;當範例能在裝置上成功匯入,且產生的程式碼不再產生報告中令人困惑的運算式時,該 issue 就完成了。

由索引模型根據 Issue 內容生成。

評估

技術堆疊
javascript, python
領域
embedded-iot, tooling
Issue 類型
缺陷
難度
3/5
預估耗時
1-2 天
活躍度
停滯
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。