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.

Title: bytearray.translate() should support None first argument
Type: behavior Stage: patch review
Components: Interpreter Core Versions: Python 3.1, Python 2.7
Status: closed Resolution: accepted
Dependencies: Superseder:
Assigned To: georg.brandl Nosy List: benjamin.peterson, georg.brandl, pitrou
Priority: normal Keywords: patch

Created on 2008-12-27 23:28 by georg.brandl, last changed 2022-04-11 14:56 by admin. This issue is now closed.

File name Uploaded Description Edit
bytearray-translate.diff georg.brandl, 2008-12-27 23:28
Messages (4)
msg78390 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2008-12-27 23:28
bytes.translate() does. Patch attached.
msg78392 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2008-12-28 01:06
Looks good to me. I don't think it should be applied to 3.0, though.
msg78396 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2008-12-28 10:40
Looks like there's a problem:

>>> bytearray().translate(None, None)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: Type NoneType doesn't support the buffer API
>>> bytearray().translate(None, None)
Erreur de segmentation

Also, the patch should probably be backported to trunk.
msg78397 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2008-12-28 11:55
You're right (but the segfault isn't introduced by the patch).

Fixed segfault in 3.0 and 2.6 in r67975 and r67977.
Applied path in 3k and trunk in r67974 and r67976.
Date User Action Args
2022-04-11 14:56:43adminsetgithub: 49009
2008-12-28 11:55:39georg.brandlsetstatus: open -> closed
assignee: pitrou -> georg.brandl
resolution: accepted
messages: + msg78397
2008-12-28 10:40:26pitrousetmessages: + msg78396
versions: + Python 2.7, - Python 3.0
2008-12-28 01:06:12benjamin.petersonsetnosy: + benjamin.peterson
messages: + msg78392
2008-12-27 23:28:50georg.brandlcreate