Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-125286: Share the Main Refchain With Legacy Interpreters#125709

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Merged
Changes from1 commit
Commits
Show all changes
16 commits
Select commitHold shift + click to select a range
53cfb82
Share the main refchain with legacy interpreters.
ericsnowcurrentlyOct 18, 2024
b2bf609
Add a has_own_refchain() helper function.
ericsnowcurrentlyOct 18, 2024
203c112
Drop _Py_NormalizeImmortalReference().
ericsnowcurrentlyOct 21, 2024
ffe2633
Drop has_own_refchain() calls where not needed.
ericsnowcurrentlyOct 21, 2024
8d52258
Call _PyObject_InitState() *after* computing the feature flags.
ericsnowcurrentlyOct 21, 2024
216dde2
Revert "Call _PyObject_InitState() *after* computing the feature flags."
ericsnowcurrentlyOct 21, 2024
fbc4e2d
Revert "Drop has_own_refchain() calls where not needed."
ericsnowcurrentlyOct 21, 2024
cb06847
has_own_refchain() -> maybe_fix_refchain()
ericsnowcurrentlyOct 21, 2024
7aa33a9
Handle late runtime fini correctly.
ericsnowcurrentlyOct 21, 2024
3421a19
Pass the interpreter config to init_interpreter().
ericsnowcurrentlyOct 22, 2024
b276454
Revert "Pass the interpreter config to init_interpreter()."
ericsnowcurrentlyOct 22, 2024
7ab086c
Move the _PyObject_InitState() call out of init_interpreter().
ericsnowcurrentlyOct 22, 2024
9d539f6
Add docs and a What's New entry
encukouOct 22, 2024
d80fe6a
Fix typos.
ericsnowcurrentlyOct 22, 2024
1360d86
Do not try to destroy the refchain if it is NULL.
ericsnowcurrentlyOct 22, 2024
090b528
Docs: Link to the new sys.getobjects() docs
encukouOct 23, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
PrevPrevious commit
NextNext commit
Drop has_own_refchain() calls where not needed.
  • Loading branch information
@ericsnowcurrently
ericsnowcurrently committedOct 21, 2024
commitffe263370fe0ac0f2c5bde12821775b8943eb24f
18 changes: 0 additions & 18 deletionsObjects/object.c
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -215,19 +215,13 @@ refchain_fini(PyInterpreterState *interp)
bool
_PyRefchain_IsTraced(PyInterpreterState *interp, PyObject *obj)
{
if (!has_own_refchain(interp)) {
interp = _PyInterpreterState_Main();
}
return (_Py_hashtable_get(REFCHAIN(interp), obj) == REFCHAIN_VALUE);
}


static void
_PyRefchain_Trace(PyInterpreterState *interp, PyObject *obj)
{
if (!has_own_refchain(interp)) {
interp = _PyInterpreterState_Main();
}
if (_Py_hashtable_set(REFCHAIN(interp), obj, REFCHAIN_VALUE) < 0) {
// Use a fatal error because _Py_NewReference() cannot report
// the error to the caller.
Expand All@@ -239,9 +233,6 @@ _PyRefchain_Trace(PyInterpreterState *interp, PyObject *obj)
static void
_PyRefchain_Remove(PyInterpreterState *interp, PyObject *obj)
{
if (!has_own_refchain(interp)) {
interp = _PyInterpreterState_Main();
}
void *value = _Py_hashtable_steal(REFCHAIN(interp), obj);
#ifndef NDEBUG
assert(value == REFCHAIN_VALUE);
Expand DownExpand Up@@ -2587,9 +2578,6 @@ _Py_PrintReferences(PyInterpreterState *interp, FILE *fp)
interp = _PyInterpreterState_Main();
}
fprintf(fp, "Remaining objects:\n");
if (!has_own_refchain(interp)) {
interp = _PyInterpreterState_Main();
}
_Py_hashtable_foreach(REFCHAIN(interp), _Py_PrintReference, fp);
}

Expand DownExpand Up@@ -2618,9 +2606,6 @@ void
_Py_PrintReferenceAddresses(PyInterpreterState *interp, FILE *fp)
{
fprintf(fp, "Remaining object addresses:\n");
if (!has_own_refchain(interp)) {
interp = _PyInterpreterState_Main();
}
_Py_hashtable_foreach(REFCHAIN(interp), _Py_PrintReferenceAddress, fp);
}

Expand DownExpand Up@@ -2700,9 +2685,6 @@ _Py_GetObjects(PyObject *self, PyObject *args)
.limit = limit,
};
PyInterpreterState *interp = _PyInterpreterState_GET();
if (!has_own_refchain(interp)) {
interp = _PyInterpreterState_Main();
}
int res = _Py_hashtable_foreach(REFCHAIN(interp), _Py_GetObject, &data);
if (res == _PY_GETOBJECTS_ERROR) {
Py_DECREF(list);
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp