Skip to content

Commit

Permalink
Merge pull request #2599 from Kodiologist/update-get-code
Browse files Browse the repository at this point in the history
Update `_get_code_from_file` for Python 3.12.6
  • Loading branch information
Kodiologist authored Sep 12, 2024
2 parents ed524c6 + 69b3c23 commit 0aa9370
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions NEWS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Unreleased

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

0.29.0 (released 2024-05-20)
Expand Down
1 change: 1 addition & 0 deletions hy/compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
PY3_10 = sys.version_info >= (3, 10)
PY3_11 = sys.version_info >= (3, 11)
PY3_12 = sys.version_info >= (3, 12)
PY3_12_6 = sys.version_info >= (3, 12, 6)
PYPY = platform.python_implementation() == "PyPy"
PYODIDE = platform.system() == "Emscripten"

Expand Down
2 changes: 1 addition & 1 deletion hy/importer.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def _get_code_from_file(run_name, fname=None, hy_src_check=lambda x: x.endswith(
source = f.read().decode("utf-8")
code = compile(source, fname, "exec")

return (code, fname)
return code if hy.compat.PY3_12_6 else (code, fname)


importlib.machinery.SOURCE_SUFFIXES.insert(0, ".hy")
Expand Down

0 comments on commit 0aa9370

Please sign in to comment.