Skip to content

Commit 2ec62c0

Browse files
committed
Switch get_groups() to DecodeFSDefault, and clean up error handling
1 parent aad7d47 commit 2ec62c0

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

Modules/_ssl.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3779,7 +3779,6 @@ _ssl__SSLContext_get_groups_impl(PySSLContext *self, int include_aliases)
37793779
num = sk_OPENSSL_CSTRING_num(groups);
37803780
result = PyList_New(num);
37813781
if (result == NULL) {
3782-
_setSSLError(get_state_ctx(self), "Can't allocate list", 0, __FILE__, __LINE__);
37833782
goto error;
37843783
}
37853784

@@ -3791,9 +3790,7 @@ _ssl__SSLContext_get_groups_impl(PySSLContext *self, int include_aliases)
37913790
// Group names are plain ASCII, so there's no chance of a decoding
37923791
// error here. However, an allocation failure could occur when
37933792
// constructing the Unicode version of the names.
3794-
item = PyUnicode_DecodeASCII(group, strlen(group), "strict");
3795-
if (item == NULL) {
3796-
_setSSLError(get_state_ctx(self), "Can't allocate group name", 0, __FILE__, __LINE__);
3793+
if ((item = PyUnicode_DecodeFSDefault(group)) == NULL) {
37973794
goto error;
37983795
}
37993796

0 commit comments

Comments
 (0)