Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refs #28814 -- Fixed "SyntaxError: Generator expression must be paren…
…thesized" on Python 3.7. Due to https://bugs.python.org/issue32012.
- Loading branch information
931c60c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could this fix be merged in older releases of Django? 2.0 and/or 1.11?
931c60c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Per the FAQ, Django 2.0.x is compatible with Python 3.7.
931c60c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. I'll migrate my project to 2.0 then
931c60c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks,
931c60c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please apply the fix for django 1.11
931c60c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This fix works on Django 1.11 too. Thanks!
931c60c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
931c60c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm running Django 1.11.15 (the latest version in 1.11) with Python 3.7 on Manjaro Linux (a derivative of Arch Linux), and I'm still getting the same error. Here's the steps I took to reproduce the problem:
Updating Pip to the latest version and reinstalling Django didn't help either. Per this SO Question it would appear that the bugfix hasn't made it into fresh releases of Django 1.11. Is Django 1.11 getting this bugfix, or will I have to upgrade my project to v2.0?
931c60c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Per the FAQ, Django 1.11.x is not compatible with Python 3.7.
Django 1.11.x reached end of mainstream support on December 2, 2017 and it receives only data loss and security fixes until its end of life.
931c60c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@timgraham Could this patch be bundled into the next data loss / security fix update please ? I understand shipping a new release is a lot of work, but bundling with one you'd make anyway ?
Django 1.11 is the LTS version, and it would be nice if it worked on the latest Python. Given Python does not have LTS versions, starting a project today on Django 1.11 LTS / Python 3.7 is a reasonable strategy to get maximum life time out of these two major components.
931c60c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are no plans to add Python 3.7 support to Django 1.11. Look on the ticket for this commit and you'll see that more patches are required than just this one. If you wish to raise a discussion, use the django-developers mailing list.
931c60c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@timgraham Thanks a lot for the info, that makes sense. Yeah, sounds like upgrading is the best way if there are multiple compatibility patches.
931c60c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
可以将这个修改直接应用到django1.11和python3.7环境中
931c60c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@timgraham it may be only me, but after applying this one change to my django1.11.16, it started up without any complaint.
931c60c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also, here's a thing that's not resolved at this moment: information here tells that this patch is not gonna be applied to the LTS django because of other outstanding issues.
however, 2.x does not have an LTS version yet.
moreover (and I know that this is not django's fault), the
django-modeltranslation
module also doesn't support django2.x yet, see deschler/django-modeltranslation#472 and deschler/django-modeltranslation#467). this makes us, poor django peasants stick with python3.6.since I don't see what other issues apply to the LTS version with 3.7, I consider it dangerous to use in production, so I have to revert back to using 3.6. no data classes for me I guess.
really looking forward to have this conflict resolved.
931c60c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @karolyi.
This won't be backported due to Django's supported versions policy. (Not any other outstanding issues.) The place to take up a discussion of the policy is the django-developers mailing list, not here.
And 💃🏼, dataclasses was backported to v3.6 if you're missing it: https://pypi.org/project/dataclasses/
TBH, there's not really any chance of that. It's just unfortunate timing that Python 3.7 came after Django 1.11. (If you're on an LTS, you have to expect not to be on the bleeding edge: it can't work both ways.)
931c60c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@carltongibson, thx I didn't know about dataclasses existing for 3.6. I'll look into it.
OTOH, is 3.7 'bleeding-edge' though? it's considered stable, so it would be nice to be able to use it with an LTS version of django. I have a project with lots of dependencies and compiled stuff (from xapian to pillow, QR code generators and whatever), everything went a-okay except for this one error.
I agree, the timing was unfortunate. I'm not complaining though, don't get me wrong. I'm just stating the facts.
931c60c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe bad choice of words but, from the perspective of Django 1.11, Yes, Python 3.7 is bleeding-edge: Django 1.11 ended mainstream support in December 2017. Python 3.7 wasn't released until June 2018. Thus it's not supported.
The next LTS will be April 2019. It'll support Python 3.7, but by the time it's EOL no-doubt they'll be new Python versions it doesn't support. Again, that's kind-of entailed by choosing the LTS. If you want the latest choose different...
931c60c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello,
TLDR; I'm happy to make a PR if anyone from core team would be willing to consider it (/cc @timgraham).
In our view, after Python development has picked up so much speed and stable official releases are coming out so often, 3-year LTS support policy excluding support for newer runtimes warrants reconsideration, especially if the changes are only so few, non-risky and so trivial.
I have backported all relevant commits that I could find to Django 1.11.16 LTS:
https://github.com/moneymeets/django/commits/moneymeets/1.11.16-py37
We are currently testing the resulting artefact, but the Django test suite passes and everything seems to work nicely so far.
You can use our build if you specify
in your
requirements.txt
orif you use
pipenv
.Note that for various reasons we had to hack the versioning scheme, so Python 3.7 compatible releases are numbered
1.11.161
(based upon1.11.16
),1.11.171
, etc.The code is provided as is without any warranties and/or support, it is not an official Django offering, be sure you understand what you are doing and be prepared to keep the pieces if something breaks.
931c60c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@zyv wow, I'd be happy to see this as
1.11.17
!I also use 1.11.16 with python3.7 and I have to edit that one line manually each time to get it working.
931c60c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've opened a thread on django-developers about adding Python 3.7 support to Django 1.11.x.
931c60c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yury, create a pull request with your branch so we can see if all tests pass there.
931c60c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi Tim, done in #10654; thank you for being open minded about this and for all your work on Django, irrespectively of the outcome of this thread!