An Emacs mode for editing Python code

defalias does not provide backward-compatibility

Reported by Ryan Thompson on 2011-10-07
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
python-mode.el
High
Andreas Roehler

Bug Description

In python-mode.el version 6.0.4, there is this section of code:

;; backward compatibility
(defalias 'py-python-command 'py-shell-name)
(defalias 'py-jpython-command 'py-shell-name)
(defalias 'py-jython-command 'py-shell-name)
(defalias 'py-default-interpreter 'py-shell-name)
(defalias 'python-command 'py-shell-name)

However, "defalias" works only for functions, and all of those symbols are variables, so this "backward-compatibility" section actually has no effect at all, and packages like ipython.el that rely on backward-compatibility become broken. "defvaralias" should be used instead. Although the truly correct function to use is "define-obsolete-variable-alias", which requires a slightly different syntax.

Changed in python-mode:
assignee: nobody → Andreas Roehler (a-roehler)
importance: Undecided → High
milestone: none → 6.0.4
status: New → Confirmed
Thomas Caswell (tcaswell-gmail) wrote :

change defalias to defvaralias

The patch also includes a line removal from the py-execute-base because me and bzr still don't get along well

Am 07.10.2011 21:28, schrieb Thomas Caswell:
> change defalias to defvaralias
>
> The patch also includes a line removal from the py-execute-base because
> me and bzr still don't get along well
>
> ** Patch added: "defvar_fix.patch"
> https://bugs.launchpad.net/python-mode/+bug/870200/+attachment/2524291/+files/defvar_fix.patch
>

Hi Thomas,

unfortunately mail reporting your patch arrived only when checked in a
fix already.

BTW don't understand your change in py-execute-base...

Cheers,

Andreas

Changed in python-mode:
status: Confirmed → Fix Committed
Ryan Thompson (rct86) wrote :

It would probably be better to use "define-obsolete-variable-alias" instead of defvaralias. This would allow emacs to inform people that the variables are obsolete.

Andreas Roehler (a-roehler) wrote :

Am 08.10.2011 01:22, schrieb Ryan Thompson:
> It would probably be better to use "define-obsolete-variable-alias"
> instead of defvaralias. This would allow emacs to inform people that the
> variables are obsolete.
>

so it was checked in yesterday, you recommended that already and so I
did - :)

Thanks a lot BTW.

Andreas

Changed in python-mode:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers