@@ -301,10 +301,22 @@ def parse_global(srcdir, sup):
301
301
currency : tuple (sorted (regions )) for currency , regions in all_currencies .items ()}
302
302
303
303
# Explicit parent locales
304
- for paternity in sup .findall ('.//parentLocales/parentLocale' ):
305
- parent = paternity .attrib ['parent' ]
306
- for child in paternity .attrib ['locales' ].split ():
307
- parent_exceptions [child ] = parent
304
+ # Since CLDR-43, there are multiple <parentLocales> statements, some of them with a `component="collations"` or
305
+ # `component="segmentations"` attribute; these indicate that only some language aspects should be inherited.
306
+ # (https://cldr.unicode.org/index/downloads/cldr-43)
307
+ #
308
+ # Ignore these for now, as one of them even points to a locale that doesn't have a corresponding XML file (sr_ME)
309
+ # and we crash trying to load it.
310
+ # There is no XPath support to test for an absent attribute, so use Python to filter
311
+ for parentBlock in sup .findall ('.//parentLocales' ):
312
+ if parentBlock .attrib .get ('component' ):
313
+ # Consider only unqualified parent declarations
314
+ continue
315
+
316
+ for paternity in parentBlock .findall ('./parentLocale' ):
317
+ parent = paternity .attrib ['parent' ]
318
+ for child in paternity .attrib ['locales' ].split ():
319
+ parent_exceptions [child ] = parent
308
320
309
321
# Currency decimal and rounding digits
310
322
for fraction in sup .findall ('.//currencyData/fractions/info' ):
0 commit comments