Ver código fonte

Fixed #32740 -- Caught possible exception when initializing colorama.

Carlton Gibson 3 anos atrás
pai
commit
c2e6047c72
2 arquivos alterados com 6 adições e 2 exclusões
  1. 2 2
      django/core/management/color.py
  2. 4 0
      docs/releases/3.2.4.txt

+ 2 - 2
django/core/management/color.py

@@ -10,10 +10,10 @@ from django.utils import termcolors
 
 try:
     import colorama
-except ImportError:
+    colorama.init()
+except (ImportError, OSError):
     HAS_COLORAMA = False
 else:
-    colorama.init()
     HAS_COLORAMA = True
 
 

+ 4 - 0
docs/releases/3.2.4.txt

@@ -18,3 +18,7 @@ Bugfixes
 
 * Prevented unnecessary initialization of unused caches following a regression
   in Django 3.2 (:ticket:`32747`).
+
+* Fixed a crash in Django 3.2 that could occur when running ``mod_wsgi`` with
+  the recommended settings while the Windows ``colorama`` library was installed
+  (:ticket:`32740`).