#32316: Access __file__ lazily rather than at module level
-------------------------------------+-------------------------------------
     Reporter:  William Schwartz     |                    Owner:  William
         Type:                       |  Schwartz
  Cleanup/optimization               |                   Status:  assigned
    Component:  Uncategorized        |                  Version:  master
     Severity:  Normal               |               Resolution:
     Keywords:  freezers             |             Triage Stage:
                                     |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by William Schwartz):

 > If we do go forward with this, how do we catch future uses of `__file__`
 at the module level?

 Great question, and here's my terrible answer: I propose ''not'' to—for
 now. This is part of what I meant in my original post about "not proposing
 banning use of `__file__` at the module level at this time."

 The main reason is that I think testing for module-level use of
 `__file__`—as well as all the other subtleties involved in using Python
 freezers—will be easiest and most thorough if we now and then (or
 regularly on CI...) run the entire Django test suite from inside, say,
 [https://pyoxidizer.readthedocs.io/ PyOxidizer] or one of the other full-
 featured freezers. But doing that only makes sense in the context of
 solving all the impediments to using Django with freezers. As discussed
 elsewhere, such as at #30950 and on [https://groups.google.com/g/django-
 developers/c/UXsG5xZNRgY django-developers] prior to #32302, that's too
 much to solve in one go.

 I view this ticket just as a way to nudge Django 3.2 toward more freezer
 friendliness before beta testing season. My (small) team then plans to
 dogfood the 3.2 betas this spring while developing an app we'll be running
 from PyOxidizer, so I'm hoping we'll notice if `__file__` sneaks back in
 somewhere that would cause a frozen Python to crash.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/32316#comment:4>
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 on the web visit 
https://groups.google.com/d/msgid/django-updates/068.69134ab2b711fcc6f81ba674ec3d81d2%40djangoproject.com.

Reply via email to