unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: "Mattias Engdegård" <mattias.engdegard@gmail.com>
To: kobarity <kobarity@gmail.com>
Cc: Yuan Fu <casouri@gmail.com>,
	Stefan Monnier <monnier@iro.umontreal.ca>,
	59477@debbugs.gnu.org
Subject: bug#59477: python-tests fail without tree-sitter
Date: Mon, 28 Nov 2022 11:01:52 +0100	[thread overview]
Message-ID: <C55D8A3D-3FC8-4A27-A029-B5B5F6009D5F@gmail.com> (raw)
In-Reply-To: <eke7sfi48nd5.wl-kobarity@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 925 bytes --]

27 nov. 2022 kl. 15.48 skrev kobarity <kobarity@gmail.com>:

> It seems to me that `python-ffap-module-path' or
> `python-shell-send-string-no-output' is not working as expected on
> your environment.

Indeed, something in Emacs is making incorrect assumptions.

> 1. emacs -Q
> 2. Open Python file. (Empty file is OK)
> 3. C-c C-p (M-x run-python)
> 4. C-x o (Back to the Python mode buffer)
> 5. M-: (python-shell-send-string-no-output "print('a')")
> 
> My expectation is "a".

The result here is

 "__PYTHON_EL_eval(\"print('a')\", \"/Users/mattias/emacs/asdf.py\")\r\na"

which is consistent with the test failure -- something in python-mode is having trouble parsing the reply. I traced `python-shell-output-filter`; see attached file.

This might be bug#25753 again (via a comment in etc/PROBLEMS). Even if no effort is made to fix the bug properly, we should make sure the test doesn't fail.


[-- Attachment #2: python-shell-output-filter-trace.log --]
[-- Type: application/octet-stream, Size: 2888 bytes --]

======================================================================
1 -> (python-shell-output-filter "exec(\"def __PYTHON_EL_eval(source, filename):\\n    import ast, sys\\n    if sys.version_info[0] == 2:\\n        from __builtin__ import compile, eval, globals\\n    else:\\n        from builtins import compile, eval, globals\\n    try:\\n        p, e = ast.parse(source, filename), None\\n    except SyntaxError:\\n        t, v, tb = sys.exc_info()\\n        sys.excepthook(t, v, tb.tb_next)\\n        return\\n    if p.body and isinstance(p.body[-1], ast.Expr):\\n        e = p.body.pop()\\n    try:\\n        g = globals()\\n        exec(compile(p, filename, 'exec'), g, g)\\n        if e:\\n            return eval(compile(ast.Expression(e.value), filename, 'eval'), g, g)\\n    except Exception:\\n        t, v, tb = sys.exc_info()\\n        sys.excepthook(t, v, tb.tb_next)\")\r\n")
1 <- python-shell-output-filter: ""
======================================================================
1 -> (python-shell-output-filter ">>> ")
1 <- python-shell-output-filter: ""
======================================================================
1 -> (python-shell-output-filter "exec(\"def __PYTHON_EL_eval_file(filename, tempname, delete):\\n    import codecs, os, re\\n    pattern = r'^[ \\t\\f]*#.*?coding[:=][ \\t]*([-_.a-zA-Z0-9]+)'\\n    with codecs.open(tempname or filename, encoding='latin-1') as file:\\n        match = re.match(pattern, file.readline())\\n        match = match or re.match(pattern, file.readline())\\n        encoding = match.group(1) if match else 'utf-8'\\n    with codecs.open(tempname or filename, encoding=encoding) as file:\\n        source = file.read().encode(encoding)\\n    if delete and tempname:\\n        os.remove(tempname)\\n    return __PYTHON_EL_eval(source, filename)\")\r\n")
1 <- python-shell-output-filter: ""
======================================================================
1 -> (python-shell-output-filter ">>> ")
1 <- python-shell-output-filter: ""
======================================================================
1 -> (python-shell-output-filter "__PYTHON_EL_eval_file(\"/var/folders/qy/zstv16390nlcs47kz8nff_mm0000gn/T/pyDjIqzH\", \"/var/folders/qy/zstv16390nlcs47kz8nff_mm0000gn/T/pyDjIqzH\", True)\r\n")
1 <- python-shell-output-filter: ""
======================================================================
1 -> (python-shell-output-filter "python.el: native completion setup failed, <class 'Exception'>: libedit based readline is known not to work,\r\n      see etc/PROBLEMS under \"In Inferior Python mode, input is echoed\".\r\n>>> ")
1 <- python-shell-output-filter: ""
======================================================================
1 -> (python-shell-output-filter "__PYTHON_EL_eval(\"print('a')\", \"/Users/mattias/emacs/asdf.py\")\r\na\r\n>>> ")
1 <- python-shell-output-filter: ""

  reply	other threads:[~2022-11-28 10:01 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-22 10:13 bug#59477: python-tests fail without tree-sitter Mattias Engdegård
2022-11-23  2:40 ` Yuan Fu
2022-11-23 22:00 ` Yuan Fu
2022-11-24  6:45   ` Eli Zaretskii
2022-11-25 16:50 ` Mattias Engdegård
2022-11-26 22:18   ` Yuan Fu
2022-11-27 13:07     ` Mattias Engdegård
2022-11-30 13:41       ` Mattias Engdegård
2022-12-04  7:51         ` Yuan Fu
2022-11-27 13:16     ` Mattias Engdegård
2022-11-27 14:48       ` kobarity
2022-11-28 10:01         ` Mattias Engdegård [this message]
2022-11-28 15:18           ` kobarity
2022-11-28 19:22             ` Mattias Engdegård
2022-11-28 10:18         ` Mattias Engdegård

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=C55D8A3D-3FC8-4A27-A029-B5B5F6009D5F@gmail.com \
    --to=mattias.engdegard@gmail.com \
    --cc=59477@debbugs.gnu.org \
    --cc=casouri@gmail.com \
    --cc=kobarity@gmail.com \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).