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

System hijacks failing when using python 3.7 #110

Closed
malcolmr opened this issue Dec 5, 2019 · 7 comments · Fixed by #111
Closed

System hijacks failing when using python 3.7 #110

malcolmr opened this issue Dec 5, 2019 · 7 comments · Fixed by #111
Assignees
Labels

Comments

@malcolmr
Copy link
Member

malcolmr commented Dec 5, 2019

With Vim 8.1.2269, running Vroom over it's own tests fails with some odd doubled-up outputs for hijacked syscalls:

$ vroom examples/system.vroom
examples/system.vroom
FAILED on line 075: Expected "Testing." in verbatim mode.

Found:
1       Testing.echo Testing. <<<<

Failed command on line 075:
Testing.

Ran 5 tests in examples/system.vroom. 4 passing, 0 errored, 1 failed.
$ vroom examples/continuations.vroom
examples/continuations.vroom
FAILED on line 47: Expected "Captured" in verbatim mode.

Found:
1       CapturedCaptured <<<<

Failed command on line 47:
Captured

Ran 5 tests in examples/continuations.vroom. 4 passing, 0 errored, 1 failed.

I believe this is caused by a change in a recent version of Vim, probably sometime after 8.1.0875.

@malcolmr
Copy link
Member Author

malcolmr commented Dec 5, 2019

Actually, it doesn't look like this is Vim at all. I've built back to v7.4.2330, and I'm still seeing the same problem.

I am using vroom 0.12.0, but that shouldn't matter here.

@malcolmr malcolmr changed the title System hijacks appear to be broken in recent Vim versions System hijacks appear to be broken? Dec 5, 2019
@malcolmr
Copy link
Member Author

malcolmr commented Dec 5, 2019

I wonder if this is actually recent versions of Python? (I have 3.7.5rc1 in the place it's failing).

@dbarnett dbarnett changed the title System hijacks appear to be broken? System hijacks failing when using python 3.7 Jan 20, 2020
@dbarnett
Copy link
Contributor

Yep, I can repro and it fails on 3.7 but not on 3.5. Until the issue is tracked down and fixed, is it easy to just avoid python 3.7 for now in the places you're running into the failures, or not that simple?

@dbarnett
Copy link
Contributor

Possibly related: looks like doctests fail against python 3.7 as well, with a bunch of mismatch errors showing a trailing comma in the string representation of thrown exceptions. Example:

======================================================================
FAIL: Doctest: vroom.actions.ActionLine
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python3.7/doctest.py", line 2196, in runTest
    raise self.failureException(self.format_failure(new.getvalue()))
AssertionError: Failed doctest test for vroom.actions.ActionLine
  File "/home/dbarnett/projects/vroom/vroom/actions.py", line 63, in ActionLine

----------------------------------------------------------------------
File "/home/dbarnett/projects/vroom/vroom/actions.py", line 86, in vroom.actions.ActionLine
Failed example:
    try: ActionLine('  @nope')
    except vroom.ParseError as e: e
Expected:
    ParseError('Unrecognized directive "nope"',)
Got:
    ParseError('Unrecognized directive "nope"')

@dbarnett
Copy link
Contributor

Doctests issue was unrelated. I fixed it in 379eefc. Still looking into the syscalls.

@dbarnett
Copy link
Contributor

Looks like there was a strange behavior change in re.sub. In 3.5.4rc1:

>>> re.sub('.*', 'Goodbye', 'Hello')
'Goodbye'

In 3.7.5rc1:

>>> re.sub('.*', 'Goodbye', 'Hello')
'GoodbyeGoodbye'

Looks pretty simple to work around. We ought to also report upstream however that works, and should be a pretty simple unit test you could write in cpython to bisect when the behavior changed.

@dbarnett
Copy link
Contributor

I bisected it and tracked it down to https://bugs.python.org/issue32308. It's an intentional change, apparently. I can't wrap my head around why it would make sense, but it should be an easy workaround changing .* to ^.*$.

dbarnett added a commit that referenced this issue Jan 21, 2020
An intentional behavior change in python re.sub added a second empty
match and "substitution" for '.*' (https://bugs.python.org/issue32308).
This changed the catch-all regex vroom was using to an anchored '^.*$',
which will ensure it only makes one substitution.

Fixes #110.
@dbarnett dbarnett self-assigned this Jan 21, 2020
@dbarnett dbarnett added the bug label Jan 21, 2020
dbarnett added a commit that referenced this issue Jan 21, 2020
An intentional behavior change in python re.sub added a second empty
match and "substitution" for '.*' (https://bugs.python.org/issue32308).
This changed the catch-all regex vroom was using to an anchored '^.*$',
which will ensure it only makes one substitution.

Fixes #110.
dbarnett added a commit that referenced this issue Jan 21, 2020
Changes since 0.13.0:
  * Fix compatibility issues with python 3.7 (#110)
  * Fix vroom failing with AttributeErrors when running on non-ANSI
    terminals (#112)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants