[New-bugs-announce] [issue35509] Unable to inherit from logging.Formatter

Chih-Hsuan Yen report at bugs.python.org
Sat Dec 15 07:07:48 EST 2018

New submission from Chih-Hsuan Yen <yen at chyen.cc>:

The following script runs fine on Python 3.7.1 but not on master (f5107dfd42).

import logging

class Foo(logging.Formatter):
    def __init__(self):


The output is:

Traceback (most recent call last):
  File "t.py", line 9, in <module>
  File "t.py", line 6, in __init__
  File "/usr/lib/python3.8/logging/__init__.py", line 589, in __init__
  File "/usr/lib/python3.8/logging/__init__.py", line 441, in validate
    if not self.validation_pattern.search(self._fmt):
TypeError: expected string or bytes-like object

Most likely there's something wrong in the newly-added validation step (issue34844).

/cc the primary reviewer of the aforementioned patch.

components: Library (Lib)
messages: 331900
nosy: vinay.sajip, yan12125
priority: normal
severity: normal
status: open
title: Unable to inherit from logging.Formatter
type: behavior
versions: Python 3.8

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list