Skip to content

bpo-40989: Move _Py_NewReference() to the internal C API - #20904

Closed
vstinner wants to merge 1 commit into
python:mainfrom
vstinner:make_new_ref_internal
Closed

bpo-40989: Move _Py_NewReference() to the internal C API#20904
vstinner wants to merge 1 commit into
python:mainfrom
vstinner:make_new_ref_internal

Conversation

@vstinner

@vstinnervstinner commented Jun 15, 2020

Copy link
Copy Markdown
Member

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
Copy Markdown
MemberAuthor

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
Copy Markdown
MemberAuthor

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
Copy Markdown
MemberAuthor

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 deleted the make_new_ref_internal branch September 21, 2021 21:57
Sign up for freeto 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

@vstinner@the-knights-who-say-ni@bedevere-bot