[issue25766] __bytes__ doesn't work for str subclasses

2015-12-20 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker ___ _

[issue25766] __bytes__ doesn't work for str subclasses

2015-12-20 Thread Roundup Robot
Roundup Robot added the comment: New changeset 1e54adef4064 by Serhiy Storchaka in branch '3.5': Issue #25766: Special method __bytes__() now works in str subclasses. https://hg.python.org/cpython/rev/1e54adef4064 New changeset af0b95fb1c19 by Serhiy Storchaka in branch 'default': Issue #25766:

[issue25766] __bytes__ doesn't work for str subclasses

2015-12-20 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- assignee: -> serhiy.storchaka versions: -Python 3.4 ___ Python tracker ___ ___ Python-bugs-list mai

[issue25766] __bytes__ doesn't work for str subclasses

2015-12-14 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Other conversion special methods work in str subclass. >>> class I(str): ... def __int__(self): ... return 42 ... >>> int(I('35')) 42 >>> int(I('35'), 8) 29 -- nosy: +mark.dickinson, skrah ___ Python t

[issue25766] __bytes__ doesn't work for str subclasses

2015-11-29 Thread Serhiy Storchaka
New submission from Serhiy Storchaka: Special __bytes__ method is purposed for converting to bytes with bytes constructor (as well as __str__ and __float__ for str and float). But this doesn't work if the class is a subclass of str. >>> class X: ... def __bytes__(self): ... return