@@ -212,15 +212,15 @@ sys_audit_tstate(PyThreadState *ts, const char *event,
212212 }
213213
214214 if (event == NULL ) {
215- _PyErr_SetString (ts , PyExc_ValueError ,
215+ _PyErr_SetString (ts , PyExc_SystemError ,
216216 "event argument must not be NULL" );
217217 return -1 ;
218218 }
219219
220220 /* N format is inappropriate, because you do not know
221221 whether the reference is consumed by the call. */
222222 if (argFormat != NULL && strchr (argFormat , 'N' )) {
223- _PyErr_SetString (ts , PyExc_ValueError ,
223+ _PyErr_SetString (ts , PyExc_SystemError ,
224224 "N format must not be used in the format argument" );
225225 return -1 ;
226226 }
@@ -355,18 +355,16 @@ PySys_Audit(const char *event, const char *argFormat, ...)
355355int
356356PySys_AuditTuple (const char * event , PyObject * args )
357357{
358- if (args ) {
359- if (!PyTuple_Check (args )) {
360- PyErr_Format (PyExc_TypeError , "args must be tuple, got %s" ,
361- Py_TYPE (args )-> tp_name );
362- return -1 ;
363- }
364-
365- return PySys_Audit (event , "O" , args );
366- }
367- else {
358+ if (args == NULL ) {
368359 return PySys_Audit (event , NULL );
369360 }
361+
362+ if (!PyTuple_Check (args )) {
363+ PyErr_Format (PyExc_TypeError , "args must be tuple, got %s" ,
364+ Py_TYPE (args )-> tp_name );
365+ return -1 ;
366+ }
367+ return PySys_Audit (event , "O" , args );
370368}
371369
372370/* We expose this function primarily for our own cleanup during
0 commit comments