Changes between Version 59 and Version 60 of DjangoSpecifications/Core/Threading


Ignore:
Timestamp:
Nov 18, 2008, 2:19:36 AM (16 years ago)
Author:
mrts
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • DjangoSpecifications/Core/Threading

    v59 v60  
    44
    55= Django threading review =
     6
     7'''Summary: as of 1.0, Django is thread-safe. If you find a threading bug, please file a ticket with ''threading'' keyword.'''
    68
    79Relevant tickets: #5632, #6950, #1442, #7676.
     
    5759Incomplete initialization errors can generally be avoided by using full assignment instead of elementwise modification; additionally, to make sure no further modifications of a list can happen, tuples should be used instead of lists (inspired by source:django/trunk/django/template/context.py@7415#L86):
    5860
    59 '''BAD'''
     61'''WRONG'''
    6062{{{
    6163foo = []
     
    6769}}}
    6870
    69 '''BETTER'''
     71'''RIGHT'''
    7072{{{
    7173foo = None
     
    8082}}}
    8183
    82 There is at least one location in code that uses the "bad" algorithm.
    83 
    84 
    8584== Globals ==
    8685
     
    103102||django/template/context.py||`_standard_context_processors`||OK||double `__import__`||
    104103||`django/template/__init__.py`||`invalid_var_format_string, libraries, builtins`||OK||double `__import__`||
    105 ||django/template/loader.py||`template_source_loaders`||PROBLEM, see #6950, patch attached||double `__import__`||
     104||django/template/loader.py||`template_source_loaders`||Fixed with #6950||double `__import__`||
    106105||django/template/loaders/app_directories.py||`app_template_dirs`||MODULE LEVEL INIT||||
    107106||django/utils/translation/trans_real.py||`_accepted, _active, _default, _translations`||OK||explicit threading support, no inefficiencies||
    108107||django/core/urlresolvers.py||`_callable_cache, _resolver_cache`||OK, `memoize` decorator||double `__import__`||
    109 ||`django/core/serializers/__init__.py`||`_serializers`||PROBLEM, see #7676, incomplete init in `_load_serializers`||||
     108||`django/core/serializers/__init__.py`||`_serializers`||Fixed with #7676||||
    110109||django/db/models/fields/related.py||`pending_lookups`||OK?, needs further review||`append()` in `add_lazy_relation()` can add duplicated values, which may or may not confuse `pop()` in `do_pending_lookups()`||
    111110||django/db/transaction.py||`dirty, state`||OK||explicit threading support, no inefficiencies||
     
    114113=== Problems ===
    115114
    116  1. `django/template/loader.py`: the "bad" algorithm above, patch attached to #6950
    117  1. `django/core/serializers/__init__.py`: `_load_serializers()` is unsafe, patch attached to #7676:
     115 1. `django/template/loader.py`: the "wrong" algorithm above, fixed with #6950
     116 1. `django/core/serializers/__init__.py`: `_load_serializers()` is unsafe, fixed with #7676:
    118117{{{
    1191181. thread 1: if not _serializers: true --> _load_serializers(), enter for loop
Back to Top