Edward O added the comment:
Here is a workaround for subclasses (23-compatible):
--- start code ---
class MyDate(datetime):
@classmethod
def fromDT(cls, d):
:type d: datetime
return cls(d.year, d.month, d.day, d.hour, d.minute, d.second,
d.microsecond, d.tzinfo
Changes by Edward O edoubray...@gmail.com:
--
nosy: +eddygeek
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20371
___
___
Python-bugs-list mailing
Changes by Edward O edoubray...@gmail.com:
--
nosy: +BreamoreBoy
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22294
___
___
Python-bugs-list
Edward O added the comment:
The arguments for fixing:
* int subclasses overriding str is a very common usecase for enums (so much so
that it was added to stdlib in 3.4).
* json supporting a standard type of a subsequent python version, though not
mandatory, would be beneficial to Py2/Py3
Changes by Edward O edoubray...@gmail.com:
--
nosy: +eddygeek
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7434
___
___
Python-bugs-list mailing
New submission from Edward O:
_make_iterencode in python2.7/json/encoder.py encodes custom enum types
incorrectly (the label will be printed without '') because of these lines
(line 320 in 2.7.6):
elif isinstance(value, (int, long)):
yield buf + str(value)
in constract
Changes by Edward O edoubray...@gmail.com:
--
title: json encoding broken for - 2.7 json encoding broken for enums
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22297
New submission from Edward O:
This is a patch for issues similar to #16573
With this patch, the following new tests are now unchanged:
r = dict(zip(s, range(len(s))), **d)
r = len(filter(attrgetter('t'), self.a))
r = min(map(methodcaller('f'), self.a))
max(map(node.id, self.nodes)) + 1
Changes by Edward O edoubray...@gmail.com:
--
nosy: +benjamin.peterson
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22294
___
___
Python-bugs
Edward O added the comment:
The code works when using encoding='bytes'. Thanks Tim for the suggestion.
So this is not a bug, but is there any sense in having encoding='ASCII' by
default in pickle ?
--
___
Python tracker rep...@bugs.python.org
http
10 matches
Mail list logo