#36961: django_file_prefixes() raises AttributeError if Django is imported by
namespace
-------------------------------------------+-----------------------------
               Reporter:  Jacob Walls      |          Owner:  Jacob Walls
                   Type:  Bug              |         Status:  assigned
              Component:  Utilities        |        Version:  6.0
               Severity:  Release blocker  |       Keywords:
           Triage Stage:  Unreviewed       |      Has patch:  1
    Needs documentation:  0                |    Needs tests:  0
Patch needs improvement:  0                |  Easy pickings:  0
                  UI/UX:  0                |
-------------------------------------------+-----------------------------
 cd one level above your django checkout, and launch a python shell.

 Calling django_file_prefixes will fail:

 {{{#!py
 >>> import django
 >>> django.__file__ is None
 True
 >>> from django.utils.deprecation import django_file_prefixes
 >>> django_file_prefixes()
 Traceback (most recent call last):
   File "<python-input-1>", line 5, in <module>
     django_file_prefixes()
     ~~~~~~~~~~~~~~~~~~~~^^
   File "/Users/jwalls/django/django/utils/deprecation.py", line 18, in
 django_file_prefixes
     return (os.path.dirname(file),)
             ~~~~~~~~~~~~~~~^^^^^^
   File "<frozen posixpath>", line 178, in dirname
 TypeError: expected str, bytes or os.PathLike object, not NoneType
 }}}
 ----
 How I found this was by testing deprecation warnings, so what I'm
 concluding is that deprecation warnings might crash in 6.0 if you import
 Django by namespace.
-- 
Ticket URL: <https://code.djangoproject.com/ticket/36961>
Django <https://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 unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/django-updates/0107019ca09e7235-d54dd9e3-cf7d-4b14-8780-31e050c4a090-000000%40eu-central-1.amazonses.com.

Reply via email to