GeezerVison is showing github.com — bpo-46417: Cleanup typeobject.c code by vstinner · Pull Request #30795 · python/cpython
Conversation
vstinner
commented
Jan 22, 2022
•
edited by bedevere-bot
Loading
Uh oh!
There was an error while loading. Please reload this page.
- Add comment to recurse_down_subclasses() explaining why it's safe
to use a borrowed reference to tp_subclasses.
- remove_all_subclasses() no longer accept NULL cases
- type_set_bases() now relies on the fact that new_bases is not NULL.
- type_dealloc_common() avoids PyErr_Fetch/PyErr_Restore if tp_bases
is NULL.
- remove_all_subclasses() makes sure that no exception is raised.
- Don't test at runtime if tp_mro only contains types: rely on
_PyType_CAST() assertion for that.
- _PyStaticType_Dealloc() no longer clears tp_subclasses which is
already NULL.
- mro_hierarchy() avoids calling _PyType_GetSubclasses() if
tp_subclasses is NULL.
Coding style:
- Use Py_NewRef().
- Add braces and move variable declarations to the first variable
assignement.
- Rename a few variables and parameters to use better names.
https://bugs.python.org/issue46417
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
* Add comment to recurse_down_subclasses() explaining why it's safe
to use a borrowed reference to tp_subclasses.
* remove_all_subclasses() no longer accept NULL cases
* type_set_bases() now relies on the fact that new_bases is not NULL.
* type_dealloc_common() avoids PyErr_Fetch/PyErr_Restore if tp_bases
is NULL.
* remove_all_subclasses() makes sure that no exception is raised.
* Don't test at runtime if tp_mro only contains types: rely on
_PyType_CAST() assertion for that.
* _PyStaticType_Dealloc() no longer clears tp_subclasses which is
already NULL.
* mro_hierarchy() avoids calling _PyType_GetSubclasses() if
tp_subclasses is NULL.
Coding style:
* Use Py_NewRef().
* Add braces and move variable declarations to the first variable
assignement.
* Rename a few variables and parameters to use better names.
|
test_concurrent_futures timed out on Address sanitizer and had to be re-run:
1 re-run test:
test_concurrent_futures
10 slowest tests:
- test_concurrent_futures: 25 min
- test_peg_generator: 9 min 46 sec
- test_tools: 4 min 45 sec
- test_asyncio: 2 7min 18 sec
- test_weakref: 1 min 26 sec
- test_venv: 1 min 24 sec
- test_subprocess: 1 min 6 sec
- test_lib2to3: 1 min 1 sec
- test_pickle: 59.4 sec
- test_gdb: 58.5 sec
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
In PyType_GetModuleByDef, the comment & assert is now out of date:
// mro_invoke() ensures that the type MRO cannot be empty, so we don't have
// to check i < PyTuple_GET_SIZE(mro) at the first loop iteration.
assert(PyTuple_GET_SIZE(mro) >= 1);
With a for loop, the i < PyTuple_GET_SIZE(mro) check is done before each iteration.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
Two years later, I don't recall why I replaced the while() loop with a for() loop. You can restore the while if you prefer.
|
encukou reacted with thumbs up emoji
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Reviewers
markshannon
Awaiting requested review from markshannon
markshannon is a code owner
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.