Subject: bug#25753: 25.2; Python mode shell interaction not working 100%

From: [email-masked] (Charles A. Roelli)
Date: Sat, 25 Feb 2017 15:11:56 +0100

Could you please evaluate these forms with a running instance of
Python in Emacs?  My output follows each form.  It seems like the Mac
version of Python echoes the last command sent, and maybe python.el
does not expect this?  Notice in the third example, the correct result
appears, but is preceded by the code sent to the interpreter (which
should be omitted as garbage).

(python-shell-send-string-no-output "import os\nimport sys")
=> "import codecs, os;__pyfile = codecs.open('''/var/folders/WP/WPe0Q1iAGc0J7iI6J50jcU+++TI/-Tmp-/py167Tvh''', encoding='''utf-8''');__code = __pyfile.read().encode('''utf-8''');__pyfile.close();os.remove('''/var/folders/WP/WPe0Q1iAGc0J7iI6J50jcU+++TI/-Tmp-/py167Tvh''');exec(compile(__code, '''/var/folders/WP/WPe0Q1iAGc0J7iI6J50jcU+++TI/-Tmp-/py167Tvh''', 'exec'));"

(python-shell-send-string-no-output "import os; import sys")
=> "import os; import sys"

(python-ffap-module-path "os")
=> "import codecs, os;__pyfile = codecs.open('''/var/folders/WP/WPe0Q1iAGc0J7iI6J50jcU+++TI/-Tmp-/py167tDu''', encoding='''utf-8''');__code = __pyfile.read().encode('''utf-8''');__pyfile.close();os.remove('''/var/folders/WP/WPe0Q1iAGc0J7iI6J50jcU+++TI/-Tmp-/py167tDu''');exec(compile(__code, '''/var/folders/WP/WPe0Q1iAGc0J7iI6J50jcU+++TI/-Tmp-/py167tDu''', 'exec'));^M
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py"