[New-bugs-announce] [issue40736] better message for re.search TypeError ("expected string or bytes-like object")

Chris Jerdonek report at bugs.python.org
Fri May 22 17:12:55 EDT 2020


New submission from Chris Jerdonek <chris.jerdonek at gmail.com>:

This TypeError could be a bit better:

"/Users/runner/runners/2.262.1/work/cpython/cpython/Lib/test/test_nntplib.py", line 293, in test_with_statement
    if re.search(r'(?i)KEY.TOO.SMALL', ssl_err.reason):
  File "/Users/runner/runners/2.262.1/work/cpython/cpython/Lib/re.py", line 201, in search
    return _compile(pattern, flags).search(string)
TypeError: expected string or bytes-like object

It just says "expected string or bytes-like object" but could include what type it found.

----------
components: Library (Lib)
messages: 369652
nosy: chris.jerdonek
priority: normal
severity: normal
status: open
title: better message for re.search TypeError ("expected string or bytes-like object")
type: enhancement
versions: Python 3.10

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue40736>
_______________________________________


More information about the New-bugs-announce mailing list