[issue20284] patch to implement PEP 461 (%-interpolation for bytes)

2015-01-29 Thread Ethan Furman

Changes by Ethan Furman et...@stoneleaf.us:


--
resolution:  - fixed
stage: patch review - resolved
status: open - closed

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



[issue20284] patch to implement PEP 461 (%-interpolation for bytes)

2015-01-26 Thread Ethan Furman

Ethan Furman added the comment:

it does seem a bit odd -- on the other hand, %s is an alias for %b, is 
deprecated for new 3-only code, and this might help serve as a reminder of that.

Or we could fix it.  ;)

--

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



[issue20284] patch to implement PEP 461 (%-interpolation for bytes)

2015-01-26 Thread Roundup Robot

Roundup Robot added the comment:

New changeset db7ec64aac39 by Victor Stinner in branch 'default':
Issue #20284: Fix a compilation warning on Windows
https://hg.python.org/cpython/rev/db7ec64aac39

--

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



[issue20284] patch to implement PEP 461 (%-interpolation for bytes)

2015-01-26 Thread STINNER Victor

STINNER Victor added the comment:

It's strange that %s format raises an error about the %b format:

 b's? %s' % 1
Traceback (most recent call last):
  File stdin, line 1, in module
TypeError: %b requires bytes, or an object that implements __bytes__, not 'int'

--

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



[issue20284] patch to implement PEP 461 (%-interpolation for bytes)

2015-01-23 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 8d802fb6ae32 by Ethan Furman in branch 'default':
Issue20284: Implement PEP461
https://hg.python.org/cpython/rev/8d802fb6ae32

--
nosy: +python-dev

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



[issue20284] patch to implement PEP 461 (%-interpolation for bytes)

2015-01-18 Thread STINNER Victor

STINNER Victor added the comment:

I will not have to work on optimization before the alpha 1 (February 8, 2015).

Ethan: just commit your patch when you consider that it's ready to be
merged, we will have time to refactor and enhance the code later.

IMO it's more important to have the feature in alpha 1 than having
perfect code, because some developer are waiting for this feature and
will have more time to provide feedback.

--

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



[issue20284] patch to implement PEP 461 (%-interpolation for bytes)

2015-01-18 Thread Ethan Furman

Ethan Furman added the comment:

Here's the patch -- the code for % and %= is in place for bytes and bytearray;  
I still need to get the doc patch done.  I'll commit Wednesday-ish barring 
problems.

Big question


Background
--
There is a Python C ABI function called PyBytes_FromFormat which is used to 
create bytes objects using the %-interpolation format (it takes a c string and 
none-or-many c args).

Actual Question
---
Should PyBytes_FromFormat also support the new codes of %a and %b ?

My Thoughts
---
Writing things down is good!  %a and %b are both for Python level arguments, 
not C-level arguments, so %a and %b would make no sense.

--
Added file: http://bugs.python.org/file37766/issue20284.stoneleaf.04.patch

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



[issue20284] patch to implement PEP 461 (%-interpolation for bytes)

2015-01-18 Thread Ethan Furman

Ethan Furman added the comment:

Thanks, Victor, for the feedback.

I was able to figure out some more of the C side thanks to Georg, and I think 
the code is looking pretty good.

There may be room for optimization by having the bytes code call the unicode 
implementation for more of the conversions (currently it's only using the 
unicode fromlong function), but the docs should happen before that.  ;)

--

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



[issue20284] patch to implement PEP 461 (%-interpolation for bytes)

2015-01-17 Thread Ethan Furman

Ethan Furman added the comment:

Better patch, along the lines of my original thought:

  - byarrayformat converts bytearray to bytes
  - calls bytesformat (now _PyBytes_Format) to do the heavy lifting
  - uses PyByteArray_FromObject to tranform back to bytearray

Now working on in-place format.

--
Added file: http://bugs.python.org/file37745/issue20284.stoneleaf.03.patch

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



[issue20284] patch to implement PEP 461 (%-interpolation for bytes)

2015-01-13 Thread Ethan Furman

Ethan Furman added the comment:

Removed the new ABI functions, all new functions are static.

Duplicated bytes code in bytearray.

in-place interpolation returns new bytearray at this point.

I'll work on getting in-place working, but otherwise I'll commit this in a week 
so we have something in for the first alpha.

--
stage: needs patch - patch review
Added file: http://bugs.python.org/file37703/issue20284.stoneleaf.02.patch

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



[issue20284] patch to implement PEP 461 (%-interpolation for bytes)

2015-01-12 Thread Ethan Furman

Ethan Furman added the comment:

I've been digging into this over the last week and come to the realization that 
I won't be able to finish this patch.  My apologies.

Victor, can you take over?  I would appreciate it.

The tests I have written are only for the Python side.  The patch I was working 
on (inherited from Niel and the Python 2 code base) also added a couple C ABI 
functions -- do we want/need these?  How do we write tests for them?

--
stage: patch review - needs patch

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



[issue20284] patch to implement PEP 461 (%-interpolation for bytes)

2015-01-06 Thread Nick Coghlan

Nick Coghlan added the comment:

With the first alpha next month, unless we hear otherwise from Ethan in the 
next day or two, I'd suggest going ahead with the implementation. We can always 
tweak it during the alpha cycle if there are specific details he'd like to see 
changed.

--

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



[issue20284] patch to implement PEP 461 (%-interpolation for bytes)

2015-01-06 Thread STINNER Victor

STINNER Victor added the comment:

Ethan, do you have a public repository? If no, you can for example
fork CPython: click on Server-side clone at
https://hg.python.org/cpython/

--

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



[issue20284] patch to implement PEP 461 (%-interpolation for bytes)

2015-01-06 Thread Ethan Furman

Ethan Furman added the comment:

Here is what I have so far:

  - complete tests for bytes and bytearry (bytearray currently commented out at 
line 71)
  - pep461 implemented for bytes

This is basically an adaptation of the 2.7 code for str, adjusted appropriately.

I was planning on having bytearray convert to bytes, then call the bytes code, 
then integrate the results back into the existing bytearray (for %=) or create 
and return a new bytearray (for %).

I can easily believe this is not the most efficient way to do it.  ;)

I should have the bytearray portion done, if not this weekend, then by the 
following weekend.

I have no objections if Victor wants to combine and optimize with the unicode 
implementation (and no need to wait for me to finish the bytearray portion).

--
Added file: http://bugs.python.org/file37616/issue20284.stoneleaf.01.patch

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



[issue20284] patch to implement PEP 461 (%-interpolation for bytes)

2015-01-06 Thread Ethan Furman

Ethan Furman added the comment:

Sorry, no.  And time is scarce at the moment so figuring out server-side clones 
will have to wait as well.

I uploaded the patch of what I have so far -- hopefully that will be helpful.

Also attaching patch with just the tests.

--
Added file: 
http://bugs.python.org/file37617/issue20284.stoneleaf.tests_only.01.patch

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



[issue20284] patch to implement PEP 461 (%-interpolation for bytes)

2015-01-05 Thread STINNER Victor

STINNER Victor added the comment:

Hi. I proposed twice to Ethan to implement the PEP 461, but he replied that he 
wants to implement it. So, what's the status of the implementation?

--

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



[issue20284] patch to implement PEP 461 (%-interpolation for bytes)

2015-01-05 Thread STINNER Victor

STINNER Victor added the comment:

I would be nice to share as much code as possible with the Unicode 
implementation. My idea was to add a _PyBytesWriter API, very close to the 
_PyUnicodeWriter, to share code. Old patch implementing the _PyBytesWriter 
API: issue #17742 (rejected because it was less efficient, the compiler 
produces less efficient machine code).

--

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



[issue20284] patch to implement PEP 461 (%-interpolation for bytes)

2014-07-26 Thread Nick Coghlan

Nick Coghlan added the comment:

Just noting I'm working on some significant updates to the bytes and bytearray 
docs in issue 21777. I'll try to get that ready for review and merged 
relatively soon, so the docs for this can build on top of those changes.

--
nosy: +ncoghlan

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



[issue20284] patch to implement PEP 461 (%-interpolation for bytes)

2014-03-27 Thread Ethan Furman

Ethan Furman added the comment:

PEP 461 has been accepted.  I'll look over the code soon.

--
assignee:  - ethan.furman

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



[issue20284] patch to implement PEP 461 (%-interpolation for bytes)

2014-02-10 Thread Martin Panter

Changes by Martin Panter vadmium...@gmail.com:


--
nosy: +vadmium

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



[issue20284] patch to implement PEP 461 (%-interpolation for bytes)

2014-01-20 Thread Neil Schemenauer

Neil Schemenauer added the comment:

I've updated my patch into a sequence, the first of which implements PEP 461.

02-code-a.patch adds support for %a (ascii() on arg)

03-py2-flag.patch makes %s and %r behave similar to Python 2 if a command
line flag is provided to the interpreter

04-py-eq.patch makes the command line flag also enable comparision between 
bytes() and str() (warning is generated).

--
title: patch to implement %-interpolation for bytes (roughly PEP 461) - patch 
to implement PEP 461 (%-interpolation for bytes)
Added file: http://bugs.python.org/file33574/01-pep461.patch

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



[issue20284] patch to implement PEP 461 (%-interpolation for bytes)

2014-01-20 Thread Neil Schemenauer

Changes by Neil Schemenauer nas-pyt...@arctrix.com:


Added file: http://bugs.python.org/file33575/02-code-a.patch

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



[issue20284] patch to implement PEP 461 (%-interpolation for bytes)

2014-01-20 Thread Neil Schemenauer

Changes by Neil Schemenauer nas-pyt...@arctrix.com:


Added file: http://bugs.python.org/file33576/03-py2-flag.patch

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



[issue20284] patch to implement PEP 461 (%-interpolation for bytes)

2014-01-20 Thread Neil Schemenauer

Changes by Neil Schemenauer nas-pyt...@arctrix.com:


Added file: http://bugs.python.org/file33577/04-py2-eq.patch

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



[issue20284] patch to implement PEP 461 (%-interpolation for bytes)

2014-01-20 Thread Arfrever Frehtes Taifersar Arahesis

Changes by Arfrever Frehtes Taifersar Arahesis arfrever@gmail.com:


--
nosy: +Arfrever

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