Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PyPy has changes that are not present here #36

Open
mattip opened this issue Apr 1, 2021 · 5 comments
Open

PyPy has changes that are not present here #36

mattip opened this issue Apr 1, 2021 · 5 comments
Labels
bug Something isn't working

Comments

@mattip
Copy link
Member

mattip commented Apr 1, 2021

For instance, in simple_interact.py there is _strip_final_indent, which is not present here.

def _strip_final_indent(text):
    # kill spaces and tabs at the end, but only if they follow '\n'.
    # meant to remove the auto-indentation only (although it would of
    # course also remove explicitly-added indentation).
    short = text.rstrip(' \t')
    n = len(short)
    if n > 0 and text[n-1] == '\n':
        return short
    return text

def run_multiline_interactive_console(mainmodule=None, future_flags=0):
    import code
    import __main__
    mainmodule = mainmodule or __main__
    console = code.InteractiveConsole(mainmodule.__dict__, filename='<stdin>')
    if future_flags:
        console.compile.compiler.flags |= future_flags

    def more_lines(unicodetext):
        # ooh, look at the hack:
        if sys.version_info < (3,):
            src = "#coding:utf-8\n"+_strip_final_indent(unicodetext).encode('utf-8')
        else:
            src = _strip_final_indent(unicodetext)
        try:
            code = console.compile(src, '<stdin>', 'single')
        except (OverflowError, SyntaxError, ValueError):
            return False
        else:
            return code is None

...
@obfusk
Copy link

obfusk commented Apr 1, 2021

There was also this PyPy commit, which fixes handling escape sequences in prompts.

@obfusk
Copy link

obfusk commented Apr 1, 2021

Looking though this and this it seems the codebases were kept somewhat in sync in the past but completely diverged around Apr 14, 2013.

@blueyed
Copy link
Collaborator

blueyed commented Apr 11, 2021

See also #2.

@blueyed
Copy link
Collaborator

blueyed commented Apr 11, 2021

@mattip
I've just seen https://foss.heptapod.net/pypy/pypy/-/commit/1730e6f455196fc719103033d518d648153bac52: "revert pyrepl to 8ef001285964, before merging upstream".
Not sure what the commit references, since the link goes to https://foss.heptapod.net/pypy/pypy/-/commit/92d6cfaba23a8d8765ece99930afdb899ed1e9d1 (only 3 weeks old).
Looks like this might be related to this issue.. are you trying to merge the two branches/trunks?

@blueyed blueyed added the bug Something isn't working label Apr 11, 2021
@mattip
Copy link
Member Author

mattip commented Apr 13, 2021

I tried to

  • merge this repo back to PyPy, including PRs that have not yet been merged
  • unify pyrepl in the default (python2.7) and py3.7 PyPy branches.

I failed, and so reverted the work from the branches above. So as to not lose what I had done, I created the pyrepl and pyrepl3 branches.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants