@@ -214,15 +214,15 @@ sys_audit_tstate(PyThreadState *ts, const char *event,
214214 }
215215
216216 if (event == NULL ) {
217- _PyErr_SetString (ts , PyExc_ValueError ,
217+ _PyErr_SetString (ts , PyExc_SystemError ,
218218 "event argument must not be NULL" );
219219 return -1 ;
220220 }
221221
222222 /* N format is inappropriate, because you do not know
223223 whether the reference is consumed by the call. */
224224 if (argFormat != NULL && strchr (argFormat , 'N' )) {
225- _PyErr_SetString (ts , PyExc_ValueError ,
225+ _PyErr_SetString (ts , PyExc_SystemError ,
226226 "N format must not be used in the format argument" );
227227 return -1 ;
228228 }
@@ -357,18 +357,16 @@ PySys_Audit(const char *event, const char *argFormat, ...)
357357int
358358PySys_AuditTuple (const char * event , PyObject * args )
359359{
360- if (args ) {
361- if (!PyTuple_Check (args )) {
362- PyErr_Format (PyExc_TypeError , "args must be tuple, got %s" ,
363- Py_TYPE (args )-> tp_name );
364- return -1 ;
365- }
366-
367- return PySys_Audit (event , "O" , args );
368- }
369- else {
360+ if (args == NULL ) {
370361 return PySys_Audit (event , NULL );
371362 }
363+
364+ if (!PyTuple_Check (args )) {
365+ PyErr_Format (PyExc_TypeError , "args must be tuple, got %s" ,
366+ Py_TYPE (args )-> tp_name );
367+ return -1 ;
368+ }
369+ return PySys_Audit (event , "O" , args );
372370}
373371
374372/* We expose this function primarily for our own cleanup during
0 commit comments