[issue40317] inspect.getsource() examines incorrect target

2020-04-28 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

yes, thanks Ammar. Thanks Grzegorz for the report.

--
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> inspect.getsource returns incorrect source for classes when 
class definition is part of multiline strings
versions: +Python 3.9 -Python 2.7, 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



[issue40317] inspect.getsource() examines incorrect target

2020-04-28 Thread Ammar Askar


Ammar Askar  added the comment:

Did you mean to close this Karthik?

--
nosy: +ammar2

___
Python tracker 

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



[issue40317] inspect.getsource() examines incorrect target

2020-04-18 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

Fixed in master now with 
https://github.com/python/cpython/commit/696136b993e11b37c4f34d729a0375e5ad544ade
 . This includes the change of show decorators for classes too to make it 
consistent with functions so it's not backported.

--

___
Python tracker 

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



[issue40317] inspect.getsource() examines incorrect target

2020-04-18 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

This will be resolved hopefully resolved using 
https://github.com/python/cpython/pull/10307 . Using my patch on the reproducer 
in the report.

./python bpo40317.py
123
class Number:
payload = 123

321
class Number:
payload = 321

--
nosy: +xtreak

___
Python tracker 

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



[issue40317] inspect.getsource() examines incorrect target

2020-04-18 Thread Grzegorz Krasoń

New submission from Grzegorz Krasoń :

Based on the attached example:

Expected output:
```
123
class Number:
payload = 123

321
class Number:
payload = 321
```

Actual output:
```
123
class Number:
payload = 123

321
class Number:
payload = 123
```

Reproduced using:

* Python 2.7.17
* Python 3.7.7
* Python 3.8.2

--
components: Library (Lib)
files: demo.py
messages: 366701
nosy: Grzegorz Krasoń
priority: normal
severity: normal
status: open
title: inspect.getsource() examines incorrect target
type: behavior
versions: Python 2.7, Python 3.7, Python 3.8
Added file: https://bugs.python.org/file49072/demo.py

___
Python tracker 

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