Skip to content

Commit 69b3c23

Browse files
committed
Update _get_code_from_file for Python 3.12.6
python/cpython#107644
1 parent ed524c6 commit 69b3c23

File tree

3 files changed

+3
-1
lines changed

3 files changed

+3
-1
lines changed

NEWS.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ Unreleased
55

66
Bug Fixes
77
------------------------------
8+
* Fixed a crash on Python 3.12.6.
89
* Keyword objects can now be compared to each other with `<` etc.
910

1011
0.29.0 (released 2024-05-20)

hy/compat.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
PY3_10 = sys.version_info >= (3, 10)
77
PY3_11 = sys.version_info >= (3, 11)
88
PY3_12 = sys.version_info >= (3, 12)
9+
PY3_12_6 = sys.version_info >= (3, 12, 6)
910
PYPY = platform.python_implementation() == "PyPy"
1011
PYODIDE = platform.system() == "Emscripten"
1112

hy/importer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ def _get_code_from_file(run_name, fname=None, hy_src_check=lambda x: x.endswith(
9999
source = f.read().decode("utf-8")
100100
code = compile(source, fname, "exec")
101101

102-
return (code, fname)
102+
return code if hy.compat.PY3_12_6 else (code, fname)
103103

104104

105105
importlib.machinery.SOURCE_SUFFIXES.insert(0, ".hy")

0 commit comments

Comments
 (0)