Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 75e923f

Browse files
committed
Issue #16847: Fixed improper use of _PyUnicode_CheckConsistency() in
non-pydebug builds. Several extension modules now compile cleanly when assert()s are enabled in standard builds (-DDEBUG flag).
2 parents 37623ab + f402e92 commit 75e923f

7 files changed

Lines changed: 16 additions & 0 deletions

File tree

Misc/NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4501,6 +4501,10 @@ Tools/Demos
45014501
Extension Modules
45024502
-----------------
45034503

4504+
- Issue #16847: Fixed improper use of _PyUnicode_CheckConsistency() in
4505+
non-pydebug builds. Several extension modules now compile cleanly when
4506+
assert()s are enabled in standard builds (-DDEBUG flag).
4507+
45044508
- Issue #13840: The error message produced by ctypes.create_string_buffer
45054509
when given a Unicode string has been fixed.
45064510

Modules/_json.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,9 @@ ascii_escape_unicode(PyObject *pystr)
210210
}
211211
}
212212
output[chars++] = '"';
213+
#ifdef Py_DEBUG
213214
assert(_PyUnicode_CheckConsistency(rval, 1));
215+
#endif
214216
return rval;
215217
}
216218

Modules/_sha3/sha3module.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,9 @@ SHA3_hexdigest(SHA3object *self, PyObject *unused)
300300
c = (digest[i] & 0xf);
301301
hex_digest[j++] = Py_hexdigits[c];
302302
}
303+
#ifdef Py_DEBUG
303304
assert(_PyUnicode_CheckConsistency(retval, 1));
305+
#endif
304306
return retval;
305307
}
306308

Modules/md5module.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,9 @@ MD5_hexdigest(MD5object *self, PyObject *unused)
399399
c = (digest[i] & 0xf);
400400
hex_digest[j++] = Py_hexdigits[c];
401401
}
402+
#ifdef Py_DEBUG
402403
assert(_PyUnicode_CheckConsistency(retval, 1));
404+
#endif
403405
return retval;
404406
}
405407

Modules/sha1module.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,9 @@ SHA1_hexdigest(SHA1object *self, PyObject *unused)
376376
c = (digest[i] & 0xf);
377377
hex_digest[j++] = Py_hexdigits[c];
378378
}
379+
#ifdef Py_DEBUG
379380
assert(_PyUnicode_CheckConsistency(retval, 1));
381+
#endif
380382
return retval;
381383
}
382384

Modules/sha256module.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,9 @@ SHA256_hexdigest(SHAobject *self, PyObject *unused)
456456
c = (digest[i] & 0xf);
457457
hex_digest[j++] = Py_hexdigits[c];
458458
}
459+
#ifdef Py_DEBUG
459460
assert(_PyUnicode_CheckConsistency(retval, 1));
461+
#endif
460462
return retval;
461463
}
462464

Modules/sha512module.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -522,7 +522,9 @@ SHA512_hexdigest(SHAobject *self, PyObject *unused)
522522
c = (digest[i] & 0xf);
523523
hex_digest[j++] = Py_hexdigits[c];
524524
}
525+
#ifdef Py_DEBUG
525526
assert(_PyUnicode_CheckConsistency(retval, 1));
527+
#endif
526528
return retval;
527529
}
528530

0 commit comments

Comments
 (0)