Skip to content

Conversation

vstinner
Copy link
Member

@vstinner vstinner commented Jun 15, 2020

Remove the _Py_NewReference() function from the public C API (move it
to the internal C API).

https://bugs.python.org/issue40989

@vstinner
Copy link
Member Author

I ran a quick test on Cython, numpy and lxml: all projects 3 builds successful. I had to backport a few patches for numpy, to fix another unrelated incompatible changes. I didn't run their test suite.

@vstinner
Copy link
Member Author

I completed my PR to remove more functions:

  • _Py_NewReference()
  • _Py_ForgetReference()
  • _Py_GetRefTotal()
  • _PyTraceMalloc_NewReference()

Remove the _Py_NewReference() and _Py_ForgetReference() functions
from the public C API: move them to the internal C API.

Move with_tp_del() test function from the _testcapi module to the
_testinternalcapi module.
@vstinner
Copy link
Member Author

This PR now only makes two (related) functions internals:

  • _Py_NewReference()
  • _Py_ForgetReference()

I rebased this PR on top of PR #20915 which made _PyTraceMalloc_NewReference() fully internal (don't export it anymore).

I changed my mind on _Py_GetRefTotal(): for now, it's fine to keep it as a private function, since sys._gettotalrefcount() private function exists at the Python level.

@vstinner vstinner closed this Sep 21, 2021
@vstinner vstinner deleted the make_new_ref_internal branch September 21, 2021 21:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants