• Kirill Smelkov's avatar
    gpython: Fix pymain to properly setup sys.path (take 2) · fb98e594
    Kirill Smelkov authored
    This continues 6b4990f6 (gpython: Fix pymain to properly setup
    sys.path[0]) - now we add test and verify that gpython actually sets
    sys.path in the same way as underlying python does:
    - don't add directory of gpython to sys.path
    - for `gpython file` add to sys.path[0] realpath(dir(file)) instead of
      dir(file)  (see PySys_SetArgvEx for the reference, and else - if we do
      not make this change - added test breaks)
    - for `gpython -m mod` add to sys.path[0] realpath('') instead of ''.
      This exactly matches PY3 behaviour, while PY2 behaviour is to add ''
      However PY3 behaviour
        * is more sane, and
        * fixes test_defer_excchain_traceback on py27-gevent
      -> so we stick to it.
    Now all tests pass again.
__init__.py 13.2 KB