[I mistakenly submitted this to the python project first as bug 830374. Sorry...]
Using python-mode.el 4.6 and gnu emacs 21.1.
To demonstrate this problem:
1. Open the attached file with emacs.
2. Position point at the "#" on the last line.
3. Type `M-C-a', py-beginning-of-def-or-class.
Point will now be inside the docstring for class x.
py-b-o-d-o-c uses regexps to look backwards for def or class lines. When it finds a candidate line, should it maybe use partial-parse-sexp to decide if it's in a string or not?
file to demonstrate bug
Logged In: YES
user_id=895011
Attach a patch fixing the problem.
The patch also fixes an incorrect call to py-beginning-o-d-o-c in py-end-o-d-o-c.
patch for thsi bug