This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Python Devguide differs from python docs
Type: resource usage Stage: resolved
Components: Documentation Versions: Python 3.10, Python 3.9, Python 3.8
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: docs@python Nosy List: docs@python, miss-islington, ned.deily, pablogsal, pitrou, ypank
Priority: normal Keywords: patch

Created on 2020-08-01 17:58 by ypank, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 21703 merged python-dev, 2020-08-02 08:36
PR 21786 merged miss-islington, 2020-08-08 18:48
PR 21787 merged miss-islington, 2020-08-08 18:48
PR 21788 merged miss-islington, 2020-08-08 18:48
Messages (7)
msg374665 - (view) Author: Yaroslav Pankovych (ypank) * Date: 2020-08-01 17:58
As I can see here https://github.com/python/devguide/blob/master/garbage_collector.rst#collecting-the-oldest-generation

> the GC only triggers a full collection of the oldest generation if the ratio long_lived_pending / long_lived_total is above a given value (hardwired to 25%)

But in the python docs here https://docs.python.org/3.10/library/gc.html#gc.set_threshold

> When the number of allocations minus the number of deallocations exceeds threshold0, collection starts. Initially only generation 0 is examined. If generation 0 has been examined more than threshold1 times since generation 1 has been examined, then generation 1 is examined as well. Similarly, threshold2 controls the number of collections of generation 1 before collecting generation 2.

So, which one is correct?
msg374680 - (view) Author: Yaroslav Pankovych (ypank) * Date: 2020-08-02 08:23
As I can see here https://github.com/python/devguide/blob/master/garbage_collector.rst#collecting-the-oldest-generation

> the GC only triggers a full collection of the oldest generation if the ratio long_lived_pending / long_lived_total is above a given value (hardwired to 25%)

But in the python docs here https://docs.python.org/3.10/library/gc.html#gc.set_threshold

> When the number of allocations minus the number of deallocations exceeds threshold0, collection starts. Initially only generation 0 is examined. If generation 0 has been examined more than threshold1 times since generation 1 has been examined, then generation 1 is examined as well. Similarly, threshold2 controls the number of collections of generation 1 before collecting generation 2.

As I can see here: https://github.com/python/cpython/blob/master/Modules/gcmodule.c#L1456 the first one is correct.

We should probably fix python docs accordingly.
msg374682 - (view) Author: Yaroslav Pankovych (ypank) * Date: 2020-08-02 08:37
Here's opened PR. https://github.com/python/cpython/pull/21703
msg375055 - (view) Author: Pablo Galindo Salgado (pablogsal) * (Python committer) Date: 2020-08-08 18:48
New changeset 82ca8fada15b121866530f2cdac1b7055be4a244 by Yaroslav Pankovych in branch 'master':
bpo-41455: Provide a link to how the third generation is collected in the GC docs (GH-21703)
https://github.com/python/cpython/commit/82ca8fada15b121866530f2cdac1b7055be4a244
msg375056 - (view) Author: miss-islington (miss-islington) Date: 2020-08-08 18:55
New changeset 103ce3debf07a48e79319acd0890be0c53e64fff by Miss Islington (bot) in branch '3.9':
bpo-41455: Provide a link to how the third generation is collected in the GC docs (GH-21703)
https://github.com/python/cpython/commit/103ce3debf07a48e79319acd0890be0c53e64fff
msg375057 - (view) Author: miss-islington (miss-islington) Date: 2020-08-08 18:55
New changeset 105cfb5b182da63e8481fcb009e92546d240c6b5 by Miss Islington (bot) in branch '3.8':
bpo-41455: Provide a link to how the third generation is collected in the GC docs (GH-21703)
https://github.com/python/cpython/commit/105cfb5b182da63e8481fcb009e92546d240c6b5
msg375222 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2020-08-12 10:53
New changeset f3b6f3cd9ac6931ae346cf298fae7b691d5656bb by Miss Islington (bot) in branch '3.7':
bpo-41455: Provide a link to how the third generation is collected in the GC docs (GH-21703) (GH-21788)
https://github.com/python/cpython/commit/f3b6f3cd9ac6931ae346cf298fae7b691d5656bb
History
Date User Action Args
2022-04-11 14:59:34adminsetgithub: 85627
2020-12-05 20:02:36iritkatriellinkissue17243 superseder
2020-08-12 10:53:28ned.deilysetnosy: + ned.deily
messages: + msg375222
2020-08-08 18:55:48miss-islingtonsetmessages: + msg375057
2020-08-08 18:55:18miss-islingtonsetmessages: + msg375056
2020-08-08 18:49:18pablogsalsetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2020-08-08 18:48:49miss-islingtonsetpull_requests: + pull_request20930
2020-08-08 18:48:42miss-islingtonsetpull_requests: + pull_request20929
2020-08-08 18:48:35miss-islingtonsetnosy: + miss-islington
pull_requests: + pull_request20928
2020-08-08 18:48:24pablogsalsetmessages: + msg375055
2020-08-07 23:17:35terry.reedysetnosy: + pitrou, pablogsal
2020-08-07 18:56:30terry.reedysetversions: - Python 3.5, Python 3.6, Python 3.7
2020-08-02 08:37:33ypanksetnosy: - python-dev
messages: + msg374682
2020-08-02 08:36:14python-devsetkeywords: + patch
nosy: + python-dev

pull_requests: + pull_request20846
stage: patch review
2020-08-02 08:23:22ypanksetmessages: + msg374680
2020-08-01 17:58:11ypankcreate