Changes between Version 59 and Version 60 of DjangoSpecifications/Core/Threading
- Timestamp:
- Nov 18, 2008, 2:19:36 AM (16 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
DjangoSpecifications/Core/Threading
v59 v60 4 4 5 5 = 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.''' 6 8 7 9 Relevant tickets: #5632, #6950, #1442, #7676. … … 57 59 Incomplete 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): 58 60 59 ''' BAD'''61 '''WRONG''' 60 62 {{{ 61 63 foo = [] … … 67 69 }}} 68 70 69 ''' BETTER'''71 '''RIGHT''' 70 72 {{{ 71 73 foo = None … … 80 82 }}} 81 83 82 There is at least one location in code that uses the "bad" algorithm.83 84 85 84 == Globals == 86 85 … … 103 102 ||django/template/context.py||`_standard_context_processors`||OK||double `__import__`|| 104 103 ||`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__`|| 106 105 ||django/template/loaders/app_directories.py||`app_template_dirs`||MODULE LEVEL INIT|||| 107 106 ||django/utils/translation/trans_real.py||`_accepted, _active, _default, _translations`||OK||explicit threading support, no inefficiencies|| 108 107 ||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|||| 110 109 ||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()`|| 111 110 ||django/db/transaction.py||`dirty, state`||OK||explicit threading support, no inefficiencies|| … … 114 113 === Problems === 115 114 116 1. `django/template/loader.py`: the " bad" algorithm above, patch attached to#6950117 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: 118 117 {{{ 119 118 1. thread 1: if not _serializers: true --> _load_serializers(), enter for loop