Opened 10 years ago

Last modified 10 years ago

#22877 closed Uncategorized

Segfault when converting objects.prefetch_related into boolean condition. — at Version 1

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)

Hi,
Lets take the following models:

#models.py
class Item()
class UserProfile()
class Appreciation(models.Model):
    item = models.ForeignKey(Item,
                              verbose_name=_('item_appreciations'),
                              related_name='item_appreciation')
    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:

#Main.py
if Item.objects.prefetch_related('item_appreciation'):
    print 'lol'

Change History (1)

comment:1 by Shai Berger, 10 years ago

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

Hi,

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.

Thanks,
Shai.

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