mirror of
				https://github.com/python/cpython.git
				synced 2025-11-03 23:21:29 +00:00 
			
		
		
		
	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).
This commit is contained in:
		
							parent
							
								
									6f84659e5e
								
							
						
					
					
						commit
						f402e922f3
					
				
					 6 changed files with 14 additions and 0 deletions
				
			
		| 
						 | 
					@ -4293,6 +4293,10 @@ Tools/Demos
 | 
				
			||||||
Extension Modules
 | 
					Extension Modules
 | 
				
			||||||
-----------------
 | 
					-----------------
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					- 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).
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- Issue #13840: The error message produced by ctypes.create_string_buffer
 | 
					- Issue #13840: The error message produced by ctypes.create_string_buffer
 | 
				
			||||||
  when given a Unicode string has been fixed.
 | 
					  when given a Unicode string has been fixed.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -246,7 +246,9 @@ ascii_escape_unicode(PyObject *pystr)
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    output[chars++] = '"';
 | 
					    output[chars++] = '"';
 | 
				
			||||||
 | 
					#ifdef Py_DEBUG
 | 
				
			||||||
    assert(_PyUnicode_CheckConsistency(rval, 1));
 | 
					    assert(_PyUnicode_CheckConsistency(rval, 1));
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
    return rval;
 | 
					    return rval;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -399,7 +399,9 @@ MD5_hexdigest(MD5object *self, PyObject *unused)
 | 
				
			||||||
        c = (digest[i] & 0xf);
 | 
					        c = (digest[i] & 0xf);
 | 
				
			||||||
        hex_digest[j++] = Py_hexdigits[c];
 | 
					        hex_digest[j++] = Py_hexdigits[c];
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					#ifdef Py_DEBUG
 | 
				
			||||||
    assert(_PyUnicode_CheckConsistency(retval, 1));
 | 
					    assert(_PyUnicode_CheckConsistency(retval, 1));
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
    return retval;
 | 
					    return retval;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -376,7 +376,9 @@ SHA1_hexdigest(SHA1object *self, PyObject *unused)
 | 
				
			||||||
        c = (digest[i] & 0xf);
 | 
					        c = (digest[i] & 0xf);
 | 
				
			||||||
        hex_digest[j++] = Py_hexdigits[c];
 | 
					        hex_digest[j++] = Py_hexdigits[c];
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					#ifdef Py_DEBUG
 | 
				
			||||||
    assert(_PyUnicode_CheckConsistency(retval, 1));
 | 
					    assert(_PyUnicode_CheckConsistency(retval, 1));
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
    return retval;
 | 
					    return retval;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -466,7 +466,9 @@ SHA256_hexdigest(SHAobject *self, PyObject *unused)
 | 
				
			||||||
        c = (digest[i] & 0xf);
 | 
					        c = (digest[i] & 0xf);
 | 
				
			||||||
        hex_digest[j++] = Py_hexdigits[c];
 | 
					        hex_digest[j++] = Py_hexdigits[c];
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					#ifdef Py_DEBUG
 | 
				
			||||||
    assert(_PyUnicode_CheckConsistency(retval, 1));
 | 
					    assert(_PyUnicode_CheckConsistency(retval, 1));
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
    return retval;
 | 
					    return retval;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -532,7 +532,9 @@ SHA512_hexdigest(SHAobject *self, PyObject *unused)
 | 
				
			||||||
        c = (digest[i] & 0xf);
 | 
					        c = (digest[i] & 0xf);
 | 
				
			||||||
        hex_digest[j++] = Py_hexdigits[c];
 | 
					        hex_digest[j++] = Py_hexdigits[c];
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					#ifdef Py_DEBUG
 | 
				
			||||||
    assert(_PyUnicode_CheckConsistency(retval, 1));
 | 
					    assert(_PyUnicode_CheckConsistency(retval, 1));
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
    return retval;
 | 
					    return retval;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue