Opened 7 years ago
Closed 6 years ago
#29282 closed Bug (fixed)
Admin checks raise TypeError if issubclass() receives a non-class
Reported by: | David Sanders | Owned by: | Sanyam Khurana |
---|---|---|---|
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 (10)
comment:1 by , 7 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 |
comment:2 by , 7 years ago
Summary: | Admin checks raise TypeError if isinstance() receives a non-class → Admin checks raise TypeError if issubclass() receives a non-class |
---|
comment:3 by , 6 years ago
Cc: | added |
---|
comment:4 by , 6 years ago
Hi David,
I see this ticket is pending for a while. I would help to like out if you're not actively working on this one anymore.
comment:5 by , 6 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:7 by , 6 years ago
Triage Stage: | Accepted → Ready for checkin |
---|
Yep. Updated patch looks good.
comment:8 by , 6 years ago
Triage Stage: | Ready for checkin → Accepted |
---|
Ooops, I misinterpreted the history from the previous PR. A bit more to do here.
comment:9 by , 6 years ago
Triage Stage: | Accepted → Ready for checkin |
---|
PR updated addressing all the reviews.
The ticket is quiet for three months.
I read the PR and, only a function name is in a discussion.
I think the ticket was forgotten.