Repository navigation
Closed
Labels
3.7 (EOL)end of life3.8 (EOL)end of life3.9 (EOL)end of lifedocsDocumentation in the Doc dirtype-featureA feature request or enhancement
Description
Note: 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:
assignee = None
closed_at = <Date 2019-10-26.21:14:51.193>
created_at = <Date 2019-10-22.15:51:00.228>
labels = ['3.8', 'type-feature', '3.7', '3.9', 'docs']
title = 'PyTuple_GetSlice docs minor inaccuracy'
updated_at = <Date 2019-10-26.21:14:51.193>
user = 'https://github.com/wimglenn'bugs.python.org fields:
activity = <Date 2019-10-26.21:14:51.193>
actor = 'serhiy.storchaka'
assignee = 'docs@python'
closed = True
closed_date = <Date 2019-10-26.21:14:51.193>
closer = 'serhiy.storchaka'
components = ['Documentation']
creation = <Date 2019-10-22.15:51:00.228>
creator = 'wim.glenn'
dependencies = []
files = []
hgrepos = []
issue_num = 38557
keywords = ['patch']
message_count = 7.0
messages = ['355141', '355385', '355388', '355426', '355428', '355429', '355430']
nosy_count = 5.0
nosy_names = ['terry.reedy', 'docs@python', 'serhiy.storchaka', 'wim.glenn', 'miss-islington']
pr_nums = ['16925', '16933', '16934', '16935']
priority = 'normal'
resolution = 'fixed'
stage = 'resolved'
status = 'closed'
superseder = None
type = 'enhancement'
url = 'https://bugs.python.org/issue38557'
versions = ['Python 2.7', 'Python 3.7', 'Python 3.8', 'Python 3.9']Metadata
Metadata
Assignees
Labels
3.7 (EOL)end of life3.8 (EOL)end of life3.9 (EOL)end of lifedocsDocumentation in the Doc dirtype-featureA feature request or enhancement
Activity
wimglenn commentedon Oct 22, 2019
https://docs.python.org/3/c-api/tuple.html#c.PyTuple_GetSlice
In the c-api it says (emphasis mine):
But when slicing the entire tuple, CPython will return already existing instance, not a new tuple.
https://github.com/python/cpython/blob/3.8/Objects/tupleobject.c#L448-L451
I propose the language in the docs be loosened so as not to tie the hands of implementation
terryjreedy commentedon Oct 25, 2019
"Take a slice of the tuple pointed to by p from low to high and return it **as a new tuple**."
could be replaces with
"Return the slice of the tuple point to by p for low to high. If it is a proper subslice, return a new tuple."
This leave it undefined when a complete slice.
serhiy-storchaka commentedon Oct 25, 2019
The part about "new tuple" can be removed. The documentation olready contains an automatically generated note about a new reference.
PR 16925 improves the documentation for getting/setting items/slices of lists and tuples.
serhiy-storchaka commentedon Oct 26, 2019
New changeset d898d20 by Serhiy Storchaka in branch 'master':
bpo-38557: Improve documentation for list and tuple C API. (GH-16925)
d898d20
miss-islington commentedon Oct 26, 2019
New changeset 7356e10 by Miss Skeleton (bot) in branch '2.7':
bpo-38557: Improve documentation for list and tuple C API. (GH-16925)
7356e10
miss-islington commentedon Oct 26, 2019
New changeset 334fc92 by Miss Skeleton (bot) in branch '3.7':
bpo-38557: Improve documentation for list and tuple C API. (GH-16925)
334fc92
miss-islington commentedon Oct 26, 2019
New changeset 4992dc6 by Miss Skeleton (bot) in branch '3.8':
bpo-38557: Improve documentation for list and tuple C API. (GH-16925)
4992dc6