go-python / gpython

gpython is a python interpreter written in go "batteries not included"
BSD 3-Clause "New" or "Revised" License
870 stars 95 forks source link

compile,py: fix closure and decorator #225

Closed wetor closed 10 months ago

wetor commented 10 months ago

After several hours of reading the Python source code, it was found that the closure issue was only caused by the lack of assignment to Code.Cell2arg

The submission still requires some optimization, and I will complete it in the near future. If possible, I would also like to receive some coding suggestions

codecov[bot] commented 10 months ago

Codecov Report

Attention: 18 lines in your changes are missing coverage. Please review.

Comparison is base (7102b79) 74.52% compared to head (515de2a) 74.81%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #225 +/- ## ========================================== + Coverage 74.52% 74.81% +0.29% ========================================== Files 78 78 Lines 12804 12814 +10 ========================================== + Hits 9542 9587 +45 + Misses 2583 2553 -30 + Partials 679 674 -5 ``` | [Files](https://app.codecov.io/gh/go-python/gpython/pull/225?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=go-python) | Coverage Δ | | |---|---|---| | [compile/compile.go](https://app.codecov.io/gh/go-python/gpython/pull/225?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=go-python#diff-Y29tcGlsZS9jb21waWxlLmdv) | `90.64% <100.00%> (+0.06%)` | :arrow_up: | | [py/code.go](https://app.codecov.io/gh/go-python/gpython/pull/225?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=go-python#diff-cHkvY29kZS5nbw==) | `34.88% <28.00%> (+22.97%)` | :arrow_up: | ... and [6 files with indirect coverage changes](https://app.codecov.io/gh/go-python/gpython/pull/225/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=go-python)

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

wetor commented 10 months ago

PTAL, fixed an issue with compiler closures, and added test cases for decorators

wetor commented 10 months ago

please skip the Codecov that did not pass, as this part of the code has not been covered

sbinet commented 10 months ago

(otherwise LGTM, thanks.)