[Python-porting] Installing different files on Python 2/3

Aaron Meurer asmeurer at gmail.com
Sat Jul 26 19:21:03 CEST 2014


In SymPy's compatibility file, we use

    def exec_(_code_, _globs_=None, _locs_=None):
        """Execute code in a namespace."""
        if _globs_ is None:
            frame = sys._getframe(1)
            _globs_ = frame.f_globals
            if _locs_ is None:
                _locs_ = frame.f_locals
            del frame
        elif _locs_ is None:
            _locs_ = _globs_
        exec("exec _code_ in _globs_, _locs_")

which I think is either taken from six or based off of what is in six.

Aaron Meurer

On Sat, Jul 26, 2014 at 9:24 AM, Dirkjan Ochtman <dirkjan at ochtman.nl> wrote:
> On Thu, Jul 17, 2014 at 10:23 PM, Shai Berger <shai at platonix.com> wrote:
>> I think Dirkjan tried to replace the invocation of util.pyexec with an exec;
>> keeping the invocation, and replacing the python2 implementation, should work.
>
> Yes, that's what I ended up doing:
>
> https://github.com/djc/couchdb-python/commit/8fdba0f09df00d69618858c70d11ddbeecd30026
>
> I also took a look at the Python bug Neil pointed at (thanks for
> finding that, Neil!) and came up with a patch, which is now waiting
> for review.
>
> Cheers,
>
> Dirkjan
> _______________________________________________
> Python-porting mailing list
> Python-porting at python.org
> https://mail.python.org/mailman/listinfo/python-porting


More information about the Python-porting mailing list