@@ -6843,17 +6843,23 @@ py_ht_errcode_to_name_create(void) {
68436843    for  (const  py_ssl_error_code  * p  =  error_codes ; p -> mnemonic  !=  NULL ; p ++ ) {
68446844        py_ssl_errcode  code  =  ERR_PACK (p -> library , 0 , p -> reason );
68456845        const  void  * key  =  ssl_errcode_to_ht_key (code );
6846+         PyObject  * prev  =  _Py_hashtable_get (table , key ); /* borrowed */ 
6847+         if  (prev  !=  NULL ) {
6848+             assert (PyUnicode_CheckExact (prev ));
6849+             if  (PyUnicode_EqualToUTF8 (prev , p -> mnemonic )) {
6850+                 /* sometimes data is duplicated, so we skip it */ 
6851+                 continue ;
6852+             }
6853+             PyErr_Format (PyExc_SystemError ,
6854+                          "SSL data contains incompatible entries for (%d, %d). " 
6855+                          "Old mnemonic is %S while new mnemonic is %s" ,
6856+                          p -> library , p -> reason , prev , p -> mnemonic );
6857+             goto error ;
6858+         }
68466859        PyObject  * value  =  PyUnicode_FromString (p -> mnemonic );
68476860        if  (value  ==  NULL ) {
68486861            goto error ;
68496862        }
6850-         PyObject  * prev  =  _Py_hashtable_get (table , key ); /* borrowed */ 
6851-         if  (prev  !=  NULL ) {
6852-             PyObject  * msg  =  PyUnicode_FromFormat ("oh no for: %s (%d, %d)" , p -> mnemonic , p -> library , p -> reason );
6853-             _PyObject_Dump (msg );
6854-             Py_DECREF (msg );
6855-             _PyObject_Dump (prev );
6856-         }
68576863        if  (_Py_hashtable_set (table , key , value ) <  0 ) {
68586864            Py_DECREF (value );
68596865            goto error ;
@@ -6889,17 +6895,23 @@ py_ht_libcode_to_name_create(void) {
68896895
68906896    for  (const  py_ssl_library_code  * p  =  library_codes ; p -> library  !=  NULL ; p ++ ) {
68916897        const  void  * key  =  ssl_errcode_to_ht_key (p -> code );
6898+         PyObject  * prev  =  _Py_hashtable_get (table , key ); /* borrowed */ 
6899+         if  (prev  !=  NULL ) {
6900+             assert (PyUnicode_CheckExact (prev ));
6901+             if  (PyUnicode_EqualToUTF8 (prev , p -> library )) {
6902+                 /* sometimes data is duplicated, so we skip it */ 
6903+                 continue ;
6904+             }
6905+             PyErr_Format (PyExc_SystemError ,
6906+                          "SSL data contains incompatible entries for %d. " 
6907+                          "Old library is %S while new library is %s." ,
6908+                          p -> code , prev , p -> library );
6909+             goto error ;
6910+         }
68926911        PyObject  * value  =  PyUnicode_FromString (p -> library );
68936912        if  (value  ==  NULL ) {
68946913            goto error ;
68956914        }
6896-         PyObject  * prev  =  _Py_hashtable_get (table , key ); /* borrowed */ 
6897-         if  (prev  !=  NULL ) {
6898-             PyObject  * msg  =  PyUnicode_FromFormat ("oh no: %s (%d)" , p -> library , p -> code );
6899-             _PyObject_Dump (msg );
6900-             Py_DECREF (msg );
6901-             _PyObject_Dump (prev );
6902-         }
69036915        if  (_Py_hashtable_set (table , key , value ) <  0 ) {
69046916            Py_DECREF (value );
69056917            goto error ;
0 commit comments