[issue35101] inspect.findsource breaks on class frame objects

2019-01-25 Thread Aivar Annamaa


Change by Aivar Annamaa :


--
nosy: +Aivar.Annamaa

___
Python tracker 

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



[issue35101] inspect.findsource breaks on class frame objects

2018-10-31 Thread orlnub123


orlnub123  added the comment:

Added the requested test cases. They aren't an exact match but they should 
serve the same purpose.

--

___
Python tracker 

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



[issue35101] inspect.findsource breaks on class frame objects

2018-10-29 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

Seems there is a related open issue with a similar regex based solution 
proposed for another class definition related issue : 
https://bugs.python.org/issue22355#msg226538 . I think it's worth converting 
the example code reported in issue22355 as unit test cases. Since this issue 
already has a PR with tests then we can proceed further on this.

Thanks for the report!

--

___
Python tracker 

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



[issue35101] inspect.findsource breaks on class frame objects

2018-10-29 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +xtreak, yselivanov

___
Python tracker 

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



[issue35101] inspect.findsource breaks on class frame objects

2018-10-28 Thread orlnub123


Change by orlnub123 :


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

___
Python tracker 

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



[issue35101] inspect.findsource breaks on class frame objects

2018-10-28 Thread orlnub123


New submission from orlnub123 :

If you pass a frame object belonging to a class into findsource, it'll 
incorrectly give you the starting line number of the first function above it or 
0 if no functions are defined.

Here's some code to reproduce the issue:

import inspect

def test_func():
...  # This should not get printed

class Test:
frame = inspect.currentframe()

print(inspect.getsource(Test.frame))  # Depends on findsource

This unexpectedly prints the source of test_func instead of the class right 
below it.

--
components: Library (Lib)
messages: 328788
nosy: orlnub123
priority: normal
severity: normal
status: open
title: inspect.findsource breaks on class frame objects
type: behavior
versions: Python 3.6, 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