Repository navigation
Commit e0512a6
committed
Use skip_file_prefixes for guess_type() deprecation
`mimetypes.guess_type()` wraps `mimetypes.MimeType.guess_type()`, and we
want an appropriate warning emitted for both callpaths. However, the
stack depth is different for these two cases.
In order to get appropriate warnings, pass `skip_file_prefixes` to skip
the `mimetypes` module and `stacklevel=1` to force the warning to be
emitted at the level of the caller into `mimetypes`.
This requires `warnings._deprecated` to gain support for
`skip_file_prefixes` as a passthrough argument for `warn()`.1 parent f9b213e commit e0512a6
2 files changed
Lines changed: 5 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
874 | 874 | | |
875 | 875 | | |
876 | 876 | | |
877 | | - | |
| 877 | + | |
878 | 878 | | |
879 | 879 | | |
880 | 880 | | |
| |||
890 | 890 | | |
891 | 891 | | |
892 | 892 | | |
893 | | - | |
| 893 | + | |
| 894 | + | |
894 | 895 | | |
895 | 896 | | |
896 | 897 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
151 | 151 | | |
152 | 152 | | |
153 | 153 | | |
154 | | - | |
| 154 | + | |
| 155 | + | |
155 | 156 | | |
156 | 157 | | |
157 | 158 | | |
| |||
0 commit comments