[pypy-dev] python 2 and python 3 sharing an interpreter?
Stefan Behnel
stefan_ml at behnel.de
Fri Dec 9 16:23:29 CET 2011
Martijn Faassen, 08.12.2011 20:12:
> On 12/08/2011 01:54 PM, Stefan Behnel wrote:
>> So, assuming that Martijn was actually referring to legacy code, I agree
>> that it won't solve the problem at hand. But that doesn't mean it would
>> be impossible to benefit from it.
>
> Not sure what you mean here - I was referring to using existing Python 2
> code in Python 3 projects, and vice versa.
Sure, and I meant that you'd probably still have to modify (or rather fix)
the code in order to make the integration work, if only to make it use
proper bytes or unicode strings where data or text is passed into the other
environment. The runtime can only provide a default adaptation here, and
even if the string type behaviour is completely inherited from the source
environment, you could still run into the Py2-UnicodeDecodeError hell on
the other side when passing around text in encoded byte strings "because it
worked in my local Py2 installation".
> The Cython experience is definitely interesting: it's good to know there is
> some experience with this problem. My hope is that you can come up with
> some sensible rules and fix the rest with a few annotations (in a separate
> module informing the rest, or included in the codebase itself) for the
> ambiguous cases.
It would definitely require a bit of "six" foo, but most likely less than
without the second Python environment because the code only needs bug
fixing, not adapting to new (builtin) semantics and syntax.
Stefan
More information about the pypy-dev
mailing list