[Django] #28269: Fix Model._meta._property_names to work with attributes raise AttributeError

9 views
Skip to first unread message

Django

unread,
Jun 2, 2017, 6:48:54 PM6/2/17
to django-...@googlegroups.com
#28269: Fix Model._meta._property_names to work with attributes raise
AttributeError
-------------------------------------+-------------------------------------
Reporter: Adam | Owner: nobody
(Chainz) Johnson |
Type: Bug | Status: new
Component: Database | Version: 1.11
layer (models, ORM) |
Severity: Normal | Keywords:
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
As reported on the mailing list at https://groups.google.com/forum/#!msg
/django-developers/ClQ0mCJ-a6Y/FOYTz98yBgAJ , the optimization I did in
model __init__ in commit d2a26c1a90e837777dabdf3d67ceec4d2a70fb86 did not
copy in a try/except AttributeError. This fails because some third party
apps install "class only" descriptors that raise AttributeError when not
accessed in an instance, for example: https://github.com/kmmbvnr/django-
fsm/blob/2d2eaee/django_fsm/__init__.py#L225

_property_names should be changed to try/except AttributeError when
accessing the attributes on the class, and we should add a test to prevent
regression.

--
Ticket URL: <https://code.djangoproject.com/ticket/28269>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Jun 2, 2017, 6:51:06 PM6/2/17
to django-...@googlegroups.com
#28269: Fix Model._meta._property_names to work with attributes that raise
AttributeError
-------------------------------------+-------------------------------------
Reporter: Adam (Chainz) | Owner: nobody

Johnson |
Type: Bug | Status: new
Component: Database layer | Version: 1.11
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

--
Ticket URL: <https://code.djangoproject.com/ticket/28269#comment:1>

Django

unread,
Jun 2, 2017, 6:57:03 PM6/2/17
to django-...@googlegroups.com
#28269: Fix Model._meta._property_names to work with attributes that raise
AttributeError
-------------------------------------+-------------------------------------
Reporter: Adam (Chainz) | Owner: nobody

Johnson |
Type: Bug | Status: new
Component: Database layer | Version: 1.11
(models, ORM) |
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Graham):

* severity: Normal => Release blocker
* stage: Unreviewed => Accepted


--
Ticket URL: <https://code.djangoproject.com/ticket/28269#comment:2>

Django

unread,
Jun 4, 2017, 6:01:14 PM6/4/17
to django-...@googlegroups.com
#28269: Fix Model._meta._property_names to work with attributes that raise
AttributeError
-------------------------------------+-------------------------------------
Reporter: Adam (Chainz) | Owner: nobody

Johnson |
Type: Bug | Status: new
Component: Database layer | Version: 1.11
(models, ORM) |
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Adam (Chainz) Johnson):

[https://github.com/django/django/pull/8599 PR]

--
Ticket URL: <https://code.djangoproject.com/ticket/28269#comment:3>

Django

unread,
Jun 5, 2017, 12:22:13 AM6/5/17
to django-...@googlegroups.com
#28269: Fix Model._meta._property_names to work with attributes that raise
AttributeError
-------------------------------------+-------------------------------------
Reporter: Adam (Chainz) | Owner: nobody

Johnson |
Type: Bug | Status: new
Component: Database layer | Version: 1.11
(models, ORM) |
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Adam (Chainz) Johnson):

* has_patch: 0 => 1


--
Ticket URL: <https://code.djangoproject.com/ticket/28269#comment:4>

Django

unread,
Jun 5, 2017, 9:15:59 AM6/5/17
to django-...@googlegroups.com
#28269: Fix Model._meta._property_names to work with attributes that raise
AttributeError
-------------------------------------+-------------------------------------

Reporter: Adam (Chainz) | Owner: nobody
Johnson |
Type: Bug | Status: closed

Component: Database layer | Version: 1.11
(models, ORM) |
Severity: Release blocker | Resolution: fixed
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Graham <timograham@…>):

* status: new => closed
* resolution: => fixed


Comment:

In [changeset:"ed244199c72f5bbf33ab4547e06e69873d7271d0" ed24419]:
{{{
#!CommitTicketReference repository=""
revision="ed244199c72f5bbf33ab4547e06e69873d7271d0"
Fixed #28269 -- Fixed Model.__init__() crash on models with a field that
has an instance only descriptor.

Regression in d2a26c1a90e837777dabdf3d67ceec4d2a70fb86.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/28269#comment:5>

Django

unread,
Jun 5, 2017, 9:33:52 AM6/5/17
to django-...@googlegroups.com
#28269: Fix Model._meta._property_names to work with attributes that raise
AttributeError
-------------------------------------+-------------------------------------

Reporter: Adam (Chainz) | Owner: nobody
Johnson |
Type: Bug | Status: closed
Component: Database layer | Version: 1.11
(models, ORM) |
Severity: Release blocker | Resolution: fixed
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Tim Graham <timograham@…>):

In [changeset:"b7d6077517c6cb2daa5e5faf2ae9f94698c06ca9" b7d6077]:
{{{
#!CommitTicketReference repository=""
revision="b7d6077517c6cb2daa5e5faf2ae9f94698c06ca9"
[1.11.x] Fixed #28269 -- Fixed Model.__init__() crash on models with a


field that has an instance only descriptor.

Regression in d2a26c1a90e837777dabdf3d67ceec4d2a70fb86.

Backport of ed244199c72f5bbf33ab4547e06e69873d7271d0 from master
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/28269#comment:6>

Reply all
Reply to author
Forward
0 new messages