This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Improve error message for "character buffer objects"
Type: Stage: patch review
Components: Interpreter Core Versions: Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: python-dev, rhettinger
Priority: normal Keywords: patch

Created on 2015-10-06 16:43 by rhettinger, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
better_error_message.diff rhettinger, 2015-10-06 16:43 Patch
Messages (3)
msg252408 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2015-10-06 16:46
Python 2.7.10+ (2.7:fc6d62db8d42+, Oct  6 2015, 11:55:10) 
[GCC 4.2.1 Compatible Apple LLVM 7.0.0 (clang-700.0.72)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> s = 'the tale of two cities'
>>> s.count(('a', 'z'))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: expected a character buffer object (such as a string)

   new text ---------------------------------^^^^^^^^^^^^^^^^^^^
msg252409 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2015-10-06 17:02
Another alternative
-------------------

TypeError: expected a string or other character buffer object
msg252581 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2015-10-09 01:14
New changeset 4d1bd86d3bbd by Raymond Hettinger in branch '2.7':
Issue #25326:  Improve an obscure error message.
https://hg.python.org/cpython/rev/4d1bd86d3bbd
History
Date User Action Args
2022-04-11 14:58:22adminsetgithub: 69513
2015-10-09 01:30:08rhettingersetstatus: open -> closed
resolution: fixed
2015-10-09 01:14:23python-devsetnosy: + python-dev
messages: + msg252581
2015-10-06 17:02:11rhettingersetmessages: + msg252409
2015-10-06 16:46:13rhettingersetmessages: + msg252408
2015-10-06 16:43:41rhettingercreate