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

encode str into bytes for _lookup_ctag argument; #1724

merged 1 commit into from
May 2, 2021


Copy link

check source code of python-ctags and python-ctags3 to see what
argument type is expected (answer: char *);

guess this is python 2 legacy; but now it should work in python 3;

check source code of `python-ctags` and `python-ctags3` to see what
argument type is expected (answer: `char *`);

guess this is python 2 legacy; but now it should work in python 3;
Copy link

Anteru commented Feb 27, 2021

Could you please add a test case exercising this path? I've got no idea where this is triggered :)

Copy link
Contributor Author

I just ran the shipped test file tests/ and it failed.

def test_ctags():
        import ctags
    except ImportError:
        # we can't check without the ctags module, but at least check the exception
        assert pytest.raises(
            RuntimeError, HtmlFormatter, tagsfile='support/tags'
        # this tagfile says that test_ctags() is on line 165, even if it isn't
        # anymore in the actual source
        fmt = HtmlFormatter(tagsfile='support/tags', lineanchors='L',
        outfile = StringIO()
        fmt.format(tokensource, outfile)
        assert '<a href="">test_ctags</a>' \
            in outfile.getvalue()

You can probably debug if the problematic value in has type str or bytes. It's str on my machine and that caused the error.

@Anteru Anteru added this to the 2.9 milestone May 2, 2021
@Anteru Anteru merged commit 30cfa26 into pygments:master May 2, 2021
Copy link

Anteru commented May 2, 2021

Thanks, merged!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet

Successfully merging this pull request may close these issues.

None yet

2 participants