Compilation error related to eager macro expansion of py-rx
- Byte compile error with Emacs 26.3 (did not try with Emacs 27.1 yet) :
When I try to byte-compile python-mode.el with Python 26.3, I get a "Wrong number of arguments: (2 . 3) 1" error on the first line of the ``py-shell-completion-at-point`` define form.
- To investigate I copied the ``internal-macroexpand-for-load`` dean in my init.el and replaced the line
```lisp
(message "Eager macro-expansion failure: %S" err)
```
with
```lisp
(message "Eager macro-expansion failure: %S form: %S load file: %S" err form load-file-name)
```
Then when I the python-mode function is executed, I get the following 2 messages:
Eager macro-expansion failure: (wrong-number-of-arguments (2 . 3) 1) form: (defalias (quote p\
y-shell-completion-at-point) (function (lambda (&optional process) "Function for `completion-\
at-point-functions' in `py-shell-mode'.
Optional argument PROCESS forces completions to be retrieved
using that one instead of current buffer's process." (let* ((process (or process (get-buffer-\
process (current-buffer)))) (line-start (if (derived-mode-p (quote py-shell-mode)) (or (cdr (\
py-util-comint-last-prompt)) (line-beginning-position)) (line-beginning-position))) (import-s\
tatement (when (string-match-p (rx (* space) word-start (or "from" "import") word-end space) \
(buffer-substring-no-properties line-start (point))) (buffer-substring-no-properties line-sta\
rt (point)))) (start (save-excursion (if (not (re-search-backward (py-rx (or whitespace open-\
paren close-paren string-delimiter simple-operator)) line-start t 1)) line-start (forward-cha\
r (length (match-string-no-properties 0))) (point)))) (end (point)) (completion-fn (with-curr\
ent-buffer (process-buffer process) (function py-shell-completion-get-completions)))) (list s\
tart end (completion-table-dynamic (apply-partially completion-fn process import-statement)))\
)))) load file: "/Users/roup/.emacs.d/elpa/python-mode-20200608.737/python-mode.el"
Eager macro-expansion failure: (wrong-number-of-arguments (2 . 3) 1) form: (defalias (quote p\
y-info-encoding-from-cookie) (function (lambda nil "Detect current buffer's encoding from its\
coding cookie.
Returns the encoding as a symbol." (let ((first-two-lines (save-excursion (save-restriction (\
widen) (goto-char (point-min)) (forward-line 2) (buffer-substring-no-properties (point) (poin\
t-min)))))) (when (string-match (py-rx coding-cookie) first-two-lines) (intern (match-string-\
no-properties 1 first-two-lines))))))) load file: "/Users/roup/.emacs.d/elpa/python-mode-2020\
0608.737/python-mode.el"
2 functions are affected:
- ``py-shell-completion-at-point``
- ``py-info-encoding-from-cookie``
These 2 functions use the py-rx macro. They are the only functions that use that macro. Therefore I believe there is an expansion error inside that macro.
I am trying to find the error but have not yet pin-pointed the root cause as I'm learning the code. I thought it would help to provide this report in the mean-time.
issue