Skip to content

Commit 5f13ad9

Browse files
Pete Wardenpetewarden
Pete Warden
authored andcommitted
Fixes __version__ not found error with Python 3.13 (see python/cpython#118888)
1 parent 4a00042 commit 5f13ad9

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

moonshine-onnx/setup.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55

66

77
def read_version(fname="src/version.py"):
8-
exec(compile(open(fname, encoding="utf-8").read(), fname, "exec"))
9-
return locals()["__version__"]
10-
8+
my_locals = {}
9+
exec(compile(open(fname, encoding="utf-8").read(), fname, "exec"), locals=my_locals)
10+
return my_locals["__version__"]
1111

1212
setup(
1313
name="useful-moonshine-onnx",

setup.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55

66

77
def read_version(fname="moonshine/version.py"):
8-
exec(compile(open(fname, encoding="utf-8").read(), fname, "exec"))
9-
return locals()["__version__"]
10-
8+
my_locals = {}
9+
exec(compile(open(fname, encoding="utf-8").read(), fname, "exec"), locals=my_locals)
10+
return my_locals["__version__"]
1111

1212
setup(
1313
name="useful-moonshine",

0 commit comments

Comments
 (0)