[issue21217] inspect.getsourcelines finds wrong lines when lambda used argument to decorator

2015-04-14 Thread Thomas Ballinger

Thomas Ballinger added the comment:

Thanks Antoine! Could you add Allison Kaptur to NEWS and ACKS? This was an 
update to her original patch, and we paired on the whole thing.

--

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



[issue21217] inspect.getsourcelines finds wrong lines when lambda used argument to decorator

2015-04-13 Thread Thomas Ballinger

Thomas Ballinger added the comment:

Use dis.findlinestarts() to find lines of function instead of grubbing with 
co_lnotab manually, making dis module dependency non-optional.

--
Added file: http://bugs.python.org/file38970/issue21217-v6.patch

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



[issue21217] inspect.getsourcelines finds wrong lines when lambda used argument to decorator

2015-04-13 Thread Thomas Ballinger

Thomas Ballinger added the comment:

v4 of patch, with tests updated for changed lines in inspect fodder file

--
Added file: http://bugs.python.org/file38959/issue21217-v4.patch

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



[issue21217] inspect.getsourcelines finds wrong lines when lambda used argument to decorator

2015-04-13 Thread Thomas Ballinger

Thomas Ballinger added the comment:

Patch reformatted to be non-git style, NEWS item removed

--
Added file: http://bugs.python.org/file38965/issue21217-v5.patch

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



[issue21217] inspect.getsourcelines finds wrong lines when lambda used argument to decorator

2014-04-14 Thread Thomas Ballinger

New submission from Thomas Ballinger:

https://gist.github.com/thomasballinger/10666031


inspect.getsourcelines incorrectly guesses what lines correspond
to the function foo
 
see getblock in inspect.py
once it finds a lambda, def or class it finishes it then stops
so get getsourcelines returns only the first two noop decorator
lines of bar, while normal behavior is to return all decorators
as it does for foo

import inspect
from pprint import pprint
 
def noop(arg):
def inner(func):
return func
return inner
 
@noop(1)
@noop(2)
def foo():
return 1
 
@noop(1)
@noop(lambda: None)
@noop(1)
def bar():
return 1
 
pprint(inspect.getsourcelines(foo))
pprint(inspect.getsourcelines(bar))

--
components: Library (Lib)
messages: 216127
nosy: ballingt
priority: normal
severity: normal
status: open
title: inspect.getsourcelines finds wrong lines when lambda used argument to 
decorator
type: behavior
versions: Python 2.7, Python 3.1, Python 3.2, Python 3.3, Python 3.4, Python 3.5

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



[issue21217] inspect.getsourcelines finds wrong lines when lambda used argument to decorator

2014-04-14 Thread Thomas Ballinger

Thomas Ballinger added the comment:

The code object's co_lnotab is how inspect should be getting the sourcelines 
of the code, instead of looking for the first codeblock.

I'm looking at this now, thanks to Yhg1s for the above.

--

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



[issue16782] No curses.initwin: Incorrect package docstring for curses

2012-12-25 Thread Thomas Ballinger

New submission from Thomas Ballinger:

Lib/curses/__init__.py has `curses.initwin()` in the docstring example code, 
but this function does not exist (should be `initscr()`)

Bad in at least back to 2.4

--
assignee: docs@python
components: Documentation
files: docfix.patch
keywords: patch
messages: 178183
nosy: Thomas.Ballinger, docs@python
priority: normal
severity: normal
status: open
title: No curses.initwin: Incorrect package docstring for curses
versions: Python 3.3
Added file: http://bugs.python.org/file28437/docfix.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16782
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com