Created
July 18, 2016 17:03
-
-
Save amontalenti/4da18473ca2384e233f34d0dd105958f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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