[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [tor-bugs] #4414 [Thandy]: ScriptWrapper should be multiplatform
#4414: ScriptWrapper should be multiplatform
--------------------+-------------------------------------------------------
Reporter: chiiph | Owner: nickm
Type: defect | Status: needs_review
Priority: normal | Milestone:
Component: Thandy | Version:
Keywords: | Parent:
Points: | Actualpoints:
--------------------+-------------------------------------------------------
Comment(by nickm):
If the goal here is only to handle the case where the python binary is not
named "python" and in the path, why not just use sys.executable to find
out where it is?
I don't think you should use code.InteractiveInterpreter for this at all.
The interpreter's semantics actually give you different syntax from
regular python.
Example: the following is legal in a Python script, but not legal in an
interactive environment:
{{{
def a():
pass
def b():
pass
}}}
and the following is legal in a python script but not an interactive
environment:
{{{
def a():
pass
}}}
(An interactive interpreter requires a blank line at the end of a top-
level block, and requires that every blank line indicate the end of a top-
level block.)
Also, stuff like this should make you terrified:
{{{
+ run_code.append("os.environ[\""+var+"\"] =
\""+self._env[var]+"\"\n
}}}
What if there's something in self._env that contains a quote or a newline?
--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/4414#comment:2>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online
_______________________________________________
tor-bugs mailing list
tor-bugs@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-bugs