Files
matt-o-howandGitHub 235340a24b Prevent None version in __init__.py (#20453)
* prevent None version

* Fix comparison of __version__ to None
2026-02-04 10:13:19 -08:00

25 lines
634 B
Python

from __future__ import annotations
import sys
from importlib.metadata import PackageNotFoundError, version
__version__: str
try:
__version__ = version("chia-blockchain")
except (PackageNotFoundError, KeyError):
__version__ = "unknown"
if __version__ is None:
__version__ = "unknown"
try:
assert False
except AssertionError:
pass
else:
raise Exception("asserts are not working and _must_ be enabled, do not run with an optimized build of python")
if not getattr(sys, "_is_gil_enabled", lambda: True)():
raise Exception("freethreading is not supported, do not run with a freethreaded build of python")