This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: inspect.isabstract to return boolean values only
Type: behavior Stage:
Components: Library (Lib) Versions: Python 3.2, Python 2.7
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: benjamin.peterson Nosy List: benjamin.peterson, chuck, ggenellina
Priority: normal Keywords: patch

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

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 
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 
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.
Date User Action Args
2022-04-11 14:56:53adminsetgithub: 51318
2009-10-15 03:07:35benjamin.petersonsetstatus: open -> closed
resolution: fixed
messages: + msg94069
2009-10-14 17:52:02benjamin.petersonsetassignee: benjamin.peterson

nosy: + benjamin.peterson
2009-10-14 11:31:27chucksetmessages: + msg93974
2009-10-09 01:22:02ggenellinasetmessages: + msg93769
2009-10-07 05:47:02chucksetfiles: + inspect.diff

messages: + msg93677
2009-10-06 20:51:35ggenellinasetfiles: - inspect.diff
2009-10-06 20:51:23ggenellinasetfiles: + inspect.diff

messages: + msg93660
2009-10-06 06:49:55chucksetnosy: + chuck
messages: + msg93633
2009-10-06 04:32:40ggenellinacreate