[issue14886] json C vs pure-python implementation difference

2018-08-17 Thread Stefan Behnel
Stefan Behnel added the comment: FWIW, the C implementation of the sequence encoder uses PySequence_Fast(), so adding a lower priority instance check that calls the same encoding function would solve this.

[issue14886] json C vs pure-python implementation difference

2018-08-17 Thread Stéphane Wirtel
Stéphane Wirtel added the comment: We have received a notification about this bug for 3.5 -- nosy: +matrixise versions: +Python 3.5, Python 3.6, Python 3.7, Python 3.8 -Python 2.7, Python 3.2, Python 3.3 ___ Python tracker

[issue14886] json C vs pure-python implementation difference

2012-09-28 Thread Thomas Lee
Thomas Lee added the comment: FWIW, I think Mark's right here. I'm +1 on the implementations being consistent. Seems like a potentially nasty surprise if you move from one implementation to the other and, lacking awareness of this quirk, design your algorithm around semantics. I think this

[issue14886] json C vs pure-python implementation difference

2012-09-26 Thread Ezio Melotti
Changes by Ezio Melotti ezio.melo...@gmail.com: -- stage: - needs patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14886 ___ ___

[issue14886] json C vs pure-python implementation difference

2012-05-24 Thread Antoine Pitrou
Antoine Pitrou pit...@free.fr added the comment: class pseudo_list(object): __class__ = list # fake isinstance Why not inherit from list directly? Setting __class__ to something else isn't widely supported in the Python code base. It may work or may not work, depending on the API, but

[issue14886] json C vs pure-python implementation difference

2012-05-24 Thread Марк Коренберг
Марк Коренберг socketp...@gmail.com added the comment: Well, __class_ = list is my problem, but python's problem is that it uses different approaches in C and python implementation. P.S. I don't want to subclass list, as I don't want things like this: x = pseudo_list(iter(xrange(10))

[issue14886] json C vs pure-python implementation difference

2012-05-24 Thread Antoine Pitrou
Antoine Pitrou pit...@free.fr added the comment: Well, __class_ = list is my problem, but python's problem is that it uses different approaches in C and python implementation. Well, by construction a C accelerator will use the fastest method available within what the API's specification

[issue14886] json C vs pure-python implementation difference

2012-05-24 Thread Марк Коренберг
Марк Коренберг socketp...@gmail.com added the comment: Inconsistency is bother me. If I specify indent in dumps(), I will have one semantics, else other ones. Why not to fix pure-python implementation using type(o) in (list, tuple) ? This is faster too (as I think). --

[issue14886] json C vs pure-python implementation difference

2012-05-23 Thread Марк Коренберг
New submission from Марк Коренберг socketp...@gmail.com: Pure-python implementation: if isinstance(o, (list, tuple)): C implementation: if (PyList_Check(obj) || PyTuple_Check(obj)) This make real difference (!) in my code. So, please change pure-python implementation to: if

[issue14886] json C vs pure-python implementation difference

2012-05-23 Thread Марк Коренберг
Changes by Марк Коренберг socketp...@gmail.com: -- type: - behavior ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14886 ___ ___ Python-bugs-list

[issue14886] json C vs pure-python implementation difference

2012-05-23 Thread Chris Rebert
Changes by Chris Rebert pyb...@rebertia.com: -- nosy: +cvrebert ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14886 ___ ___ Python-bugs-list

[issue14886] json C vs pure-python implementation difference

2012-05-23 Thread Antoine Pitrou
Antoine Pitrou pit...@free.fr added the comment: What difference does it make? Are you using __instancecheck__ perhaps? -- nosy: +pitrou versions: -Python 3.1, Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14886

[issue14886] json C vs pure-python implementation difference

2012-05-23 Thread Марк Коренберг
Марк Коренберг socketp...@gmail.com added the comment: #!/usr/bin/python2.7 import json class pseudo_list(object): __class__ = list # fake isinstance def __init__(self, iterator): self._saved_iterator = iterator def __iter__(self): return self._saved_iterator

[issue14886] json C vs pure-python implementation difference

2012-05-23 Thread Ezio Melotti
Changes by Ezio Melotti ezio.melo...@gmail.com: -- nosy: +ezio.melotti ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14886 ___ ___

[issue14886] json C vs pure-python implementation difference

2012-05-23 Thread Alexey Smirnov
Changes by Alexey Smirnov alexey.smir...@gmx.com: -- nosy: +alexey-smirnov ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14886 ___ ___