[issue33261] inspect.isgeneratorfunction fails on hand-created methods

2019-04-03 Thread Petr Viktorin
Change by Petr Viktorin : -- stage: patch review -> resolved status: open -> closed ___ Python tracker ___ ___ Python-bugs-list

[issue33261] inspect.isgeneratorfunction fails on hand-created methods

2019-04-02 Thread Petr Viktorin
Petr Viktorin added the comment: New changeset fcef60f59d04c63b3540b4c4886226098c1bacd1 by Petr Viktorin (Jeroen Demeyer) in branch 'master': bpo-33261: guard access to __code__ attribute in inspect (GH-6448) https://github.com/python/cpython/commit/fcef60f59d04c63b3540b4c4886226098c1bacd1

[issue33261] inspect.isgeneratorfunction fails on hand-created methods

2019-03-27 Thread Petr Viktorin
Petr Viktorin added the comment: I just reviewed, and I plan to merge it if I don't see any pushback from the others. Sorry for the extreme delay. -- nosy: +petr.viktorin ___ Python tracker

[issue33261] inspect.isgeneratorfunction fails on hand-created methods

2018-10-09 Thread Jeroen Demeyer
Jeroen Demeyer added the comment: Can somebody please review PR 6448? -- ___ Python tracker ___ ___ Python-bugs-list mailing list

[issue33261] inspect.isgeneratorfunction fails on hand-created methods

2018-04-18 Thread Jeroen Demeyer
Jeroen Demeyer added the comment: Can we please go back to the original issue? If you think that __code__ should be an alias for __call__.__code__, that is a different issue. On https://github.com/python/cpython/pull/6448#issuecomment-381507329 I posted an alternative

[issue33261] inspect.isgeneratorfunction fails on hand-created methods

2018-04-15 Thread Nick Coghlan
Nick Coghlan added the comment: Terry, if you'd like to continue that discussion, please open a new enhancement request for 3.8+ against the inspect module asking for the affected introspection functions to recursively search for relevant attributes, the same way

[issue33261] inspect.isgeneratorfunction fails on hand-created methods

2018-04-14 Thread Jeroen Demeyer
Jeroen Demeyer added the comment: > I would like python_coded_callable.__code__ to be the code object executed > when python_coded_callable is called First of all, that doesn't answer the question of what to do with non-Python coded callables where there is no __code__

[issue33261] inspect.isgeneratorfunction fails on hand-created methods

2018-04-14 Thread Terry J. Reedy
Terry J. Reedy added the comment: I would like python_coded_callable.__code__ to be the code object executed when python_coded_callable is called, just as expected by the isxyz author(s). It has to exist somewhere. Methods m and m3 both return 42 when called, and both

[issue33261] inspect.isgeneratorfunction fails on hand-created methods

2018-04-14 Thread Jeroen Demeyer
Jeroen Demeyer added the comment: The only attributes that a method is guaranteed to have are __func__ and __self__ (which are the arguments passed to the MethodType constructor). All other attributes are looked up through __func__ by the C version of the following Python

[issue33261] inspect.isgeneratorfunction fails on hand-created methods

2018-04-14 Thread Jeroen Demeyer
Jeroen Demeyer added the comment: > I am wondering if, instead, the bug is in m, the object returned by > MethodType, or in attribute lookup thereupon. What would you expect m.__code__ to return then? Methods support arbitrary callables and certainly not all callables

[issue33261] inspect.isgeneratorfunction fails on hand-created methods

2018-04-13 Thread Nick Coghlan
Nick Coghlan added the comment: The inspect functions throwing an exception when handed a method wrapping a non-function callable instead of returning False is a definite bug. The behaviour of MethodType when handed a non-function callable is cryptic, but not actually a

[issue33261] inspect.isgeneratorfunction fails on hand-created methods

2018-04-13 Thread Terry J. Reedy
Terry J. Reedy added the comment: Nick and Raymond, I added both of you as nosy because, among other reasons, you commented on the latest version of PEP575. I agree that there is a bug in current CPython, in that the is* functions should return, not raise, but I am not sure

[issue33261] inspect.isgeneratorfunction fails on hand-created methods

2018-04-11 Thread Jeroen Demeyer
Change by Jeroen Demeyer : -- keywords: +patch pull_requests: +6144 stage: -> patch review ___ Python tracker ___

[issue33261] inspect.isgeneratorfunction fails on hand-created methods

2018-04-11 Thread Jeroen Demeyer
New submission from Jeroen Demeyer : The inspect functions isgeneratorfunction, iscoroutinefunction, isasyncgenfunction can fail on methods that do not have a __code__ attribute: >>> from types import MethodType >>> class Callable: ... def __call__(self, *args): ...