python-babel: FTBFS building against python 3.15

Maximiliano Curia <[email protected]>
Newsgroups gmane.linux.debian.devel.python
Message-ID <[email protected]>
Package: src:python-babel
Version: 2.18.0-1
User: [email protected]
Usertags: python3.15
Tags: patch

Hi!

While rebuilding the python related packages against the python version
3.15rc1 we found that python-typing-extensions fails to build from
source[1].

This problem is already tackled upstream with the commit f42ed4e9 Update
tests and code for CLDR 48.2 [2], we backported the relevant parts of that
commit to the current Debian version so we can keep rebuilding the
packages that depend on python-babel in our sandbox.

Please consider including this patch in your next upload.

Happy hacking,

[1]: https://debusine.debian.net/debian/r-python-python3.15/work-request/1078818/
[2]: https://github.com/python-babel/babel/commit/f42ed4e9de43ac4f191bee85678abe402aa7937d
-- 
"Can you imagine what I would do if I could do all I can?" -- Sun Tzu
Saludos /\/\ /\ >< `/
remove-obsolete-literal-dedup.patch (text/x-diff, 869 B)
commit 79c903c7d9ec4cfa30b7ca38a795adc1c100b45a
Author: Alex Waygood <[email protected]>
Date:   Wed Aug 12 13:13:00 2026 +0100

    Remove obsolete Literal deduplication assertion (#785)

diff --git a/src/test_typing_extensions.py b/src/test_typing_extensions.py
index 996d466..938f2ac 100644
--- a/src/test_typing_extensions.py
+++ b/src/test_typing_extensions.py
@@ -1337,8 +1337,6 @@ class LiteralTests(BaseTestCase):
         self.assertEqual(Literal[1, 2, 3].__args__, (1, 2, 3))
         self.assertEqual(Literal[1, 2, 3, 3].__args__, (1, 2, 3))
         self.assertEqual(Literal[1, Literal[2], Literal[3, 4]].__args__, (1, 2, 3, 4))
-        # Mutable arguments will not be deduplicated
-        self.assertEqual(Literal[[], []].__args__, ([], []))
 
     def test_union_of_literals(self):
         self.assertEqual(Union[Literal[1], Literal[2]].__args__,
use_cldr48.2.patch (text/x-diff, 8.3 KB)
commit f42ed4e9de43ac4f191bee85678abe402aa7937d
Author: Aarni Koskela <[email protected]>
Date:   Thu Apr 16 15:37:05 2026 +0300

    Update tests and code for CLDR 48.2
    
    - Unit IDs renamed in 48 still work (with deprecation warnings raised)

Index: python-babel/babel/numbers.py
===================================================================
--- python-babel.orig/babel/numbers.py
+++ python-babel/babel/numbers.py
@@ -741,7 +741,7 @@ def format_currency(
     >>> format_currency(1099.98, 'JPY', locale='en_US')
     '\\xa51,100'
     >>> format_currency(1099.98, 'COP', '#,##0.00', locale='es_ES')
-    '1.099,98'
+    '1.100'
 
     However, the number of decimal digits can be overridden from the currency
     information, by setting the last parameter to ``False``:
Index: python-babel/babel/units.py
===================================================================
--- python-babel.orig/babel/units.py
+++ python-babel/babel/units.py
@@ -1,11 +1,22 @@
 from __future__ import annotations
 
 import decimal
+import warnings
 from typing import Literal
 
 from babel.core import Locale
 from babel.numbers import LC_NUMERIC, format_decimal
 
+_DEPRECATED_UNIT_IDS: dict[str, str] = {
+    # Unit IDs deprecated in CLDR 48
+    "concentr-permillion": "concentr-part-per-1e6",
+    "concentr-portion": "concentr-part",
+    "concentr-portion-per-1e9": "concentr-part-per-1e9",
+    "permillion": "part-per-1e6",
+    "portion": "part",
+    "portion-per-1e9": "part-per-1e9",
+}
+
 
 class UnknownUnitError(ValueError):
     def __init__(self, unit: str, locale: Locale) -> None:
@@ -66,6 +77,19 @@ def _find_unit_pattern(unit_id: str, loc
     unit_patterns: dict[str, str] = locale._data["unit_patterns"]
     if unit_id in unit_patterns:
         return unit_id
+
+    # Only if a direct hit didn't work, try deprecated units...
+    new_id = _DEPRECATED_UNIT_IDS.get(unit_id)
+    if new_id is not None:
+        warnings.warn(
+            f"Unit identifier {unit_id!r} is deprecated; use {new_id!r} instead.",
+            DeprecationWarning,
+            stacklevel=4,
+        )
+        if new_id in unit_patterns:
+            return new_id
+
+    # ... and finally fuzzy matching.
     for unit_pattern in sorted(unit_patterns, key=len):
         if unit_pattern.endswith(unit_id):
             return unit_pattern
Index: python-babel/tests/test_dates.py
===================================================================
--- python-babel.orig/tests/test_dates.py
+++ python-babel/tests/test_dates.py
@@ -613,10 +613,10 @@ def test_format_time(timezone_getter):
 def test_format_skeleton(timezone_getter):
     dt = datetime(2007, 4, 1, 15, 30)
     assert (dates.format_skeleton('yMEd', dt, locale='en_US') == 'Sun, 4/1/2007')
-    assert (dates.format_skeleton('yMEd', dt, locale='th') == 'อา. 1/4/2007')
+    assert (dates.format_skeleton('yMEd', dt, locale='th') == 'อาทิตย์ 1/4/2007')
 
     assert (dates.format_skeleton('EHm', dt, locale='en') == 'Sun 15:30')
-    assert (dates.format_skeleton('EHm', dt, tzinfo=timezone_getter('Asia/Bangkok'), locale='th') == 'อา. 22:30 น.')
+    assert (dates.format_skeleton('EHm', dt, tzinfo=timezone_getter('Asia/Bangkok'), locale='th') == 'อาทิตย์ 22:30 น.')
 
 
 @pytest.mark.parametrize(('skeleton', 'expected'), [
@@ -1194,8 +1194,8 @@ def test_issue_1192():
     # The actual returned value here is not actually strictly specified ("get_timezone_name"
     # is not an operation specified as such). Issue #1192 concerned this invocation returning
     # the invalid "no inheritance marker" value; _that_ should never be returned here.
-    # IOW, if the below "Hawaii-Aleutian Time" changes with e.g. CLDR updates, that's fine.
-    assert dates.get_timezone_name('Pacific/Honolulu', 'short', locale='en_GB') == "Hawaii-Aleutian Time"
+    # IOW, if the below "United States (Honolulu) Time" changes with e.g. CLDR updates, that's fine.
+    assert dates.get_timezone_name('Pacific/Honolulu', 'short', locale='en_GB') == "United States (Honolulu) Time"
 
 
 @pytest.mark.xfail
Index: python-babel/tests/test_lists.py
===================================================================
--- python-babel.orig/tests/test_lists.py
+++ python-babel/tests/test_lists.py
@@ -9,7 +9,7 @@ from babel import lists, units
     (['string1', 'string2'], 'en', 'string1 and string2'),
     (['string1', 'string2', 'string3'], 'en', 'string1, string2, and string3'),
     (['string1', 'string2', 'string3'], 'zh', 'string1、string2和string3'),
-    (['string1', 'string2', 'string3', 'string4'], 'ne', 'string1,string2, string3 र string4'),
+    (['string1', 'string2', 'string3', 'string4'], 'ne', 'string1, string2, string3 र string4'),
 ])
 def test_format_list(list, locale, expected):
     assert lists.format_list(list, locale=locale) == expected
Index: python-babel/tests/test_numbers.py
===================================================================
--- python-babel.orig/tests/test_numbers.py
+++ python-babel/tests/test_numbers.py
@@ -40,7 +40,7 @@ def test_list_currencies():
 
     assert list_currencies(locale='pa_Arab') == {'PKR', 'INR', 'EUR'}
 
-    assert len(list_currencies()) == 307
+    assert len(list_currencies()) == 308
 
 
 def test_validate_currency():
@@ -297,7 +297,7 @@ def test_format_currency_format_type():
     assert (numbers.format_currency(1099.98, 'JPY', locale='en_US')
             == '\xa51,100')
     assert (numbers.format_currency(1099.98, 'COP', '#,##0.00', locale='es_ES')
-            == '1.099,98')
+            == '1.100')
     assert (numbers.format_currency(1099.98, 'JPY', locale='en_US',
                                     currency_digits=False)
             == '\xa51,099.98')
@@ -320,7 +320,7 @@ def test_format_compact_currency():
     assert numbers.format_compact_currency(123, 'EUR', locale='yav', format_type="short") == '€\xa0123'
     assert numbers.format_compact_currency(12345, 'EUR', locale='yav', format_type="short") == '€\xa012K'
     assert numbers.format_compact_currency(123456789, 'EUR', locale='de_DE', fraction_digits=1) == '123,5\xa0Mio.\xa0€'
-    assert numbers.format_compact_currency(123456789, 'USD', locale='ar_EG', fraction_digits=2, format_type="short", numbering_system="default") == '123٫46\xa0مليون\xa0US$'
+    assert numbers.format_compact_currency(123456789, 'USD', locale='ar_EG', fraction_digits=2, format_type="short", numbering_system="default") == '\u200f123٫46\xa0مليون\xa0US$'
 
 
 def test_format_compact_currency_invalid_format_type():
Index: python-babel/tests/test_support_format.py
===================================================================
--- python-babel.orig/tests/test_support_format.py
+++ python-babel/tests/test_support_format.py
@@ -53,7 +53,7 @@ def test_format_currency(ar_eg_format, e
 def test_format_compact_currency(ar_eg_format, en_us_format):
     assert en_us_format.compact_currency(1099.98, 'USD') == '$1K'
     assert en_us_format.compact_currency(Decimal("1099.98"), 'USD') == '$1K'
-    assert ar_eg_format.compact_currency(1099.98, 'EGP') == '1\xa0ألف\xa0ج.م.\u200f'
+    assert ar_eg_format.compact_currency(1099.98, 'EGP') == '\u200f1\xa0ألف\xa0ج.م.\u200f'
 
 
 def test_format_percent(ar_eg_format, en_us_format):
Index: python-babel/tests/test_units.py
===================================================================
--- python-babel.orig/tests/test_units.py
+++ python-babel/tests/test_units.py
@@ -8,12 +8,18 @@ from babel.units import format_unit
     ('speed-light-speed', 1, '1 světlo'),
     ('speed-light-speed', 2, '2 světla'),
     ('speed-light-speed', 5, '5 světel'),
-    ('concentr-portion-per-1e9', 1, '1 částice na miliardu'),
-    ('concentr-portion-per-1e9', 2, '2 částice na miliardu'),
-    ('concentr-portion-per-1e9', 5, '5 částic na miliardu'),
+    ('concentr-part-per-1e9', 1, '1 částice na miliardu'),
+    ('concentr-part-per-1e9', 2, '2 částice na miliardu'),
+    ('concentr-part-per-1e9', 5, '5 částic na miliardu'),
     ('duration-night', 1, '1 noc'),
     ('duration-night', 2, '2 noci'),
     ('duration-night', 5, '5 nocí'),
 ])
 def test_new_cldr46_units(unit, count, expected):
     assert format_unit(count, unit, locale='cs_CZ') == expected
+
+
+def test_deprecated_unit_ids():
+    for id in ("concentr-permillion", "concentr-portion", "concentr-portion-per-1e9"):
+        with pytest.warns(DeprecationWarning, match=id):
+            format_unit(1, id, locale='en')
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.