Opened 4 years ago

Closed 4 years ago

#22877 closed Uncategorized (needsinfo)

Segfault when converting objects.prefetch_related into boolean condition.

Reported by: maxime.blanchemain@… Owned by: nobody
Component: Database layer (models, ORM) Version: 1.6
Severity: Normal Keywords: Segmentation Fault,
Cc: Shai Berger Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Shai Berger)

Lets take the following models:
class Item()
class UserProfile()
class Appreciation(models.Model):
    item = models.ForeignKey(Item,
    user_profile = models.ForeignKey(
        UserProfile, verbose_name=_('user profile'), related_name='user_profile_appreciation'

With a populated database, the following line trigger a Segmentation fault:
if Item.objects.prefetch_related('item_appreciation'):
    print 'lol'

Change History (2)

comment:1 Changed 4 years ago by Shai Berger

Cc: Shai Berger added
Component: Core (Other)Database layer (models, ORM)
Description: modified (diff)


When segmentation faults are involved, we need to know many more details in order to be able to verify and take action. In particular:

Platform (that is, which operating system are you using?)
Exact Python version;
Exact Django version;
Database backend;
Exact version of database library;
Anything else of this kind that might seem relevant.

We know about segmentation faults with Python 3 (any version of Python 3), using Oracle and cx_Oracle 5.1.2 on Linux with Django>=1.5. This was a bug in cx_Oracle that was solved in 5.1.3, released recently. If your situation is different, we'll be very interested to learn about it.


comment:2 Changed 4 years ago by Tim Graham

Resolution: needsinfo
Status: newclosed
Note: See TracTickets for help on using tickets.
Back to Top