#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 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)

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 (2)

comment:1 Changed 14 months ago by shai

  • Cc shai added
  • Component changed from Core (Other) to Database layer (models, ORM)
  • Description modified (diff)
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

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.

comment:2 Changed 14 months ago by timo

  • Resolution set to needsinfo
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.
Back to Top