hpyproject / hpy

HPy: a better API for Python
https://hpyproject.org
MIT License
1.02k stars 52 forks source link

Should HPy_Close silently ignore HPy_NULL? #297

Open steve-s opened 2 years ago

steve-s commented 2 years ago

Currently this is the contract in CPython and GraalPython backends. There seems to be no documentation of HPy_Close that would say which is correct. We should make a decision and document it. See also discussion in https://github.com/hpyproject/hpy/pull/281 (last few comments)

steve-s commented 2 years ago

We should do some performance measurement for CPython ABI mode performance, where the difference in whether we do extra if (...) may matter. On universal mode HPy_Close is a full function call anyway so we expect the performance difference to be negligible.

Idea from @antocuni: change all DECREF to XDECREF in numpy and run its benchmarks.

hodgestar commented 2 years ago

Once we make a decision, we should also add the appropriate test so that it's easy for HPy implementations to check that they comply.