Pulkit Goyal <7895pulkit@gmail.com> [Thu, 01 Jun 2017 01:41:34 +0530] rev 32614
py3: ensure that we don't concat bytes and str and the end result is bytes
Here obj.__module__ and obj.__name__ are str. Either we can convert them to
bytes or use an r'' and convert back to bytes when concat is done. I preferred
the later one since we are encoding only once here.
Pulkit Goyal <7895pulkit@gmail.com> [Thu, 01 Jun 2017 00:00:10 +0530] rev 32613
py3: make sure we return strings from __str__ and __repr__
On Python 3:
>>> class abc:
... def __repr__(self):
... return b'abc'
...
>>> abc()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: __repr__ returned non-string (type bytes)
>>> class abc:
... def __str__(self):
... return b'abc'
...
>>> str(abc())
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: __str__ returned non-string (type bytes)
So the __str__ and __repr__ must return strings.
Pulkit Goyal <7895pulkit@gmail.com> [Wed, 31 May 2017 23:48:52 +0530] rev 32612
py3: replace None with -1 to sort an integer array
In Python 2:
>>> ls = [4, 2, None]
>>> sorted(ls)
[None, 2, 4]
In Python 3:
>>> ls = [4, 2, None]
>>> sorted(ls)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: unorderable types: NoneType() < int()
Therefore we replaced None with -1, and the safe part is that, None and -1 are
only the keys which are used for sorting so we don't need to convert the -1's
back to None.
Pulkit Goyal <7895pulkit@gmail.com> [Wed, 31 May 2017 23:42:58 +0530] rev 32611
py3: pass str in os.sysconf()
os.sysconf() doesn't accepts bytes on Python 3. Adding r'' will make
sure b'' is not added here.
Sean Farley <sean@farley.io> [Thu, 11 May 2017 13:59:48 -0700] rev 32610
context: move dirty() to committablectx
This is a pedantic move. It should be an error if dirty() is called on a
read-only context. Based on Mads Kiilerix's and my work at the sprint.
Sean Farley <sean@farley.io> [Thu, 11 May 2017 13:51:10 -0700] rev 32609
committablectx: extra is already normalized by committablectx.__init__
Avoid doing the same work again. Based on work done by Mads Kiilerix.