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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Lazy GC tracking frame #73235
Comments
Don't _PyObject_GC_TRACK(frame) before using it. result without --enable-optimization:
Faster (27):
Benchmark hidden because not significant (22): chaos, crypto_pyaes, django_template, fannkuch, float, json_loads, logging_format, nqueens, pickle_pure_python, raytrace, regex_dna, regex_v8, scimark_lu, scimark_sor, sqlalchemy_declarative, sqlalchemy_imperative, sympy_sum, tornado_http, unpickle, xml_etree_generate, xml_etree_iterparse, xml_etree_process |
--enable-optimizations:
Faster (42):
Benchmark hidden because not significant (10): chameleon, logging_simple, pidigits, python_startup_no_site, unpickle, unpickle_pure_python, xml_etree_generate, xml_etree_iterparse, xml_etree_parse, xml_etree_process |
New changeset f5eb0c4f5d37 by INADA Naoki in branch 'default': |
(Rietveld shows 500 error when replying.)
Fixed when committing. |
Please wrap private functions in #ifndef Py_LIMITED_API/#endif. |
No problem. Whole Include/frameobject.h is wrapped by Py_LIMITED_API. |
Ah, sorry. Then it LGTM. Do you have a microbenchmark that exposes a maximal effect of this change? |
Perhaps this change caused reference leaks: test_exceptions leaked [1227, 1227, 1227] references, sum=3681 |
On my PC, this patch also introduces two tests failure: FAIL: test_log_destroyed_pending_task (test.test_asyncio.test_tasks.CTask_CFuture_SubclassTests) Traceback (most recent call last):
File "/home/angwer/cpython/Lib/test/test_asyncio/test_tasks.py", line 1823, in test_log_destroyed_pending_task
self.assertEqual(Task.all_tasks(loop=self.loop), set())
AssertionError: Items in the first set but not the second:
<Task pending coro=<BaseTaskTests.test_log_destroyed_pending_task.<locals>.kill_me() running at /home/angwer/cpython/Lib/test/test_asyncio/test_tasks.py:1796> wait_for=<Future pending cb=[<TaskWakeupMethWrapper object at 0x7f649f135f18>()] created at /home/angwer/cpython/Lib/test/test_asyncio/test_tasks.py:2001> created at /home/angwer/cpython/Lib/test/test_asyncio/test_tasks.py:83> ====================================================================== Traceback (most recent call last):
File "/home/angwer/cpython/Lib/test/test_asyncio/test_tasks.py", line 1823, in test_log_destroyed_pending_task
self.assertEqual(Task.all_tasks(loop=self.loop), set())
AssertionError: Items in the first set but not the second:
<Task pending coro=<BaseTaskTests.test_log_destroyed_pending_task.<locals>.kill_me() running at /home/angwer/cpython/Lib/test/test_asyncio/test_tasks.py:1796> wait_for=<Future pending cb=[<TaskWakeupMethWrapper object at 0x7f649f135498>()] created at /home/angwer/cpython/Lib/test/test_asyncio/test_tasks.py:86> created at /home/angwer/cpython/Lib/asyncio/base_events.py:287> ====================================================================== Traceback (most recent call last):
File "/home/angwer/cpython/Lib/test/test_asyncio/test_tasks.py", line 1823, in test_log_destroyed_pending_task
self.assertEqual(Task.all_tasks(loop=self.loop), set())
AssertionError: Items in the first set but not the second:
<Task pending coro=<BaseTaskTests.test_log_destroyed_pending_task.<locals>.kill_me() running at /home/angwer/cpython/Lib/test/test_asyncio/test_tasks.py:1796> wait_for=<Future pending cb=[<TaskWakeupMethWrapper object at 0x7f649f135d98>()] created at /home/angwer/cpython/Lib/test/test_asyncio/test_tasks.py:86> created at /home/angwer/cpython/Lib/asyncio/base_events.py:287> ====================================================================== Traceback (most recent call last):
File "/home/angwer/cpython/Lib/test/test_asyncio/test_tasks.py", line 1823, in test_log_destroyed_pending_task
self.assertEqual(Task.all_tasks(loop=self.loop), set())
AssertionError: Items in the first set but not the second:
<Task pending coro=<BaseTaskTests.test_log_destroyed_pending_task.<locals>.kill_me() running at /home/angwer/cpython/Lib/test/test_asyncio/test_tasks.py:1796> wait_for=<Future pending cb=[Task._wakeup()] created at /home/angwer/cpython/Lib/test/test_asyncio/test_tasks.py:86> created at /home/angwer/cpython/Lib/asyncio/base_events.py:287> ====================================================================== Traceback (most recent call last):
File "/home/angwer/cpython/Lib/test/test_asyncio/test_tasks.py", line 1823, in test_log_destroyed_pending_task
self.assertEqual(Task.all_tasks(loop=self.loop), set())
AssertionError: Items in the first set but not the second:
<Task pending coro=<BaseTaskTests.test_log_destroyed_pending_task.<locals>.kill_me() running at /home/angwer/cpython/Lib/test/test_asyncio/test_tasks.py:1796> wait_for=<Future pending cb=[add_subclass_tests.<locals>.Task._wakeup()] created at /home/angwer/cpython/Lib/test/test_asyncio/test_tasks.py:2001> created at /home/angwer/cpython/Lib/test/test_asyncio/test_tasks.py:83> ====================================================================== Traceback (most recent call last):
File "/home/angwer/cpython/Lib/test/test_asyncio/test_tasks.py", line 1823, in test_log_destroyed_pending_task
self.assertEqual(Task.all_tasks(loop=self.loop), set())
AssertionError: Items in the first set but not the second:
<Task pending coro=<BaseTaskTests.test_log_destroyed_pending_task.<locals>.kill_me() running at /home/angwer/cpython/Lib/test/test_asyncio/test_tasks.py:1796> wait_for=<Future pending cb=[Task._wakeup()] created at /home/angwer/cpython/Lib/test/test_asyncio/test_tasks.py:86> created at /home/angwer/cpython/Lib/asyncio/base_events.py:287> ====================================================================== Traceback (most recent call last):
File "/home/angwer/cpython/Lib/test/test_generators.py", line 54, in test_refcycle
self.assertTrue(finalized)
AssertionError: False is not true test test_generators failed 2 tests failed: Total duration: 17 sec |
I don't have time study the patches. But 29049-fix-generator-refleak.patch fixes the two test failures on my PC. :-) |
LGTM. It seems to me, that the part with Py_DECREF should be pushed to older branches. |
New changeset d6913acb31e3 by INADA Naoki in branch 'default': |
PyCoro_New() and PyGen_NewWithQualName() steals f reference, and DECREF when error. |
New changeset 5f3ac68f34f2 by INADA Naoki in branch 'default': |
FYI this optimization triggered a bug in the tp_clear slot of ElementTree parsers, bug which was hidden for years in Python 3: bpo-31499. |
Misc/NEWS
so that it is managed by towncrier #552Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: