diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2023-05-21 21:32:39 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-21 21:32:39 (GMT) |
commit | f3466bc04008660c4a5c3ed6f70144f138ae2e7f (patch) | |
tree | 3aada373c1a064f47e8273f30439c5fcea1d7e3a /Modules/_ssl.c | |
parent | 6ba8406cb6e656e47e908f8c7354e07ed0f2d774 (diff) | |
download | cpython-f3466bc04008660c4a5c3ed6f70144f138ae2e7f.zip cpython-f3466bc04008660c4a5c3ed6f70144f138ae2e7f.tar.gz cpython-f3466bc04008660c4a5c3ed6f70144f138ae2e7f.tar.bz2 |
gh-98836: Extend PyUnicode_FromFormat() (GH-98838)
* Support for conversion specifiers o (octal) and X (uppercase hexadecimal).
* Support for length modifiers j (intmax_t) and t (ptrdiff_t).
* Length modifiers are now applied to all integer conversions.
* Support for wchar_t C strings (%ls and %lV).
* Support for variable width and precision (*).
* Support for flag - (left alignment).
Diffstat (limited to 'Modules/_ssl.c')
-rw-r--r-- | Modules/_ssl.c | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/Modules/_ssl.c b/Modules/_ssl.c index 016a5a5..5bf6b3b 100644 --- a/Modules/_ssl.c +++ b/Modules/_ssl.c @@ -1330,10 +1330,8 @@ _get_peer_alt_names (_sslmodulestate *state, X509 *certificate) { p[0], p[1], p[2], p[3] ); } else if (name->d.ip->length == 16) { - /* PyUnicode_FromFormat() does not support %X */ unsigned char *p = name->d.ip->data; - len = sprintf( - buf, + v = PyUnicode_FromFormat( "%X:%X:%X:%X:%X:%X:%X:%X", p[0] << 8 | p[1], p[2] << 8 | p[3], @@ -1344,7 +1342,6 @@ _get_peer_alt_names (_sslmodulestate *state, X509 *certificate) { p[12] << 8 | p[13], p[14] << 8 | p[15] ); - v = PyUnicode_FromStringAndSize(buf, len); } else { v = PyUnicode_FromString("<invalid>"); } |