[issue16355] inspect.getcomments() does not work in the interactive shell

2017-03-24 Thread Berker Peksag
Berker Peksag added the comment: New changeset 3f2155ffe683080f2a1b28408fa48d43ba92f943 by Berker Peksag (Marco Buttu) in branch 'master': bpo-16355: Clarify when inspect.getcomments() returns None (#428) https://github.com/python/cpython/commit/3f2155ffe683080f2a1b28408fa48d43ba92f943

[issue16355] inspect.getcomments() does not work in the interactive shell

2017-03-24 Thread Berker Peksag
Berker Peksag added the comment: New changeset 41b4a2189f29daae008e57f799a30890643d191f by Berker Peksag in branch '3.5': bpo-16355: Clarify when inspect.getcomments() returns None (#428) (#691) https://github.com/python/cpython/commit/41b4a2189f29daae008e57f799a30890643d191f --

[issue16355] inspect.getcomments() does not work in the interactive shell

2017-03-24 Thread Berker Peksag
Berker Peksag added the comment: New changeset 948171bf999cf8b3e12048851041d2e04ae3a78c by Berker Peksag in branch '3.6': bpo-16355: Clarify when inspect.getcomments() returns None (#428) (#690) https://github.com/python/cpython/commit/948171bf999cf8b3e12048851041d2e04ae3a78c --

[issue16355] inspect.getcomments() does not work in the interactive shell

2017-03-17 Thread Berker Peksag
Berker Peksag added the comment: Now all PRs have been merged: * master: https://github.com/python/cpython/commit/3f2155ffe683080f2a1b28408fa48d43ba92f943 * 3.6: https://github.com/python/cpython/commit/948171bf999cf8b3e12048851041d2e04ae3a78c * 3.5:

[issue16355] inspect.getcomments() does not work in the interactive shell

2017-03-17 Thread Berker Peksag
Changes by Berker Peksag : -- pull_requests: +567 ___ Python tracker ___ ___

[issue16355] inspect.getcomments() does not work in the interactive shell

2017-03-17 Thread Berker Peksag
Berker Peksag added the comment: Please don't close an issue while there are still open backport PRs on GitHub. -- resolution: fixed -> stage: resolved -> status: closed -> open ___ Python tracker

[issue16355] inspect.getcomments() does not work in the interactive shell

2017-03-17 Thread Marco Buttu
Changes by Marco Buttu : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker ___

[issue16355] inspect.getcomments() does not work in the interactive shell

2017-03-17 Thread Berker Peksag
Changes by Berker Peksag : -- pull_requests: +565 ___ Python tracker ___ ___

[issue16355] inspect.getcomments() does not work in the interactive shell

2017-03-03 Thread R. David Murray
R. David Murray added the comment: Correct. Tests are good, it's the fix I was rejecting. -- ___ Python tracker ___

[issue16355] inspect.getcomments() does not work in the interactive shell

2017-03-03 Thread Berker Peksag
Berker Peksag added the comment: I think David's comment about tests was for the second patch. Looking at msg199395 and msg199397, my understanding is that tests are still needed. -- nosy: +berker.peksag versions: +Python 3.5, Python 3.6, Python 3.7 -Python 3.3, Python 3.4

[issue16355] inspect.getcomments() does not work in the interactive shell

2017-03-03 Thread Marco Buttu
Changes by Marco Buttu : -- pull_requests: +356 ___ Python tracker ___ ___

[issue16355] inspect.getcomments() does not work in the interactive shell

2017-02-23 Thread Marco Buttu
Marco Buttu added the comment: Hello Vajrasky, the doc patch LGTM. Looking at the David's comment in Rietveld, it seems that he does not want the test patch to be applyed. Can you please make a pull request? Thank you very much -- ___ Python

[issue16355] inspect.getcomments() does not work in the interactive shell

2013-12-13 Thread Vajrasky Kok
Vajrasky Kok added the comment: So, I just found out that imp has been deprecated. Here is the patch that uses importlib.machinery instead of imp.load_source. -- Added file: http://bugs.python.org/file33127/issue16355_v5.diff ___ Python tracker

[issue16355] inspect.getcomments() does not work in the interactive shell

2013-10-12 Thread Georg Brandl
Georg Brandl added the comment: lives in the interactive shell is not precise; I would prefer has been defined in -- nosy: +georg.brandl ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16355

[issue16355] inspect.getcomments() does not work in the interactive shell

2013-10-12 Thread Vajrasky Kok
Vajrasky Kok added the comment: Attached the patch to address Georg Brandl's concern (Thank you!). I also added test for checking the comment of the object defined in C (list, open, etc). I have given thought about testing the comment of the object in interactive shell. But it is too much

[issue16355] inspect.getcomments() does not work in the interactive shell

2013-10-11 Thread Vajrasky Kok
Vajrasky Kok added the comment: Added the doc fix and modified the test. -- Added file: http://bugs.python.org/file32057/issue16355_v3.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16355

[issue16355] inspect.getcomments() does not work in the interactive shell

2013-10-10 Thread Vajrasky Kok
Vajrasky Kok added the comment: Only doc fix? What about unit test confirming that getcomments and getsource return None if inspect can not find the source code? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16355

[issue16355] inspect.getcomments() does not work in the interactive shell

2013-10-10 Thread R. David Murray
R. David Murray added the comment: Yes, good point, those tests should definitely be added, which means the test work doesn't go to waste :) Note, however, that getsource *does* raise. -- ___ Python tracker rep...@bugs.python.org

[issue16355] inspect.getcomments() does not work in the interactive shell

2013-10-09 Thread R. David Murray
R. David Murray added the comment: Looking at the source, the suppression of errors is clearly intentional. Looking at the change that added the TypeError check, we see this from Jeremy Hilton in March 2002 (9c2ca37bdeec): It appears that getcomments() can get called for classes defined

[issue16355] inspect.getcomments() does not work in the interactive shell

2013-10-06 Thread Vajrasky Kok
Vajrasky Kok added the comment: I pep-8 Phil Connell's work and revamped the unit test based on R. David Murray's request. -- nosy: +vajrasky Added file: http://bugs.python.org/file31975/issue16355_v2.diff ___ Python tracker rep...@bugs.python.org

[issue16355] inspect.getcomments() does not work in the interactive shell

2013-04-18 Thread Phil Connell
Phil Connell added the comment: Here's a patch that updates getcomments to match the behaviour of getsource, raising OSError if the source file can't be found and TypeError when passed a built-in. Since this is a backwards-incompatible change, presumably it can only be applied to 3.4. This

[issue16355] inspect.getcomments() does not work in the interactive shell

2013-04-18 Thread Ezio Melotti
Changes by Ezio Melotti ezio.melo...@gmail.com: -- stage: needs patch - patch review versions: -Python 3.2 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16355 ___

[issue16355] inspect.getcomments() does not work in the interactive shell

2012-11-03 Thread Ezio Melotti
Ezio Melotti added the comment: That's arguably a bug though. If the pragma was critical the program will silently do the wrong thing by ignoring an existing pragma when the source is missing (e.g. in production, even after passing all the tests locally). --

[issue16355] inspect.getcomments() does not work in the interactive shell

2012-11-03 Thread R. David Murray
R. David Murray added the comment: It doesn't matter whether it is a bug or not (though it is not in the situation I described). The point is that a working program would stop working. That is the kind of breakage our backward compatibility policy is designed to protect against. --

[issue16355] inspect.getcomments() does not work in the interactive shell

2012-11-03 Thread Ezio Melotti
Ezio Melotti added the comment: The point is that a working program would stop working. My point is that the program might not be a working program, if the function fails silently. Anyway this function is probably not widely used, so I'm fine either ways. --

[issue16355] inspect.getcomments() does not work in the interactive shell

2012-10-29 Thread Marco Buttu
New submission from Marco Buttu: The documentation for `inspect.getcomments()` says that it returns the lines of comments immediately preceding an object's source code. It works fine for the comments that immediately preceded an object defined in a module: $ more foo.py import inspect # A

[issue16355] inspect.getcomments() does not work in the interactive shell

2012-10-29 Thread R. David Murray
R. David Murray added the comment: That's because inspecting source code requires that there be a source file to inspect. -- nosy: +r.david.murray resolution: - invalid stage: - committed/rejected status: open - closed ___ Python tracker

[issue16355] inspect.getcomments() does not work in the interactive shell

2012-10-29 Thread R. David Murray
R. David Murray added the comment: Hmm. Reopening in case someone wants to see if we can generate an appropriate error message when there is no source file to inspect. -- status: closed - open versions: +Python 2.7, Python 3.4 ___ Python tracker

[issue16355] inspect.getcomments() does not work in the interactive shell

2012-10-29 Thread Marco Buttu
Marco Buttu added the comment: If inspect.getcomments() requires a source file to inspect, I think it would be better to indicate it in the doc. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16355

[issue16355] inspect.getcomments() does not work in the interactive shell

2012-10-29 Thread R. David Murray
R. David Murray added the comment: Yeah, this should be a doc bug. After I thought about it some more I realized that changing the behavior to raise an error would not be a good idea. -- assignee: - docs@python components: +Documentation -Library (Lib) nosy: +docs@python

[issue16355] inspect.getcomments() does not work in the interactive shell

2012-10-29 Thread Ezio Melotti
Changes by Ezio Melotti ezio.melo...@gmail.com: -- keywords: +easy nosy: +ezio.melotti stage: committed/rejected - needs patch type: behavior - enhancement versions: +Python 3.2 ___ Python tracker rep...@bugs.python.org

[issue16355] inspect.getcomments() does not work in the interactive shell

2012-10-29 Thread Marco Buttu
Marco Buttu added the comment: I saw there is the same lack of clarity in the doc of `inspect.getsource()`: import inspect print(inspect.getsource.__doc__) Return the text of the source code for an object. The argument may be a module, class, method, function, traceback, frame, or

[issue16355] inspect.getcomments() does not work in the interactive shell

2012-10-29 Thread Ezio Melotti
Ezio Melotti added the comment: After I thought about it some more I realized that changing the behavior to raise an error would not be a good idea. Can you elaborate more? Failing silently doesn't seem much better than raising an error, especially if similar functions already raise.

[issue16355] inspect.getcomments() does not work in the interactive shell

2012-10-29 Thread R. David Murray
R. David Murray added the comment: If similar functions already raise, then changing it for 3.4 would be OK. But to change it for earlier versions would risk breaking working programs. -- ___ Python tracker rep...@bugs.python.org

[issue16355] inspect.getcomments() does not work in the interactive shell

2012-10-29 Thread Ezio Melotti
Ezio Melotti added the comment: Not sure if they can be considered working programs if the function fails silently. Do you have some specific example in mind? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16355

[issue16355] inspect.getcomments() does not work in the interactive shell

2012-10-29 Thread R. David Murray
R. David Murray added the comment: Not a specific package, but a specific use case (assuming getcomments is in use at all :) Consider a program that uses getcomments to look for a pragma-like comment before a function, but one that is not critical to the program's function (perhaps it has to