Skip to content

Commit 93a7a9b

Browse files
committed
full debug
1 parent 7a198d4 commit 93a7a9b

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

Modules/_ssl.c

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6820,6 +6820,13 @@ sslmodule_init_constants(PyObject *m)
68206820

68216821
/* internal hashtable (errcode, libcode) => (reason [PyObject * (unicode)]) */
68226822

6823+
static Py_uhash_t
6824+
py_ht_errcode_to_name_hash(const void *key)
6825+
{
6826+
py_ssl_errcode code = (py_ssl_errcode)(uintptr_t)key;
6827+
return (Py_uhash_t)(code);
6828+
}
6829+
68236830
static int
68246831
py_ht_errcode_to_name_comp(const void *k1, const void *k2)
68256832
{
@@ -6828,14 +6835,14 @@ py_ht_errcode_to_name_comp(const void *k1, const void *k2)
68286835

68296836
static void
68306837
py_ht_errcode_to_name_free(void *value) {
6831-
assert(PyUnicode_CheckExact((PyObject *)value));
6832-
Py_CLEAR(value);
6838+
// assert(PyUnicode_CheckExact((PyObject *)value));
6839+
// Py_CLEAR(value);
68336840
}
68346841

68356842
static _Py_hashtable_t *
68366843
py_ht_errcode_to_name_create(void) {
68376844
_Py_hashtable_t *table = _Py_hashtable_new_full(
6838-
_Py_hashtable_hash_ptr,
6845+
py_ht_errcode_to_name_hash,
68396846
py_ht_errcode_to_name_comp,
68406847
NULL,
68416848
py_ht_errcode_to_name_free,
@@ -6847,10 +6854,14 @@ py_ht_errcode_to_name_create(void) {
68476854
}
68486855

68496856
for (const py_ssl_error_code *p = error_codes; p->mnemonic != NULL; p++) {
6857+
int toshow = p->library == 41 && (p->reason == 103 || p->reason == 106);
6858+
if (toshow) printf("%s ", p->mnemonic);
68506859
py_ssl_errcode code = ERR_PACK(p->library, 0, p->reason);
68516860
const void *key = ssl_errcode_to_ht_key(code);
6861+
if (toshow) printf("%d, %d, %p, %ld, %ld\n", p->library, p->reason, key, code, (uintptr_t)code);
68526862
PyObject *prev = _Py_hashtable_get(table, key); /* borrowed */
68536863
if (prev != NULL) {
6864+
printf("old: %s (%d, %d, %ld)\n", p->mnemonic, p->library, p->reason, code);
68546865
assert(PyUnicode_CheckExact(prev));
68556866
if (PyUnicode_EqualToUTF8(prev, p->mnemonic)) {
68566867
/* sometimes data is duplicated, so we skip it */
@@ -6909,7 +6920,6 @@ py_ht_libcode_to_name_create(void) {
69096920
for (const py_ssl_library_code *p = library_codes; p->library != NULL; p++) {
69106921
const void *key = ssl_errcode_to_ht_key(p->code);
69116922
PyObject *prev = _Py_hashtable_get(table, key); /* borrowed */
6912-
printf("")
69136923
if (prev != NULL) {
69146924
assert(PyUnicode_CheckExact(prev));
69156925
if (PyUnicode_EqualToUTF8(prev, p->library)) {

0 commit comments

Comments
 (0)