Skip to content

Commit

Permalink
Merge pull request #3 from CMB/py312
Browse files Browse the repository at this point in the history
Don't use the imp module that was removed in Python 3.12.
  • Loading branch information
ctoth committed Dec 6, 2023
2 parents 926ee44 + fb8f412 commit e0d79f7
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions platform_utils/paths.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@

def is_frozen():
""" """
import imp
# imp was removed in Python 3.12, but _imp still contains is_frozen.
# This is what cffi (https://cffi.readthedocs.io) uses.
import _imp

return hasattr(sys, "frozen") or '__compiled__' in globals() or imp.is_frozen("__main__")
return hasattr(sys, "frozen") or '__compiled__' in globals() or _imp.is_frozen("__main__")


plat = platform.system()
Expand Down

0 comments on commit e0d79f7

Please sign in to comment.