go-python / gpython

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

Add py.Context #155

Closed drew-512 closed 2 years ago

drew-512 commented 2 years ago

Hi @sbinet

So this PR has all the py.Context stuff wrapped into it minus:

On the sync.CloseSync issue you raised in the prev thread, the intention is to ensure that multiple holders of a py.Context can all call Close() without any (future) consequences. IMO, this is congruent with multiple holders of a py.Context (and how it's annoying when ya have to ensure that only one Close() is called). People see that close code and they can feel comforted it's an interface ready for the real world. And it basically comes at no cost or allocations.

Otherwise, lmk what you'd like to add/remove to this, otherwise I'll wait for this merge and then I'll immediately submit a PR with the above rolled into a final PR.

codecov[bot] commented 2 years ago

Codecov Report

Merging #155 (02a8b37) into master (3068cb5) will decrease coverage by 0.92%. The diff coverage is 50.30%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #155      +/-   ##
==========================================
- Coverage   74.55%   73.63%   -0.93%     
==========================================
  Files          64       67       +3     
  Lines       11187    11511     +324     
==========================================
+ Hits         8341     8476     +135     
- Misses       2297     2468     +171     
- Partials      549      567      +18     
Impacted Files Coverage Δ
py/int.go 77.13% <0.00%> (+0.26%) :arrow_up:
py/traceback.go 22.22% <ø> (-2.11%) :arrow_down:
py/util.go 0.00% <0.00%> (ø)
py/import.go 15.62% <45.16%> (-0.86%) :arrow_down:
modules/runtime.go 45.86% <45.86%> (ø)
py/run.go 60.46% <60.46%> (ø)
py/module.go 71.69% <72.50%> (+11.69%) :arrow_up:
pytest/pytest.go 49.09% <81.81%> (+1.92%) :arrow_up:
py/list.go 64.13% <83.33%> (+0.03%) :arrow_up:
sys/sys.go 60.75% <88.23%> (+1.60%) :arrow_up:
... and 14 more

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 3068cb5...02a8b37. Read the comment docs.

drew-512 commented 2 years ago

dammit, working too late and committed it all by accident. going to do a new PR

drew-512 commented 2 years ago

dammit, working too late and committed it all by accident. going to do a new PR