@@ -205,8 +205,7 @@ void _Py_dec_count(PyTypeObject *tp)
205205void
206206_Py_NegativeRefcount (const char * filename , int lineno , PyObject * op )
207207{
208- _PyObject_AssertFailed (op , "object has negative ref count" ,
209- "op->ob_refcnt >= 0" ,
208+ _PyObject_AssertFailed (op , NULL , "object has negative ref count" ,
210209 filename , lineno , __func__ );
211210}
212211
@@ -2219,20 +2218,25 @@ _PyTrash_thread_destroy_chain(void)
22192218
22202219
22212220void
2222- _PyObject_AssertFailed (PyObject * obj , const char * msg , const char * expr ,
2221+ _PyObject_AssertFailed (PyObject * obj , const char * expr , const char * msg ,
22232222 const char * file , int line , const char * function )
22242223{
2225- fprintf (stderr ,
2226- "%s:%d: %s: Assertion \"%s\" failed" ,
2227- file , line , function , expr );
2224+ fprintf (stderr , "%s:%d: " , file , line );
2225+ if (function ) {
2226+ fprintf (stderr , "%s: " , function );
2227+ }
22282228 fflush (stderr );
2229-
2230- if (msg ) {
2231- fprintf (stderr , "; %s.\n" , msg );
2229+ if (expr ) {
2230+ fprintf (stderr , "Assertion \"%s\" failed" , expr );
22322231 }
22332232 else {
2234- fprintf (stderr , ".\n" );
2233+ fprintf (stderr , "Assertion failed" );
2234+ }
2235+ fflush (stderr );
2236+ if (msg ) {
2237+ fprintf (stderr , ": %s" , msg );
22352238 }
2239+ fprintf (stderr , "\n" );
22362240 fflush (stderr );
22372241
22382242 if (obj == NULL ) {
0 commit comments