[issue40122] The implementation and documentation of "dis.findlables" don't match

2020-04-03 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40122] The implementation and documentation of "dis.findlables" don't match

2020-04-03 Thread miss-islington


miss-islington  added the comment:


New changeset 77c623ba3d084e99d68c30f368bd7fbd7f175b60 by Miss Islington (bot) 
in branch '3.8':
bpo-40122: Updated documentation for dis.findlabels() (GH-19274)
https://github.com/python/cpython/commit/77c623ba3d084e99d68c30f368bd7fbd7f175b60


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40122] The implementation and documentation of "dis.findlables" don't match

2020-04-03 Thread miss-islington


miss-islington  added the comment:


New changeset 00c779fd9c0a9e7586681a44e35607c1113b5014 by Miss Islington (bot) 
in branch '3.7':
bpo-40122: Updated documentation for dis.findlabels() (GH-19274)
https://github.com/python/cpython/commit/00c779fd9c0a9e7586681a44e35607c1113b5014


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40122] The implementation and documentation of "dis.findlables" don't match

2020-04-03 Thread miss-islington


Change by miss-islington :


--
pull_requests: +18696
pull_request: https://github.com/python/cpython/pull/19331

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40122] The implementation and documentation of "dis.findlables" don't match

2020-04-03 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 4.0 -> 5.0
pull_requests: +18695
pull_request: https://github.com/python/cpython/pull/19330

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40122] The implementation and documentation of "dis.findlables" don't match

2020-04-03 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset b74468e233a5137ff518e61eff65ca2d8833e38a by laike9m in branch 
'master':
bpo-40122: Updated documentation for dis.findlabels() (GH-19274)
https://github.com/python/cpython/commit/b74468e233a5137ff518e61eff65ca2d8833e38a


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40122] The implementation and documentation of "dis.findlables" don't match

2020-03-31 Thread laike9m


laike9m  added the comment:

I've created a PR to fix documentation.
https://github.com/python/cpython/pull/19274

I'll create a new issue for making the function accept a code object.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40122] The implementation and documentation of "dis.findlables" don't match

2020-03-31 Thread laike9m


Change by laike9m :


--
keywords: +patch
pull_requests: +18629
stage: needs patch -> patch review
pull_request: https://github.com/python/cpython/pull/19274

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40122] The implementation and documentation of "dis.findlables" don't match

2020-03-31 Thread STINNER Victor


Change by STINNER Victor :


--
nosy:  -vstinner

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40122] The implementation and documentation of "dis.findlables" don't match

2020-03-31 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

dis.findlabels() always worked with a byte code. And the docstring correctly 
describes this.

I think this is a documentation issue. The documentation fix should be 
backported to all maintained Python versions.

If you want to make dis.findlabels() accepting a code object, it would be a new 
feature and it may be only added in future Python release (3.9). It needs a 
separate issue. In any case the documentation bug should be fixed in maintained 
versions.

--
assignee:  -> docs@python
components: +Documentation -Library (Lib)
nosy: +docs@python
stage:  -> needs patch
type:  -> behavior
versions: +Python 3.7, Python 3.8

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40122] The implementation and documentation of "dis.findlables" don't match

2020-03-31 Thread Manjusaka


Change by Manjusaka :


--
nosy: +Manjusaka, vstinner

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40122] The implementation and documentation of "dis.findlables" don't match

2020-03-31 Thread laike9m


New submission from laike9m :

The documentation of dis.findlabels says:

> dis.findlabels(code)
> Detect all offsets in the code object code which are jump targets, and return 
> a list of these offsets.

But the implementation actually expects a raw compiled bytecode.

>>> def f():pass

>>> dis.findlabels(f.__code__)
Traceback (most recent call last):
  File "", line 1, in 
  File "/Users/laike9m/.pyenv/versions/3.7.4/lib/python3.7/dis.py", line 424, 
in findlabels
for offset, op, arg in _unpack_opargs(code):
  File "/Users/laike9m/.pyenv/versions/3.7.4/lib/python3.7/dis.py", line 408, 
in _unpack_opargs
for i in range(0, len(code), 2):
TypeError: object of type 'code' has no len()

>>> dis.findlabels(f.__code__.co_code)
[]

Since the other functions in the dis module all accept a code object rather 
than compiled code, I would suggest change the code instead of documentation.

Plus, this function does not seem to be tested anywhere. I can make a PR if 
this issue is confirmed.

--
components: Library (Lib)
messages: 365367
nosy: laike9m, serhiy.storchaka
priority: normal
severity: normal
status: open
title: The implementation and documentation of "dis.findlables" don't match
versions: Python 3.9

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com