[New-bugs-announce] [issue36582] collections.UserString encode method returns a string

Trey Hunner report at bugs.python.org
Tue Apr 9 19:38:53 EDT 2019


New submission from Trey Hunner <trey at truthful.technology>:

It looks like the encode method for UserString incorrectly wraps its return value in a str call.

```
>>> from collections import UserString
>>> UserString("hello").encode('utf-8') == b'hello'
False
>>> UserString("hello").encode('utf-8')
"b'hello'"
>>> type(UserString("hello").encode('utf-8'))
<class 'collections.UserString'>
```

----------
components: Library (Lib)
messages: 339818
nosy: trey
priority: normal
severity: normal
status: open
title: collections.UserString encode method returns a string
versions: Python 3.7

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


More information about the New-bugs-announce mailing list