Changes between Initial Version and Version 1 of Ticket #29282


Ignore:
Timestamp:
Apr 2, 2018, 11:43:54 AM (7 years ago)
Author:
Tim Graham
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #29282

    • Property Patch needs improvement set
    • Property Triage Stage UnreviewedAccepted
    • Property Summary Admin Checks May Raise TypeErrorAdmin checks raise TypeError if isinstance() receives a non-class
  • Ticket #29282 – Description

    initial v1  
    1 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. Providing a PR that 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.
     1Admin 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 [https://github.com/django/django/pull/9844 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.
Back to Top