classification
Title: bytearray.translate() should support None first argument
Type: behavior Stage: patch review
Components: Interpreter Core Versions: Python 3.1, Python 2.7
process
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 2008-12-28 11:55 by georg.brandl. This issue is now closed.

Files
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.
History
Date User Action Args
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