Issue 7069: inspect.isabstract to return boolean values only (original) (raw)

Created on 2009-10-06 04:32 by ggenellina, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
inspect.diff ggenellina,2009-10-06 20:51 patch + unit tests
inspect.diff chuck,2009-10-07 05:47 patch + unit tests
Messages (7)
msg93631 - (view) Author: Gabriel Genellina (ggenellina) Date: 2009-10-06 04:32
Currently, inspect.isabstract() may return an integer like 1048576 instead of True, or 0 instead of False. Although technically correct, no other isXXX function behaves that way; also, isgeneratorfunction() uses a similar code construct but casts the result into a boolean. The attached patch makes inspect.isabstract() return a boolean value always.
msg93633 - (view) Author: Jan (chuck) * Date: 2009-10-06 06:49
The patch works, as this is what is implicitly happening anyway if you use the function. There seem to be no tests for this function, so there is nothing to break. I guess this is the right time to get some tests. Gabriel, would you like to write tests for this function?
msg93660 - (view) Author: Gabriel Genellina (ggenellina) Date: 2009-10-06 20:51
Tests added.
msg93677 - (view) Author: Jan (chuck) * Date: 2009-10-07 05:47
I changed the patch so it does not introduce new dependencies and fails before the patch of isabstract().
msg93769 - (view) Author: Gabriel Genellina (ggenellina) Date: 2009-10-09 01:22
I don't think we should test the actual type returned (bool); that would be overspecifying. The documentation doesn't promise it IS a boolean, and no other test for any isXXX() function checks the type either. I'd remove the last five assertions.
msg93974 - (view) Author: Jan (chuck) * Date: 2009-10-14 11:31
That's fine with me. Looks like nobody wants to check it in anyways.
msg94069 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2009-10-15 03:07
Applied in r75433.
History
Date User Action Args
2022-04-11 14:56:53 admin set github: 51318
2009-10-15 03:07:35 benjamin.peterson set status: open -> closedresolution: fixedmessages: +
2009-10-14 17:52:02 benjamin.peterson set assignee: benjamin.petersonnosy: + benjamin.peterson
2009-10-14 11:31:27 chuck set messages: +
2009-10-09 01:22:02 ggenellina set messages: +
2009-10-07 05:47:02 chuck set files: + inspect.diffmessages: +
2009-10-06 20:51:35 ggenellina set files: - inspect.diff
2009-10-06 20:51:23 ggenellina set files: + inspect.diffmessages: +
2009-10-06 06:49:55 chuck set nosy: + chuckmessages: +
2009-10-06 04:32:40 ggenellina create