Adityakk9031 commented on code in PR #70946: URL: https://github.com/apache/airflow/pull/70946#discussion_r4096628457
########## scripts/ci/prek/common_prek_utils.py: ########## @@ -118,7 +118,7 @@ def run_command(*args, **kwargs) -> None: def read_airflow_version() -> str: - ast_obj = ast.parse((AIRFLOW_CORE_SOURCES_PATH / "airflow" / "__init__.py").read_text()) + ast_obj = ast.parse((AIRFLOW_CORE_SOURCES_PATH / "airflow" / "__init__.py").read_text(encoding="utf-8")) Review Comment: On Windows, Python's default encoding for open() and Path.read_text() is still based on the system locale (locale.getpreferredencoding(False), typically cp1252 on Western Windows locales), not UTF-8. Python only makes UTF-8 the default across all platforms starting in Python 3.15 (PEP 686). On Python 3.9–3.14 without UTF-8 mode explicitly enabled, reading files with non-ASCII characters without encoding=\utf-8\ raises UnicodeDecodeError: 'charmap' codec can't decode byte 0x81.... Explicitly passing encoding=\utf-8\ ensures consistent cross-platform behavior. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
