[issue26766] Redundant check in bytearray_mod

2016-04-15 Thread Berker Peksag
Berker Peksag added the comment: Thanks! More examples: Python 3.6: >>> bytearray(b'hello %b') % b"world" bytearray(b'hello world') >>> bytearray(b'hello %b') % b"wor" b'hello wor' Python 3.5: >>> bytearray(b'hello %b') % b"world" bytearray(b'hello world') >>> bytearray(b'hello %b') % b"wor"

[issue26766] Redundant check in bytearray_mod

2016-04-15 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Python 3.5: >>> bytearray(b'%d') % 42 bytearray(b'42') Python 3.6: >>> bytearray(b'%d') % 42 b'42' -- ___ Python tracker

[issue26766] Redundant check in bytearray_mod

2016-04-15 Thread Berker Peksag
Berker Peksag added the comment: Do you have an example code? It returns bytearray for me in both 3.5 and 3.6. use_bytearray parameter of _PyBytes_FormatEx() is 1 in bytearray_mod(). -- ___ Python tracker

[issue26766] Redundant check in bytearray_mod

2016-04-15 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: And may be bytearray_mod in 3.6 is not correct. In 3.5 it returns bytearray, in 3.6 it returns bytes. -- ___ Python tracker

[issue26766] Redundant check in bytearray_mod

2016-04-15 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Yes, I noticed this, but left for future (post-issue26765) refactoring. The patch LGTM, but notice Victor's comment to issue26764. -- nosy: +ethan.furman, haypo stage: patch review -> commit review ___ Python

[issue26766] Redundant check in bytearray_mod

2016-04-15 Thread Berker Peksag
New submission from Berker Peksag: I noticed this while looking at issue 26764. bytearray_mod() and bytearray_format() both have checks for PyByteArray_Check(v). The check in bytearray_format() looks redundant to me. Here is a patch. -- components: Interpreter Core files: