These are chat archives for dropbox/pyston

9th
Oct 2015
An Long
@aisk
Oct 09 2015 03:00
Hi @kmod , these code is in here
Sun
@Daetalus
Oct 09 2015 15:04
Does there has a constant variable that could represent the current pyston executable path in jit.cpp?
Kevin Modzelewski
@kmod
Oct 09 2015 21:33
hmm I guess it depends on what you need / when you need it
inside Python code, sys.executable should be good
in jit.cpp, you can look at argv[0], though I think better is to call Py_GetProgramFullPath (which is what goes into sys.executable)
Sun
@Daetalus
Oct 09 2015 21:34
Please see the code in here: https://github.com/dropbox/pyston/pull/962/files. For now, I use readlink.
Kevin Modzelewski
@kmod
Oct 09 2015 21:34
(but you can't call that until after we call Py_SetProgramName
Sun
@Daetalus
Oct 09 2015 21:35
This PR try to address #800
I think Py_GetProgramFullPath will be enough.
Kevin Modzelewski
@kmod
Oct 09 2015 21:41
it looks like CPython's error message uses sys.executable
Sun
@Daetalus
Oct 09 2015 21:41
argv[0] is simpler.
can we use the cpython implementation for this though?
it looks like their behavior is quite different, where it calls into the runpy module
Sun
@Daetalus
Oct 09 2015 21:44
Oh, they implement it in Python level.
Kevin Modzelewski
@kmod
Oct 09 2015 21:46
yeah it looks like it calls this function:
Sun
@Daetalus
Oct 09 2015 21:47
Thanks, I will mark it as WIP.
Sun
@Daetalus
Oct 09 2015 23:37

Emm, if use the CPython implementation, it will requires a lot of prior compatibility improvements. Such Pysthon-ast, enableimport.c, enable pythonrun.c(this also contain a lot of compatibility issues) etc.

I will try to devide the problem.

Kevin Modzelewski
@kmod
Oct 09 2015 23:42
oh hmm, can we just take the parts that are needed for the directory part?
ie RunMainFromImporter and its dependencies