Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#28183 closed Bug (invalid)

objects.create(**dictionary, key=value) regression in 1.11

Reported by: MMeent Owned by: nobody
Component: Database layer (models, ORM) Version: 1.11
Severity: Normal Keywords: objects.create
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Hi,

We recently tried to move to django 1.11.x on python 3.4, and were suprised that our tests failed on the following:

[16:37:37] :	 [Step 1/4] --- Environment information:
[16:37:37] :	 [Step 1/4] ------------------------
[16:37:37] :	 [Step 1/4] --- Python version:
[16:37:37] :	 [Step 1/4] Python 3.4.2
[16:37:37] :	 [Step 1/4] --- Pip version:
[16:37:37] :	 [Step 1/4] pip 9.0.1 from /<...>/lib/python3.4/site-packages (python 3.4)
[16:37:37] :	 [Step 1/4] --- Environment packages:
[16:37:38] :	 [Step 1/4] appdirs (1.4.3)
[16:37:38] :	 [Step 1/4] Django (1.11.1)
[16:37:38] :	 [Step 1/4] django-cors-headers (1.3.1)
[16:37:38] :	 [Step 1/4] django-gravatar2 (1.4.0)
[16:37:38] :	 [Step 1/4] djangorestframework (3.6.2)
[16:37:38] :	 [Step 1/4] docutils (0.13.1)
[16:37:38] :	 [Step 1/4] olefile (0.44)
[16:37:38] :	 [Step 1/4] packaging (16.8)
[16:37:38] :	 [Step 1/4] Pillow (4.1.1)
[16:37:38] :	 [Step 1/4] pip (9.0.1)
[16:37:38] :	 [Step 1/4] pyparsing (2.2.0)
[16:37:38] :	 [Step 1/4] pytz (2017.2)
[16:37:38] :	 [Step 1/4] reportlab (3.4.0)
[16:37:38] :	 [Step 1/4] setuptools (35.0.2)
[16:37:38] :	 [Step 1/4] six (1.10.0)
[16:37:38] :	 [Step 1/4] teamcity-messages (1.21)
<...>
[16:37:51]W:	 [Step 3/4]   File "/<...>/work/www/urls.py", line 16, in <module>
[16:37:51]W:	 [Step 3/4]     url(r'^article/', include('article.urls')),
[16:37:51]W:	 [Step 3/4]   File "/<...>/lib/python3.4/site-packages/django/conf/urls/__init__.py", line 50, in include
[16:37:51]W:	 [Step 3/4]     urlconf_module = import_module(urlconf_module)
[16:37:51]W:	 [Step 3/4]   File "/<...>/lib/python3.4/importlib/__init__.py", line 109, in import_module
[16:37:51]W:	 [Step 3/4]     return _bootstrap._gcd_import(name[level:], package, level)
[16:37:51]W:	 [Step 3/4]   File "<frozen importlib._bootstrap>", line 2254, in _gcd_import
[16:37:51]W:	 [Step 3/4]   File "<frozen importlib._bootstrap>", line 2237, in _find_and_load
[16:37:51]W:	 [Step 3/4]   File "<frozen importlib._bootstrap>", line 2226, in _find_and_load_unlocked
[16:37:51]W:	 [Step 3/4]   File "<frozen importlib._bootstrap>", line 1200, in _load_unlocked
[16:37:51]W:	 [Step 3/4]   File "<frozen importlib._bootstrap>", line 1129, in _exec
[16:37:51]W:	 [Step 3/4]   File "<frozen importlib._bootstrap>", line 1471, in exec_module
[16:37:51]W:	 [Step 3/4]   File "<frozen importlib._bootstrap>", line 321, in _call_with_frames_removed
[16:37:51]W:	 [Step 3/4]   File "/<...>/work/article/urls.py", line 3, in <module>
[16:37:51]W:	 [Step 3/4]     from article import views
[16:37:51]W:	 [Step 3/4]   File "/<...>/work/article/views.py", line 5, in <module>
[16:37:51]W:	 [Step 3/4]     from article.serializers import ArticleTypeSerializer
[16:37:51]W:	 [Step 3/4]   File "/<...>/work/article/serializers.py", line 6, in <module>
[16:37:51]W:	 [Step 3/4]     from money.serializers import MoneySerializerField
[16:37:51]W:	 [Step 3/4]   File "/<...>/work/money/serializers.py", line 138
[16:37:51]W:	 [Step 3/4]     VATPeriod.objects.create(**vp_data, vat=vat)
[16:37:51]W:	 [Step 3/4]                                       ^
[16:37:51]W:	 [Step 3/4] SyntaxError: invalid syntax
[16:37:52]W:	 [Step 3/4] Process exited with code 1

When I set the requirements.txt from >=1.10 to ~=1.10, our tests complete with the following dependencies:

[16:53:22] :	 [Step 1/4] --- Environment information:
[16:53:22] :	 [Step 1/4] ------------------------
[16:53:22] :	 [Step 1/4] --- Python version:
[16:53:22] :	 [Step 1/4] Python 3.4.2
[16:53:22] :	 [Step 1/4] --- Pip version:
[16:53:22] :	 [Step 1/4] pip 9.0.1 from /<...>/lib/python3.4/site-packages (python 3.4)
[16:53:22] :	 [Step 1/4] --- Environment packages:
[16:53:23] :	 [Step 1/4] appdirs (1.4.3)
[16:53:23] :	 [Step 1/4] Django (1.10.7)
[16:53:23] :	 [Step 1/4] django-cors-headers (1.3.1)
[16:53:23] :	 [Step 1/4] django-gravatar2 (1.4.0)
[16:53:23] :	 [Step 1/4] djangorestframework (3.6.2)
[16:53:23] :	 [Step 1/4] docutils (0.13.1)
[16:53:23] :	 [Step 1/4] olefile (0.44)
[16:53:23] :	 [Step 1/4] packaging (16.8)
[16:53:23] :	 [Step 1/4] Pillow (4.1.1)
[16:53:23] :	 [Step 1/4] pip (9.0.1)
[16:53:23] :	 [Step 1/4] pyparsing (2.2.0)
[16:53:23] :	 [Step 1/4] reportlab (3.4.0)
[16:53:23] :	 [Step 1/4] setuptools (35.0.2)
[16:53:23] :	 [Step 1/4] six (1.10.0)
[16:53:23] :	 [Step 1/4] teamcity-messages (1.21)

Attachments (2)

Change History (4)

comment:1 Changed 3 years ago by Tim Graham

Resolution: invalid
Status: newclosed

The SyntaxError (not from Django) is because that syntax is introduced in Python 3.5 and your deployment is using Python 3.4.

comment:2 Changed 3 years ago by MMeent

OK, I didn't expect the issue to come from that direction. Thanks for pointing out my oversight!

Note: See TracTickets for help on using tickets.
Back to Top