Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add clean fix for WindowsPath type when calling read_env() method #287

Closed

Conversation

Moon-developer
Copy link

Fix for issue #286 (WindowsPath read error)

Changes made:

  • Importing WindowsPath from pathlib library in environ.py
  • Isinstance check added to find WindowsPath and call "dunder string".
  • implements a non-defaulted "dunder string" method (str). Casting to str() is slower.

Time difference of using "dunder string" as opposed to casting:

from timeit import timeit

timeit(lambda:str(p),number=10000000)
>>> 2.3293891000000713

timeit(lambda:p.__str__(),number=10000000)
>>> 1.3876856000000544

@xrmx
Copy link

xrmx commented Mar 10, 2021

@Moon-developer Have you tried #281 instead?

@sergeyklay
Copy link
Collaborator

This is resolved in develop branch. Thank you for the patch, and for helping us make django-environ better. And I am sorry about the delay.

@sergeyklay sergeyklay closed this Aug 31, 2021
@sergeyklay sergeyklay added the enhancement New feature or request label Aug 31, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants