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

Support Python 3.7 #273

Merged
merged 4 commits into from
Jun 6, 2017
Merged

Support Python 3.7 #273

merged 4 commits into from
Jun 6, 2017

Conversation

myint
Copy link
Member

@myint myint commented May 29, 2017

This fixes #271.

if hasattr(node, 'docstring'):
docstring = node.docstring

# This is just a reasonable guess. In Python 3.7, docstrings no
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can get better guess if inspect the maximal lineno of arguments, default values, annotations, etc. This could allow you to pass test_offsetWithMultiLineArgs in 3.7.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the suggestion!

.gitignore Outdated
@@ -1,3 +1,4 @@
.*.sw?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please put this in your local git configuration, not pyflakes.

@bitglue
Copy link
Member

bitglue commented Jun 5, 2017

Does this mean we can add 3.7 to travis.yml?

Copy link
Member

@bitglue bitglue left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, but if 3.7 works let's add it to travis.yml, provided travis supports such a thing.

@myint
Copy link
Member Author

myint commented Jun 6, 2017

The closest thing to 3.7 is 3.7-dev. But our existing nightly already points to that.

https://docs.travis-ci.com/user/languages/python/

@myint myint merged commit 8baf19d into master Jun 6, 2017
@myint myint deleted the python37 branch June 6, 2017 00:29
hugovk added a commit to hugovk/pyflakes that referenced this pull request Oct 11, 2017
@hugovk hugovk mentioned this pull request Oct 11, 2017
hugovk added a commit to hugovk/pyflakes that referenced this pull request Dec 11, 2017
@methane
Copy link

methane commented Mar 10, 2018

We're thinking change again in 3.7b3. In this time, docstring will be moved from attribute to special AST node named DocString. See this example:

source = """\
def foo():
    "docstring"
"""

import ast
t = ast.parse(source)
print(ast.dump(t))

3.6: ... FunctionDef(name='foo', args=arguments(...), body=[Expr(value=Str(s='docstring'))], decorator_list=[], returns=None) ...

3.7b2: ... FunctionDef(name='foo', args=arguments(...), body=[], decorator_list=[], returns=None, docstring='docstring') ...

3.7b3?: ... FunctionDef(name='foo', args=arguments(args=[], vararg=None, kwonlyargs=[], kw_defaults=[], kwarg=None, defaults=[]), body=[DocString(s='docstring')], decorator_list=[], returns=None) ...

Of course, ast.getdocstring() works in all versions.
With this change, you can get lineno of docstring from the DocString node (while there is bug for now).

We want feedback from AST users. Please post your comment on this issue or Python-Dev mailing list.

@sigmavirus24
Copy link
Member

@methane please also prod the code-quality@python.org mailing list, flake8-bugbear, and pydocstyle projects to get maximum exposure.

hugovk added a commit to hugovk/pyflakes that referenced this pull request Mar 25, 2018
myint pushed a commit that referenced this pull request Mar 25, 2018
* Python 3.7 is supported (#273)

* Update classifiers
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support Python 3.7
5 participants