Mark Dickinson dicki...@gmail.com added the comment:
Closing this; it's too late for Python 2.7.
--
status: open - closed
versions: -Python 2.7
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1023290
Mark Dickinson dicki...@gmail.com added the comment:
The backport wasn't as straightforward as I'd hoped, and we've pretty much run
out of time for 2.7.
One issue is that long.from_bytes(b, ...) converts b to bytes type using the
equivalent of bytes(b). This doesn't work well in 2.7
Mark Dickinson dicki...@gmail.com added the comment:
A couple of questions for the backport:
(1) should the 'signed' parameter remain keyword-only in 2.7? I'd say yes, to
avoid issues when forward-porting code from 2.7 to 3.2. On the other hand, 2.7
doesn't support keyword-only arguments at
Alexandre Vassalotti alexan...@peadrop.com added the comment:
Mark Dickinson added the comment:
(1) should the 'signed' parameter remain keyword-only in 2.7?
We should keep it as a keyword-only argument. Also, issue #1745 might bring
keyword-only arguments to 2.7.
(2) When specifying the
Mark Dickinson dicki...@gmail.com added the comment:
Thanks, Alexandre! Agreed on both points. I don't really want to allow u'big'
and u'little', but I think that's just my laziness talking. (Apart from that,
I have a working patch.)
There's some precedent for not allowing the unicode
Mark Dickinson dicki...@gmail.com added the comment:
I'd still like to see this backported to 2.7; if no-one else is interested in
doing the backport, I'll try to find time before the betas.
(Alexandre, if you want to do the backport, please do steal the issue from me.)
--
assignee:
Changes by Brian Curtin cur...@acm.org:
--
nosy: +brian.curtin
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1023290
___
___
Python-bugs-list
Alexandre Vassalotti alexan...@peadrop.com added the comment:
Committed in r77394. Thank you for the good reviews!
--
resolution: - accepted
stage: patch review - committed/rejected
status: open - closed
___
Python tracker rep...@bugs.python.org
Mark Dickinson dicki...@gmail.com added the comment:
Looks good to me, too.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1023290
___
___
Mark Dickinson dicki...@gmail.com added the comment:
All tests pass on OS X 10.5/Intel, except that I'm still getting the issue
6687 test failure. This needs to be resolved somehow before committing.
--
___
Python tracker rep...@bugs.python.org
Antoine Pitrou pit...@free.fr added the comment:
The following example is strange:
+ int.from_bytes([255, 0, 0], byteorder='big')
+-65536
Isn't `signed` supposed to be False by default?
The rest looks ok.
--
___
Python tracker
Alexandre Vassalotti alexan...@peadrop.com added the comment:
Here's an updated patch.
- Renamed tobytes() to to_bytes() and frombytes() to from_bytes().
- Moved the changes to pickle to a different patch.
- Made the NULL-checks more consistent with the rest of long's code.
- Fixed the type
Mark Dickinson dicki...@gmail.com added the comment:
The patch looks great! Some comments:
- I think the type check for length_obj in long_tobytes should be more
lenient: I'd suggest a PyIndex_Check and PyNumber_AsSsize_t conversion
instead of the PyLong_Check. Or just use 'n' instead of
Alexandre Vassalotti alexan...@peadrop.com added the comment:
Here's a new patch incorporating the suggestions I received on python-ideas.
Notable changes are:
- The name of the methods have been changed to int.tobytes() and
int.frombytes().
- The tri-state `little_endian' argument has
Martin v. Löwis mar...@v.loewis.de added the comment:
Before this gets applied, a (preferably final) decision should be made
whether it should be provided for 2.7 as well. Personally, it would be
fine with me either way.
--
___
Python tracker
Antoine Pitrou pit...@free.fr added the comment:
Alexandre:
Notable changes are:
- The name of the methods have been changed to int.tobytes() and
int.frombytes().
Without wanting to bikeshed, I think these methods should take
underscores as other int methods already do. This kind of
16 matches
Mail list logo