On this page
builtins.BytesWarning
Prev: builtins.bytes | Up: builtins | Next: builtins.callable
Rel: builtins.abs, builtins.aiter, builtins.all, builtins.anext
Ref: docs.python.org โ builtins.BytesWarning
Tags: #public #python3 #stdlib #builtins
Import
import builtins
from builtins import BytesWarning
Signature & Overview
builtins.BytesWarning(...)
Base class for warnings about bytes and buffer related problems, mostly related to conversion from str or comparing to str.
Methods & Attributes
BytesWarning.add_note(self, note, /)โ Add a note to the exceptionBytesWarning.with_traceback(self, tb, /)โ Set self.traceback to tb and return self.
Usage
assert issubclass(BytesWarning, Warning)
Gotchas
- Enable with
python3 -b(or-bbto raise): Catches accidentalb"abc" == "abc"orstr(b"abc")bugs.
REPL Inspect
from builtins import BytesWarning
help(BytesWarning)
Linked from
Related notes
- tuts/python3/stdlib_module/builtins/bytes Linked here; links to this page; shared tags: #builtins, #stdlib
- tuts/python3/stdlib_module/builtins/callable Linked here; links to this page; shared tags: #builtins, #stdlib
- tuts/python3/stdlib_module/builtins Linked here; links to this page; shared tags: #stdlib
- tuts/python3/stdlib_module/builtins/abs Linked here; shared tags: #builtins, #stdlib
- tuts/python3/stdlib_module/builtins/aiter Linked here; shared tags: #builtins, #stdlib
- tuts/python3/stdlib_module/builtins/all Linked here; shared tags: #builtins, #stdlib
- tuts/python3/stdlib_module/builtins/anext Linked here; shared tags: #builtins, #stdlib
- tuts/python3/stdlib_module/builtins/any shared tags: #builtins, #stdlib
- tuts/python3/stdlib_module/builtins/ArithmeticError shared tags: #builtins, #stdlib
- tuts/python3/stdlib_module/builtins/ascii shared tags: #builtins, #stdlib