[pypy-svn] pypy default: Patch modified from a patch submitted by Da_Blitz:

arigo commits-noreply at bitbucket.org
Tue Apr 12 11:46:25 CEST 2011


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r43304:99db330d6f9c
Date: 2011-04-12 11:45 +0200
http://bitbucket.org/pypy/pypy/changeset/99db330d6f9c/

Log:	Patch modified from a patch submitted by Da_Blitz: double check to
	ensure we are not overwriting the current interpreter

diff --git a/pypy/translator/goal/translate.py b/pypy/translator/goal/translate.py
--- a/pypy/translator/goal/translate.py
+++ b/pypy/translator/goal/translate.py
@@ -285,6 +285,15 @@
         elif drv.exe_name is None and '__name__' in targetspec_dic:
             drv.exe_name = targetspec_dic['__name__'] + '-%(backend)s'
 
+        # Double check to ensure we are not overwriting the current interpreter
+        try:
+            exe_name = str(drv.compute_exe_name())
+            assert not os.path.samefile(exe_name, sys.executable), (
+                'Output file %r is the currently running '
+                'interpreter (use --output=...)'% exe_name)
+        except OSError:
+            pass
+
         goals = translateconfig.goals
         try:
             drv.proceed(goals)


More information about the Pypy-commit mailing list