#10112: Python Crash with ORM Inheritance
----------------------------------------------------+-----------------------
          Reporter:  [email protected]  |         Owner:  nobody  
            Status:  new                            |     Milestone:  post-1.0
         Component:  Database layer (models, ORM)   |       Version:  1.0     
        Resolution:                                 |      Keywords:          
             Stage:  Unreviewed                     |     Has_patch:  0       
        Needs_docs:  0                              |   Needs_tests:  0       
Needs_better_patch:  0                              |  
----------------------------------------------------+-----------------------
Changes (by Alex):

  * needs_better_patch:  => 0
  * needs_tests:  => 0
  * needs_docs:  => 0

Old description:

> This bug causes a reproducible crash in the python interpreter [python
> issue5014] on my system, so I can't give a specific traceback, but I
> believe that an infinite recursion is generated when I try and use the
> db_column in a TextField.
>
> Basically, I'm modifying one of my models to allow inheritance of a field
> so rather than keep the existing field which cannot be overridden with a
> function in the subclass, I'm creating a property to access the field -
> ie:
>
> class Foo(model):
>   _bar = TextField(db_column = 'bar')
>
>   bar = property(lambda x: x.bar)
>
> class Bla(Foo):
>   @property
>   def bar(self): whatever
>

> I think the db_column = 'bar' causes problems as there is a Foo.bar
> attribute so somewhere in the model this is screwing things up by making
> an infinite loop which for some reason is breaking the python runtime.
>
> Reproducible with revision 9787

New description:

 This bug causes a reproducible crash in the python interpreter [python
 issue5014] on my system, so I can't give a specific traceback, but I
 believe that an infinite recursion is generated when I try and use the
 db_column in a TextField.

 Basically, I'm modifying one of my models to allow inheritance of a field
 so rather than keep the existing field which cannot be overridden with a
 function in the subclass, I'm creating a property to access the field -
 ie:
 {{{
 class Foo(model):
   _bar = TextField(db_column = 'bar')

   bar = property(lambda x: x.bar)

 class Bla(Foo):
   @property
   def bar(self): whatever

 }}}
 I think the db_column = 'bar' causes problems as there is a Foo.bar
 attribute so somewhere in the model this is screwing things up by making
 an infinite loop which for some reason is breaking the python runtime.

 Reproducible with revision 9787

Comment:

 edited for readability, please use the preview feature :)

-- 
Ticket URL: <http://code.djangoproject.com/ticket/10112#comment:1>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to