This is an automated email from the ASF dual-hosted git repository.

potiuk pushed a commit to branch v2-8-test
in repository https://gitbox.apache.org/repos/asf/airflow.git

commit 7c28ba76e0cd8cbb2455ccf962163f7790087f86
Author: Andrey Anshin <andrey.ans...@taragol.is>
AuthorDate: Sat Feb 17 03:36:03 2024 +0400

    Replace other Python 3.11 and 3.12 deprecations (#37478)
    
    * Replace usage of deprecated typing classes (Python 3.12)
    
    * Replace usage of locale.getdefaultlocale (Python 3.11)
    
    (cherry picked from commit ef70594358f5e5e3aa7c27de621869aa5d4b2d27)
---
 airflow/cli/commands/info_command.py | 2 +-
 airflow/exceptions.py                | 3 ++-
 airflow/models/expandinput.py        | 3 ++-
 pyproject.toml                       | 6 ++++++
 4 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/airflow/cli/commands/info_command.py 
b/airflow/cli/commands/info_command.py
index 3d72e4641e..83c62f7188 100644
--- a/airflow/cli/commands/info_command.py
+++ b/airflow/cli/commands/info_command.py
@@ -259,7 +259,7 @@ class AirflowInfo:
         operating_system = OperatingSystem.get_current()
         arch = Architecture.get_current()
         uname = platform.uname()
-        _locale = locale.getdefaultlocale()
+        _locale = locale.getlocale()
         python_location = self.anonymizer.process_path(sys.executable)
         python_version = sys.version.replace("\n", " ")
 
diff --git a/airflow/exceptions.py b/airflow/exceptions.py
index 2ca75cbbf8..f747640c77 100644
--- a/airflow/exceptions.py
+++ b/airflow/exceptions.py
@@ -22,12 +22,13 @@ from __future__ import annotations
 
 import warnings
 from http import HTTPStatus
-from typing import TYPE_CHECKING, Any, NamedTuple, Sized
+from typing import TYPE_CHECKING, Any, NamedTuple
 
 from airflow.utils.trigger_rule import TriggerRule
 
 if TYPE_CHECKING:
     import datetime
+    from collections.abc import Sized
 
     from airflow.models import DAG, DagRun
 
diff --git a/airflow/models/expandinput.py b/airflow/models/expandinput.py
index 44f26a3483..a20280e5a1 100644
--- a/airflow/models/expandinput.py
+++ b/airflow/models/expandinput.py
@@ -20,7 +20,8 @@ from __future__ import annotations
 import collections.abc
 import functools
 import operator
-from typing import TYPE_CHECKING, Any, Dict, Iterable, Mapping, NamedTuple, 
Sequence, Sized, Union
+from collections.abc import Sized
+from typing import TYPE_CHECKING, Any, Dict, Iterable, Mapping, NamedTuple, 
Sequence, Union
 
 import attr
 
diff --git a/pyproject.toml b/pyproject.toml
index 67cf05952a..34e8faa1cb 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1370,9 +1370,15 @@ banned-module-level-imports = ["numpy", "pandas"]
 "airflow.AirflowException".msg = "Use airflow.exceptions.AirflowException 
instead."
 "airflow.Dataset".msg = "Use airflow.datasets.Dataset instead."
 "airflow.models.baseoperator.BaseOperatorLink".msg = "Use 
airflow.models.baseoperatorlink.BaseOperatorLink"
+# Deprecated in Python 3.11, Pending Removal in Python 3.15: 
https://github.com/python/cpython/issues/90817
+# Deprecation warning in Python 3.11 also recommends using locale.getencoding 
but it available in Python 3.11
+"locale.getdefaultlocale".msg = "Use locale.setlocale() and locale.getlocale() 
instead."
 # Deprecated in Python 3.12: https://github.com/python/cpython/issues/103857
 "datetime.datetime.utcnow".msg = "Use airflow.utils.timezone.utcnow or 
datetime.datetime.now(tz=datetime.timezone.utc)"
 "datetime.datetime.utcfromtimestamp".msg = "Use 
airflow.utils.timezone.from_timestamp or 
datetime.datetime.fromtimestamp(tz=datetime.timezone.utc)"
+# Deprecated in Python 3.12: https://github.com/python/cpython/issues/94309
+"typing.Hashable".msg = "Use collections.abc.Hashable"
+"typing.Sized".msg = "Use collections.abc.Sized"
 # Uses deprecated in Python 3.12 `datetime.datetime.utcfromtimestamp`
 "pendulum.from_timestamp".msg = "Use airflow.utils.timezone.from_timestamp"
 

Reply via email to