Opened 8 years ago
Last modified 7 years ago
#29282 closed Bug
Admin checks raise TypeError if isinstance() receives a non-class — at Version 1
| Reported by: | David Sanders | Owned by: | nobody |
|---|---|---|---|
| Component: | contrib.admin | Version: | dev |
| Severity: | Normal | Keywords: | |
| Cc: | Herbert Fortes | Triage Stage: | Ready for checkin |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description (last modified by )
Admin checks include several calls to issubclass without a try/catch, allowing a TypeError to escape if the user provides a value that isn't a class for whatever is being checked. This seems like a sane-enough edge case to ensure the user gets a useful check failed message rather than an uncaught exception. My PR uses a helper function that catches the TypeError and returns False instead so that the half-dozen checks that use issubclass have minimal code change.
Change History (1)
comment:1 by , 8 years ago
| Description: | modified (diff) |
|---|---|
| Patch needs improvement: | set |
| Summary: | Admin Checks May Raise TypeError → Admin checks raise TypeError if isinstance() receives a non-class |
| Triage Stage: | Unreviewed → Accepted |
Note:
See TracTickets
for help on using tickets.