[issue29714] can't interpolate byte string with \x00 before replacement identifier

2017-03-31 Thread Donald Stufft

Changes by Donald Stufft :


--
pull_requests: +998

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29714] can't interpolate byte string with \x00 before replacement identifier

2017-03-24 Thread Xiang Zhang

Xiang Zhang added the comment:


New changeset df6d7b406f3d1b2e4e2014751bfa25574c4df222 by Xiang Zhang in branch 
'3.6':
[3.6] bpo-29714: Fix a regression that bytes format may fail when containing 
zero bytes inside. (GH-504)
https://github.com/python/cpython/commit/df6d7b406f3d1b2e4e2014751bfa25574c4df222


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29714] can't interpolate byte string with \x00 before replacement identifier

2017-03-24 Thread Xiang Zhang

Xiang Zhang added the comment:


New changeset b76ad5121e2cfa89d6476d700cbcb65b7ffc39ac by Xiang Zhang in branch 
'master':
bpo-29714:  Fix a regression that bytes format may fail when containing zero 
bytes inside. (GH-499)
https://github.com/python/cpython/commit/b76ad5121e2cfa89d6476d700cbcb65b7ffc39ac


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29714] can't interpolate byte string with \x00 before replacement identifier

2017-03-17 Thread Larry Hastings

Changes by Larry Hastings :


--
pull_requests: +616

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29714] can't interpolate byte string with \x00 before replacement identifier

2017-03-06 Thread STINNER Victor

STINNER Victor added the comment:

Xiang Zhang added the comment:
> I think no. String is not affected now and its code uses related macros so I 
> don't think it could suffer possible regression.

Regressions are not something "expected", shit happens, all the time.
Unexpected corner cases are common :-)

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29714] can't interpolate byte string with \x00 before replacement identifier

2017-03-06 Thread Xiang Zhang

Xiang Zhang added the comment:

I think no. String is not affected now and its code uses related macros so I 
don't think it could suffer possible regression.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29714] can't interpolate byte string with \x00 before replacement identifier

2017-03-06 Thread STINNER Victor

STINNER Victor added the comment:

Oh, and thank you for adding new unit tests ;-) Do we need similar unit tests 
for str%args and str.format()?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29714] can't interpolate byte string with \x00 before replacement identifier

2017-03-06 Thread STINNER Victor

STINNER Victor added the comment:

I confirm that I introduced the regression with the commit 
fa7762ec066aa3632a25b6a52bb7597b8f17c2f3: "Issue #25349: Optimize bytes % args 
using the new private _PyBytesWriter API". Sorry about that, I always forget 
that str*() functions should not be used in Python since we support embedded 
null bytes :-/ It seems like only Python 3.6.0 release is affected.

"git tag --contains fa7762ec066aa3632a25b6a52bb7597b8f17c2f3" also returns 
v3.5.2, but I don't understand since I only pushed my change to the 3.6 
branch...

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29714] can't interpolate byte string with \x00 before replacement identifier

2017-03-06 Thread Xiang Zhang

Xiang Zhang added the comment:

Thanks for the report, Nick!

--
resolution:  -> fixed
stage: needs patch -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29714] can't interpolate byte string with \x00 before replacement identifier

2017-03-06 Thread Xiang Zhang

Changes by Xiang Zhang :


--
pull_requests: +412

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29714] can't interpolate byte string with \x00 before replacement identifier

2017-03-05 Thread Xiang Zhang

Changes by Xiang Zhang :


--
pull_requests: +407

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29714] can't interpolate byte string with \x00 before replacement identifier

2017-03-05 Thread Xiang Zhang

Xiang Zhang added the comment:

The problem is now _PyBytes_FormatEx uses strchr to sniff %. It should use 
memchr instead.

--
assignee:  -> xiang.zhang
nosy: +xiang.zhang

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29714] can't interpolate byte string with \x00 before replacement identifier

2017-03-03 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Could this be due to using _PyBytesWriter?

--
keywords: +3.6regression
nosy: +haypo, serhiy.storchaka
stage:  -> needs patch
type:  -> behavior
versions: +Python 3.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29714] can't interpolate byte string with \x00 before replacement identifier

2017-03-03 Thread Nick Huber

New submission from Nick Huber:

Python 3.6.0 (default, Mar  3 2017, 00:15:36) 
[GCC 4.9.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> b'a\x00%i' % 1
Traceback (most recent call last):
  File "", line 1, in 
TypeError: not all arguments converted during bytes formatting
>>> b'a%i' % 1
b'a1'
>>> b'a%i\x00' % 1
b'a1\x00'


On python3.5, this works in all the scenarios

Python 3.5.1 (default, Jan 14 2017, 03:58:20) 
[GCC 4.9.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> b'a\x00%i' % 1
b'a\x001'
>>> b'a%i' % 1
b'a1'
>>> b'a%i\x00' % 1
b'a1\x00'

--
components: Interpreter Core
messages: 288912
nosy: Nick Huber
priority: normal
severity: normal
status: open
title: can't interpolate byte string with \x00 before replacement identifier
versions: Python 3.6

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com