• Kirill Smelkov's avatar
    gpython: Fix crash when invoked as e.g. ./bin/gpython · 076cdd8f
    Kirill Smelkov authored
    There was an assert because sys.path[0] is setup as realpath (real, not
    relative), but if exe was given as relative path it was raising like
    below:
    
        gpython/gpython_test.py::test_pymain_run_via_relpath GPython 0.0.7.post1 [gevent 20.9.0] / CPython 3.8.6
        Traceback (most recent call last):
          File "./__init__.py", line 482, in <module>
            main()
          File "./__init__.py", line 366, in main
            pymain(argv, init)
          File "./__init__.py", line 82, in pymain
            raise RuntimeError('pymain: internal error: sys.path[0] was not set by underlying python to dirname(exe):'
        RuntimeError: pymain: internal error: sys.path[0] was not set by underlying python to dirname(exe):
    
                exe:    ./__init__.py
                sys.path[0]:    /home/kirr/src/tools/go/pygolang-master/gpython
        FAILED
    
    -> Fix it by setting up exe as realpath.
    076cdd8f
__init__.py 17 KB