django.forms.Field is not thread-safe
|Reported by:||anonymous||Owned by:||nobody|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
django.forms.Field has the 'creation_counter' attribute which is incremented when an instance of django.forms.Field (or one of its subclasses) is created. I DO understand that it's a bit unusual to create
forms in the runtime, so this must not be a big issue (or not a bug at all), but it should be documented somewhere.
In : from django import forms In : forms.Field.creation_counter Out: 0 In : from threading import Thread In : def f(): .....: for x in xrange(10000): .....: forms.Field() .....: In : ths = [Thread(target=f) for x in xrange(4)] In : for t in ths: t.start() In : for t in ths: t.join() In : forms.Field.creation_counter Out: 35409