[issue33745] 3.7.0b5 changes the line number of empty functions with docstrings

2018-06-10 Thread Ned Deily


Ned Deily  added the comment:

The 3.7 What's New has been updated as Nick suggested.  Thanks, Nick, and 
thanks, Ned, for bringing it up!

--
priority: deferred blocker -> 
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



[issue33745] 3.7.0b5 changes the line number of empty functions with docstrings

2018-06-10 Thread miss-islington


miss-islington  added the comment:


New changeset 14a190c88273fb22d9439bbed394f19f21e8a0f9 by Miss Islington (bot) 
in branch '3.7':
bpo-33745: Add What's New for empty function docstring change. (GH-7611)
https://github.com/python/cpython/commit/14a190c88273fb22d9439bbed394f19f21e8a0f9


--
nosy: +miss-islington

___
Python tracker 

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



[issue33745] 3.7.0b5 changes the line number of empty functions with docstrings

2018-06-10 Thread miss-islington


Change by miss-islington :


--
pull_requests: +7237

___
Python tracker 

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



[issue33745] 3.7.0b5 changes the line number of empty functions with docstrings

2018-06-10 Thread Ned Deily


Ned Deily  added the comment:


New changeset 12c6cdf4d16078aa09de32a39193c8161177b39d by Ned Deily in branch 
'master':
bpo-33745: Add What's New for empty function docstring change. (GH-7611)
https://github.com/python/cpython/commit/12c6cdf4d16078aa09de32a39193c8161177b39d


--

___
Python tracker 

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



[issue33745] 3.7.0b5 changes the line number of empty functions with docstrings

2018-06-10 Thread Ned Deily


Change by Ned Deily :


--
keywords: +patch
pull_requests: +7236
stage:  -> patch review

___
Python tracker 

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



[issue33745] 3.7.0b5 changes the line number of empty functions with docstrings

2018-06-08 Thread Nick Coghlan


Nick Coghlan  added the comment:

The rationale for documenting it in the porting section is that even though 
this isn't a guaranteed stable interface, the output *does* potentially affect 
development tools like Ned's coverage.py, as well as other implementations 
attempting to adhere closely to CPython's behaviour for any given version.

(Although it doesn't usually help *Ned* much, since he's often the one letting 
us know that we inadvertently changed some details of the code generator's 
output...)

--
assignee:  -> docs@python
components: +Documentation
nosy: +docs@python

___
Python tracker 

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



[issue33745] 3.7.0b5 changes the line number of empty functions with docstrings

2018-06-07 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

This change looks not intentional, but not incorrect. I'm not sure that it is 
worth to document it. Any behavior (in 3.6 and in 3.7) is CPython 
implementation detail.

--

___
Python tracker 

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



[issue33745] 3.7.0b5 changes the line number of empty functions with docstrings

2018-06-05 Thread Nick Coghlan


Nick Coghlan  added the comment:

While I wouldn't describe this as completely intentional (as it's an artifact 
of the change-and-revert dance with 3.7 previously removing docstring nodes 
from the AST entirely), I also wouldn't want to change it again at this late 
stage of the release process.

Instead I'd suggest simply noting it in the porting section of What's New. 
Something like "Due to a change in the way docstrings are handled by the 
compiler, the implicit ``return None`` in a function body consisting solely of 
a docstring is now marked as occurring on the same line as the docstring, not 
on the function's header line".

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue33745] 3.7.0b5 changes the line number of empty functions with docstrings

2018-06-04 Thread Ned Deily


Ned Deily  added the comment:

Setting to deferred blocker for evaluation

--
nosy: +inada.naoki, ncoghlan, ned.deily
priority: normal -> deferred blocker
versions: +Python 3.8

___
Python tracker 

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



[issue33745] 3.7.0b5 changes the line number of empty functions with docstrings

2018-06-03 Thread Ned Batchelder


New submission from Ned Batchelder :

I'm not sure if this is a regression or an intentional change.  I know that the 
behavior has changed.

If a function has a docstring but no other body, Python 3.7b5 assigns the line 
number of the docstring to the implicit "return None".  Previous versions 
(including 3.7b4) used the line number of the "def".

Demonstration:

$ cat /tmp/empty.py
def empty():
pass

def empty_with_docstring():
'''Docstring'''

def docstring():
'''Docstring'''
return 1

import dis, sys

print(sys.version)

for fn in [empty, empty_with_docstring, docstring]:
print(fn.__name__)
dis.dis(fn)

$ /usr/local/pythonz/pythons/CPython-2.7.14/bin/python2.7 /tmp/empty.py
2.7.14 (default, Oct  4 2017, 09:45:53)
[GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.37)]
empty
  2   0 LOAD_CONST   0 (None)
  3 RETURN_VALUE
empty_with_docstring
  4   0 LOAD_CONST   1 (None)
  3 RETURN_VALUE
docstring
  9   0 LOAD_CONST   1 (1)
  3 RETURN_VALUE

$ /usr/local/pythonz/pythons/CPython-3.6.4/bin/python3.6 /tmp/empty.py
3.6.4 (default, Dec 19 2017, 08:11:42)
[GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.39.2)]
empty
  2   0 LOAD_CONST   0 (None)
  2 RETURN_VALUE
empty_with_docstring
  4   0 LOAD_CONST   1 (None)
  2 RETURN_VALUE
docstring
  9   0 LOAD_CONST   1 (1)
  2 RETURN_VALUE

$ /usr/local/pythonz/pythons/CPython-3.7.0b4/bin/python3.7 /tmp/empty.py
3.7.0b4 (default, May  2 2018, 21:07:21)
[Clang 9.0.0 (clang-900.0.39.2)]
empty
  2   0 LOAD_CONST   0 (None)
  2 RETURN_VALUE
empty_with_docstring
  4   0 LOAD_CONST   1 (None)
  2 RETURN_VALUE
docstring
  9   0 LOAD_CONST   1 (1)
  2 RETURN_VALUE

$ /usr/local/pythonz/pythons/CPython-3.7.0b5/bin/python3.7 /tmp/empty.py
3.7.0b5 (default, Jun  2 2018, 11:27:19)
[Clang 9.1.0 (clang-902.0.39.2)]
empty
  2   0 LOAD_CONST   0 (None)
  2 RETURN_VALUE
empty_with_docstring
  5   0 LOAD_CONST   1 (None)
  2 RETURN_VALUE
docstring
  9   0 LOAD_CONST   1 (1)
  2 RETURN_VALUE

--
keywords: 3.7regression
messages: 318532
nosy: nedbat
priority: normal
severity: normal
status: open
title: 3.7.0b5 changes the line number of empty functions with docstrings
versions: Python 3.7

___
Python tracker 

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