projects
/
youtube-dl
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
087ddc2
)
[compat] Work around in case folding for narrow Python build
author
dirkf
<fieldhouse@gmx.net>
Wed, 2 Nov 2022 11:56:26 +0000
(11:56 +0000)
committer
GitHub
<noreply@github.com>
Wed, 2 Nov 2022 11:56:26 +0000
(11:56 +0000)
Resolves #31324.
youtube_dl/casefold.py
patch
|
blob
|
history
diff --git
a/youtube_dl/casefold.py
b/youtube_dl/casefold.py
index 7e91c3811640b7479550f5a706e74e561172a9d0..748c2d49132abe894f5bb859e6cfe286ea097ea9 100644
(file)
--- a/
youtube_dl/casefold.py
+++ b/
youtube_dl/casefold.py
@@
-1639,7
+1639,15
@@
FF3A; C; FF5A; # FULLWIDTH LATIN CAPITAL LETTER Z
1E921; C; 1E943; # ADLAM CAPITAL LETTER SHA
'''
-_parse_unichr = lambda s: compat_chr(int(s, 16))
+
+def _parse_unichr(s):
+ s = int(s, 16)
+ try:
+ return compat_chr(s)
+ except ValueError:
+ # work around "unichr() arg not in range(0x10000) (narrow Python build)"
+ return ('\\U%08x' % s).decode('unicode-escape')
+
_map = dict(
(_parse_unichr(from_), ''.join(map(_parse_unichr, to_.split(' '))))