From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Alex Harsanyi Newsgroups: gmane.emacs.bugs Subject: bug#5756: 24.0.50; reloading files in python3 Date: Tue, 23 Mar 2010 19:58:03 +0800 Message-ID: <64CCAC7D-54C4-45F7-BB72-7B9862EE5FC9@mac.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 (Apple Message framework v1077) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1269347148 24345 80.91.229.12 (23 Mar 2010 12:25:48 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 23 Mar 2010 12:25:48 +0000 (UTC) To: 5756@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Mar 23 13:25:43 2010 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Nu3Al-0005G7-3v for geb-bug-gnu-emacs@m.gmane.org; Tue, 23 Mar 2010 13:25:27 +0100 Original-Received: from localhost ([127.0.0.1]:59716 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Nu3Ak-0006RI-42 for geb-bug-gnu-emacs@m.gmane.org; Tue, 23 Mar 2010 08:25:26 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Nu3Ac-0006QN-EM for bug-gnu-emacs@gnu.org; Tue, 23 Mar 2010 08:25:18 -0400 Original-Received: from [140.186.70.92] (port=41731 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Nu3Aa-0006P7-AB for bug-gnu-emacs@gnu.org; Tue, 23 Mar 2010 08:25:18 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Nu3AY-0004Z8-Ce for bug-gnu-emacs@gnu.org; Tue, 23 Mar 2010 08:25:15 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:54233) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Nu3AY-0004Z1-7F for bug-gnu-emacs@gnu.org; Tue, 23 Mar 2010 08:25:14 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1Nu30g-0005e7-C6; Tue, 23 Mar 2010 08:15:02 -0400 X-Loop: bug-gnu-emacs@gnu.org Resent-From: Alex Harsanyi Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 23 Mar 2010 12:15:02 +0000 Resent-Message-ID: Resent-Sender: bug-gnu-emacs@gnu.org X-GNU-PR-Message: report 5756 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.126934650021681 (code B ref -1); Tue, 23 Mar 2010 12:15:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 23 Mar 2010 12:15:00 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Nu30d-0005de-M7 for submit@debbugs.gnu.org; Tue, 23 Mar 2010 08:15:00 -0400 Original-Received: from mx10.gnu.org ([199.232.76.166]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Nu2kY-0005Xq-3z for submit@debbugs.gnu.org; Tue, 23 Mar 2010 07:58:24 -0400 Original-Received: from lists.gnu.org ([199.232.76.165]:55302) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Nu2kS-00014c-Gv for submit@debbugs.gnu.org; Tue, 23 Mar 2010 07:58:16 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Nu2kS-0003kl-Ao for bug-gnu-emacs@gnu.org; Tue, 23 Mar 2010 07:58:16 -0400 Original-Received: from [140.186.70.92] (port=33453 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Nu2kP-0003ka-Qb for bug-gnu-emacs@gnu.org; Tue, 23 Mar 2010 07:58:14 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Nu2kM-0000ya-Ss for bug-gnu-emacs@gnu.org; Tue, 23 Mar 2010 07:58:13 -0400 Original-Received: from outbound-mail01.westnet.com.au ([203.10.1.242]:23266) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Nu2kM-0000yH-8B for bug-gnu-emacs@gnu.org; Tue, 23 Mar 2010 07:58:10 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AlgWADtJqEs6B2wzPGdsb2JhbAAHmy8BAQEBN7szhH0Egxw X-IronPort-AV: E=Sophos;i="4.51,294,1267372800"; d="scan'208";a="66547428" Original-Received: from dsl-58-7-108-51.wa.westnet.com.au (HELO [10.0.1.2]) ([58.7.108.51]) by outbound-mail01.westnet.com.au with ESMTP/TLS/AES128-SHA; 23 Mar 2010 19:58:05 +0800 X-Mailer: Apple Mail (2.1077) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-Mailman-Approved-At: Tue, 23 Mar 2010 08:14:58 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Tue, 23 Mar 2010 08:15:02 -0400 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:35701 Archived-At: Reloading a python file into the current interpreter using C-c C-l fails for python3. To test it, create a file hello.py with the contents: def Hello(): print ("Hello World"); and load it into the python interpreter using C-c C-l. Modify the file, than try to load it again. The python interpreter will fail with an exception about reload() not being defined. The problem is that the reload() function is no longer a built-in in Python3, instead it lives in the "imp" module. The following patch fixes the problem, but I'm not sure if it is correct if emacs3.py is re-generated from emacs2.py as the comment in the header states. === modified file 'etc/emacs3.py' --- etc/emacs3.py 2010-01-13 08:35:10 +0000 +++ etc/emacs3.py 2010-03-23 10:39:17 +0000 @@ -23,7 +23,7 @@ Warning: This file is automatically gene # You should have received a copy of the GNU General Public License # along with GNU Emacs. If not, see . -import os, sys, traceback, inspect, __main__ +import os, sys, traceback, inspect, imp, __main__ try: set @@ -216,7 +216,7 @@ def eimport (mod, dir): try: try: if mod in __dict__ and inspect.ismodule (__dict__[mod]): - reload (__dict__[mod]) + imp.reload (__dict__[mod]) else: __dict__[mod] = __import__ (mod) except: In GNU Emacs 24.0.50.1 (x86_64-apple-darwin10.2.0, NS apple-appkit-1038.25) of 2010-03-23 on karinji-2.local Windowing system distributor `Apple', version 10.3.1038 configured using `configure '--with-ns'' Important settings: value of $LC_ALL: nil value of $LC_COLLATE: nil value of $LC_CTYPE: nil value of $LC_MESSAGES: nil value of $LC_MONETARY: nil value of $LC_NUMERIC: nil value of $LC_TIME: nil value of $LANG: en_AU.UTF-8 value of $XMODIFIERS: nil locale-coding-system: utf-8-unix default enable-multibyte-characters: t Major mode: Python Minor modes in effect: diff-auto-refine-mode: t show-paren-mode: t global-cwarn-mode: t display-time-mode: t mouse-wheel-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t auto-encryption-mode: t auto-compression-mode: t size-indication-mode: t line-number-mode: t Recent input: C-x C-f O t h h e M-> C-e C-e C-x C-s C-c C-z i m p o r t SPC s y s s y s . v e r s i o n _ i n f o C-x o C-c C-l C-x o h e l l o . H e l l o ( ) ; C-x C-o C-x o , SPC 2 1 2 3 C-x C-s C-c C-l C-x o M-p C-x o C-x C-f k p k e m / q e t e m 3 C-x 1 C-x v = M-x r e o [ p p o r t Recent messages: Fontifying *Python*... (regexps...........) /Users/haral/Other/hello.py loaded Saving file /Users/haral/Other/hello.py... Wrote /Users/haral/Other/hello.py /Users/haral/Other/hello.py loaded History item: 1 Loading vc-bzr...done Finding changes in /Users/haral/pkg/emacs/quickfixes/etc/emacs3.py...done byte-code: Beginning of buffer Making completion list... Load-path shadows: None found. Features: (shadow sort gnus-util mail-extr message rfc822 mml mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231 rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mailabbrev mail-utils gmm-utils mailheader emacsbug help-mode view diff-mode easy-mmode vc vc-dispatcher vc-bzr sha1 hex-util compile python-21 python comint ring uniquify paren avoid cwarn cus-start cus-load appt diary-lib diary-loaddefs cal-menu calendar cal-loaddefs time tex-site folding-isearch folding advice help-fns advice-preload protbuf server midnight time-stamp whitespace iswitchb cc-mode cc-menus cc-cmds ah-bufsel ah-cc-mode-extra cc-styles cc-align cc-fonts cc-engine cc-vars cc-defs regexp-opt ah-util autoinsert cl cl-19 tooltip ediff-hook vc-hooks lisp-float-type mwheel ns-win easymenu tool-bar dnd fontset image fringe lisp-mode register page menu-bar rfn-eshadow timer select scroll-bar mldrag mouse jit-lock font-lock syntax facemenu font-core frame cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese case-table epa-hook jka-cmpr-hook help simple abbrev loaddefs button minibuffer faces cus-face files text-properties overlay md5 base64 format env code-pages mule custom widget hashtable-print-readable backquote make-network-process ns multi-tty emacs)