Skip to content

Instantly share code, notes, and snippets.

@amontalenti
Created July 18, 2016 17:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amontalenti/4da18473ca2384e233f34d0dd105958f to your computer and use it in GitHub Desktop.
Save amontalenti/4da18473ca2384e233f34d0dd105958f to your computer and use it in GitHub Desktop.
class BadStr(str):
def __str__(self):
berak
def strip(self):
return self
import sys
# surprisingly, no exception thrown for this
sys.stdout.write(BadStr())
import logging
logging.basicConfig()
log = logging.getLogger("basic")
log.setLevel(logging.DEBUG)
# exception thrown here because of __str__ implementation
log.info(BadStr())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment