Skip to content
Snippets Groups Projects
Commit 916627e1 authored by vlorentz's avatar vlorentz
Browse files

type_validator: Re-allow subclasses

The previous replaced attrs-strict's type validator with our own,
stricter and faster, validator.

However, the strictness can be a burden in other packages;
for example, swh-storage tests rely on it to insert dummy data that raises
exception when accessed, and it would be hard to do while using the exact
expected type.

This commit reverts the strict behavior, but keeps the performance
optimization, by always checking with type equality, but in case type
equality fails (which would raise an error before this commit), it gives
the value a 'second chance', by trying isinstance.

This means that, outside tests, isinstance should not be used at all,
or very rarely.
parent 734b0812
No related branches found
No related tags found
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment