Coverage Report

Created: 2022-07-08 09:39

/home/mdboom/Work/builds/cpython/Modules/clinic/signalmodule.c.h
Line
Count
Source (jump to first uncovered line)
1
/*[clinic input]
2
preserve
3
[clinic start generated code]*/
4
5
PyDoc_STRVAR(signal_default_int_handler__doc__,
6
"default_int_handler($module, signalnum, frame, /)\n"
7
"--\n"
8
"\n"
9
"The default handler for SIGINT installed by Python.\n"
10
"\n"
11
"It raises KeyboardInterrupt.");
12
13
#define SIGNAL_DEFAULT_INT_HANDLER_METHODDEF    \
14
    {"default_int_handler", _PyCFunction_CAST(signal_default_int_handler), METH_FASTCALL, signal_default_int_handler__doc__},
15
16
static PyObject *
17
signal_default_int_handler_impl(PyObject *module, int signalnum,
18
                                PyObject *frame);
19
20
static PyObject *
21
signal_default_int_handler(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
22
{
23
    PyObject *return_value = NULL;
24
    int signalnum;
25
    PyObject *frame;
26
27
    if (!_PyArg_CheckPositional("default_int_handler", nargs, 2, 2)) {
28
        goto exit;
29
    }
30
    signalnum = _PyLong_AsInt(args[0]);
31
    if (signalnum == -1 && 
PyErr_Occurred()0
) {
  Branch (31:9): [True: 0, False: 101]
  Branch (31:28): [True: 0, False: 0]
32
        goto exit;
33
    }
34
    frame = args[1];
35
    return_value = signal_default_int_handler_impl(module, signalnum, frame);
36
37
exit:
38
    return return_value;
39
}
40
41
#if defined(HAVE_ALARM)
42
43
PyDoc_STRVAR(signal_alarm__doc__,
44
"alarm($module, seconds, /)\n"
45
"--\n"
46
"\n"
47
"Arrange for SIGALRM to arrive after the given number of seconds.");
48
49
#define SIGNAL_ALARM_METHODDEF    \
50
    {"alarm", (PyCFunction)signal_alarm, METH_O, signal_alarm__doc__},
51
52
static long
53
signal_alarm_impl(PyObject *module, int seconds);
54
55
static PyObject *
56
signal_alarm(PyObject *module, PyObject *arg)
57
{
58
    PyObject *return_value = NULL;
59
    int seconds;
60
    long _return_value;
61
62
    seconds = _PyLong_AsInt(arg);
63
    if (seconds == -1 && 
PyErr_Occurred()0
) {
  Branch (63:9): [True: 0, False: 83]
  Branch (63:26): [True: 0, False: 0]
64
        goto exit;
65
    }
66
    _return_value = signal_alarm_impl(module, seconds);
67
    if ((_return_value == -1) && 
PyErr_Occurred()0
) {
  Branch (67:9): [True: 0, False: 83]
  Branch (67:34): [True: 0, False: 0]
68
        goto exit;
69
    }
70
    return_value = PyLong_FromLong(_return_value);
71
72
exit:
73
    return return_value;
74
}
75
76
#endif /* defined(HAVE_ALARM) */
77
78
#if defined(HAVE_PAUSE)
79
80
PyDoc_STRVAR(signal_pause__doc__,
81
"pause($module, /)\n"
82
"--\n"
83
"\n"
84
"Wait until a signal arrives.");
85
86
#define SIGNAL_PAUSE_METHODDEF    \
87
    {"pause", (PyCFunction)signal_pause, METH_NOARGS, signal_pause__doc__},
88
89
static PyObject *
90
signal_pause_impl(PyObject *module);
91
92
static PyObject *
93
signal_pause(PyObject *module, PyObject *Py_UNUSED(ignored))
94
{
95
    return signal_pause_impl(module);
96
}
97
98
#endif /* defined(HAVE_PAUSE) */
99
100
PyDoc_STRVAR(signal_raise_signal__doc__,
101
"raise_signal($module, signalnum, /)\n"
102
"--\n"
103
"\n"
104
"Send a signal to the executing process.");
105
106
#define SIGNAL_RAISE_SIGNAL_METHODDEF    \
107
    {"raise_signal", (PyCFunction)signal_raise_signal, METH_O, signal_raise_signal__doc__},
108
109
static PyObject *
110
signal_raise_signal_impl(PyObject *module, int signalnum);
111
112
static PyObject *
113
signal_raise_signal(PyObject *module, PyObject *arg)
114
{
115
    PyObject *return_value = NULL;
116
    int signalnum;
117
118
    signalnum = _PyLong_AsInt(arg);
119
    if (signalnum == -1 && 
PyErr_Occurred()0
) {
  Branch (119:9): [True: 0, False: 672]
  Branch (119:28): [True: 0, False: 0]
120
        goto exit;
121
    }
122
    return_value = signal_raise_signal_impl(module, signalnum);
123
124
exit:
125
    return return_value;
126
}
127
128
PyDoc_STRVAR(signal_signal__doc__,
129
"signal($module, signalnum, handler, /)\n"
130
"--\n"
131
"\n"
132
"Set the action for the given signal.\n"
133
"\n"
134
"The action can be SIG_DFL, SIG_IGN, or a callable Python object.\n"
135
"The previous action is returned.  See getsignal() for possible return values.\n"
136
"\n"
137
"*** IMPORTANT NOTICE ***\n"
138
"A signal handler function is called with two arguments:\n"
139
"the first is the signal number, the second is the interrupted stack frame.");
140
141
#define SIGNAL_SIGNAL_METHODDEF    \
142
    {"signal", _PyCFunction_CAST(signal_signal), METH_FASTCALL, signal_signal__doc__},
143
144
static PyObject *
145
signal_signal_impl(PyObject *module, int signalnum, PyObject *handler);
146
147
static PyObject *
148
signal_signal(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
149
{
150
    PyObject *return_value = NULL;
151
    int signalnum;
152
    PyObject *handler;
153
154
    if (!_PyArg_CheckPositional("signal", nargs, 2, 2)) {
155
        goto exit;
156
    }
157
    signalnum = _PyLong_AsInt(args[0]);
158
    if (signalnum == -1 && 
PyErr_Occurred()0
) {
  Branch (158:9): [True: 0, False: 43.1k]
  Branch (158:28): [True: 0, False: 0]
159
        goto exit;
160
    }
161
    handler = args[1];
162
    return_value = signal_signal_impl(module, signalnum, handler);
163
164
exit:
165
    return return_value;
166
}
167
168
PyDoc_STRVAR(signal_getsignal__doc__,
169
"getsignal($module, signalnum, /)\n"
170
"--\n"
171
"\n"
172
"Return the current action for the given signal.\n"
173
"\n"
174
"The return value can be:\n"
175
"  SIG_IGN -- if the signal is being ignored\n"
176
"  SIG_DFL -- if the default action for the signal is in effect\n"
177
"  None    -- if an unknown handler is in effect\n"
178
"  anything else -- the callable Python object used as a handler");
179
180
#define SIGNAL_GETSIGNAL_METHODDEF    \
181
    {"getsignal", (PyCFunction)signal_getsignal, METH_O, signal_getsignal__doc__},
182
183
static PyObject *
184
signal_getsignal_impl(PyObject *module, int signalnum);
185
186
static PyObject *
187
signal_getsignal(PyObject *module, PyObject *arg)
188
{
189
    PyObject *return_value = NULL;
190
    int signalnum;
191
192
    signalnum = _PyLong_AsInt(arg);
193
    if (signalnum == -1 && 
PyErr_Occurred()0
) {
  Branch (193:9): [True: 0, False: 2.69k]
  Branch (193:28): [True: 0, False: 0]
194
        goto exit;
195
    }
196
    return_value = signal_getsignal_impl(module, signalnum);
197
198
exit:
199
    return return_value;
200
}
201
202
PyDoc_STRVAR(signal_strsignal__doc__,
203
"strsignal($module, signalnum, /)\n"
204
"--\n"
205
"\n"
206
"Return the system description of the given signal.\n"
207
"\n"
208
"The return values can be such as \"Interrupt\", \"Segmentation fault\", etc.\n"
209
"Returns None if the signal is not recognized.");
210
211
#define SIGNAL_STRSIGNAL_METHODDEF    \
212
    {"strsignal", (PyCFunction)signal_strsignal, METH_O, signal_strsignal__doc__},
213
214
static PyObject *
215
signal_strsignal_impl(PyObject *module, int signalnum);
216
217
static PyObject *
218
signal_strsignal(PyObject *module, PyObject *arg)
219
{
220
    PyObject *return_value = NULL;
221
    int signalnum;
222
223
    signalnum = _PyLong_AsInt(arg);
224
    if (signalnum == -1 && 
PyErr_Occurred()0
) {
  Branch (224:9): [True: 0, False: 4]
  Branch (224:28): [True: 0, False: 0]
225
        goto exit;
226
    }
227
    return_value = signal_strsignal_impl(module, signalnum);
228
229
exit:
230
    return return_value;
231
}
232
233
#if defined(HAVE_SIGINTERRUPT)
234
235
PyDoc_STRVAR(signal_siginterrupt__doc__,
236
"siginterrupt($module, signalnum, flag, /)\n"
237
"--\n"
238
"\n"
239
"Change system call restart behaviour.\n"
240
"\n"
241
"If flag is False, system calls will be restarted when interrupted by\n"
242
"signal sig, else system calls will be interrupted.");
243
244
#define SIGNAL_SIGINTERRUPT_METHODDEF    \
245
    {"siginterrupt", _PyCFunction_CAST(signal_siginterrupt), METH_FASTCALL, signal_siginterrupt__doc__},
246
247
static PyObject *
248
signal_siginterrupt_impl(PyObject *module, int signalnum, int flag);
249
250
static PyObject *
251
signal_siginterrupt(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
252
{
253
    PyObject *return_value = NULL;
254
    int signalnum;
255
    int flag;
256
257
    if (!_PyArg_CheckPositional("siginterrupt", nargs, 2, 2)) {
258
        goto exit;
259
    }
260
    signalnum = _PyLong_AsInt(args[0]);
261
    if (signalnum == -1 && 
PyErr_Occurred()0
) {
  Branch (261:9): [True: 0, False: 283]
  Branch (261:28): [True: 0, False: 0]
262
        goto exit;
263
    }
264
    flag = _PyLong_AsInt(args[1]);
265
    if (flag == -1 && 
PyErr_Occurred()0
) {
  Branch (265:9): [True: 0, False: 283]
  Branch (265:23): [True: 0, False: 0]
266
        goto exit;
267
    }
268
    return_value = signal_siginterrupt_impl(module, signalnum, flag);
269
270
exit:
271
    return return_value;
272
}
273
274
#endif /* defined(HAVE_SIGINTERRUPT) */
275
276
#if defined(HAVE_SETITIMER)
277
278
PyDoc_STRVAR(signal_setitimer__doc__,
279
"setitimer($module, which, seconds, interval=0.0, /)\n"
280
"--\n"
281
"\n"
282
"Sets given itimer (one of ITIMER_REAL, ITIMER_VIRTUAL or ITIMER_PROF).\n"
283
"\n"
284
"The timer will fire after value seconds and after that every interval seconds.\n"
285
"The itimer can be cleared by setting seconds to zero.\n"
286
"\n"
287
"Returns old values as a tuple: (delay, interval).");
288
289
#define SIGNAL_SETITIMER_METHODDEF    \
290
    {"setitimer", _PyCFunction_CAST(signal_setitimer), METH_FASTCALL, signal_setitimer__doc__},
291
292
static PyObject *
293
signal_setitimer_impl(PyObject *module, int which, PyObject *seconds,
294
                      PyObject *interval);
295
296
static PyObject *
297
signal_setitimer(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
298
{
299
    PyObject *return_value = NULL;
300
    int which;
301
    PyObject *seconds;
302
    PyObject *interval = NULL;
303
304
    if (!_PyArg_CheckPositional("setitimer", nargs, 2, 3)) {
305
        goto exit;
306
    }
307
    which = _PyLong_AsInt(args[0]);
308
    if (which == -1 && 
PyErr_Occurred()1
) {
  Branch (308:9): [True: 1, False: 25.3k]
  Branch (308:24): [True: 0, False: 1]
309
        goto exit;
310
    }
311
    seconds = args[1];
312
    if (nargs < 3) {
  Branch (312:9): [True: 25.3k, False: 8]
313
        goto skip_optional;
314
    }
315
    interval = args[2];
316
skip_optional:
317
    return_value = signal_setitimer_impl(module, which, seconds, interval);
318
319
exit:
320
    return return_value;
321
}
322
323
#endif /* defined(HAVE_SETITIMER) */
324
325
#if defined(HAVE_GETITIMER)
326
327
PyDoc_STRVAR(signal_getitimer__doc__,
328
"getitimer($module, which, /)\n"
329
"--\n"
330
"\n"
331
"Returns current value of given itimer.");
332
333
#define SIGNAL_GETITIMER_METHODDEF    \
334
    {"getitimer", (PyCFunction)signal_getitimer, METH_O, signal_getitimer__doc__},
335
336
static PyObject *
337
signal_getitimer_impl(PyObject *module, int which);
338
339
static PyObject *
340
signal_getitimer(PyObject *module, PyObject *arg)
341
{
342
    PyObject *return_value = NULL;
343
    int which;
344
345
    which = _PyLong_AsInt(arg);
346
    if (which == -1 && 
PyErr_Occurred()0
) {
  Branch (346:9): [True: 0, False: 851k]
  Branch (346:24): [True: 0, False: 0]
347
        goto exit;
348
    }
349
    return_value = signal_getitimer_impl(module, which);
350
351
exit:
352
    return return_value;
353
}
354
355
#endif /* defined(HAVE_GETITIMER) */
356
357
#if defined(HAVE_SIGSET_T) && defined(PYPTHREAD_SIGMASK)
358
359
PyDoc_STRVAR(signal_pthread_sigmask__doc__,
360
"pthread_sigmask($module, how, mask, /)\n"
361
"--\n"
362
"\n"
363
"Fetch and/or change the signal mask of the calling thread.");
364
365
#define SIGNAL_PTHREAD_SIGMASK_METHODDEF    \
366
    {"pthread_sigmask", _PyCFunction_CAST(signal_pthread_sigmask), METH_FASTCALL, signal_pthread_sigmask__doc__},
367
368
static PyObject *
369
signal_pthread_sigmask_impl(PyObject *module, int how, sigset_t mask);
370
371
static PyObject *
372
signal_pthread_sigmask(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
373
{
374
    PyObject *return_value = NULL;
375
    int how;
376
    sigset_t mask;
377
378
    if (!_PyArg_CheckPositional("pthread_sigmask", nargs, 2, 2)) {
379
        goto exit;
380
    }
381
    how = _PyLong_AsInt(args[0]);
382
    if (how == -1 && 
PyErr_Occurred()0
) {
  Branch (382:9): [True: 0, False: 54]
  Branch (382:22): [True: 0, False: 0]
383
        goto exit;
384
    }
385
    if (!_Py_Sigset_Converter(args[1], &mask)) {
  Branch (385:9): [True: 3, False: 51]
386
        goto exit;
387
    }
388
    return_value = signal_pthread_sigmask_impl(module, how, mask);
389
390
exit:
391
    return return_value;
392
}
393
394
#endif /* defined(HAVE_SIGSET_T) && defined(PYPTHREAD_SIGMASK) */
395
396
#if defined(HAVE_SIGSET_T) && defined(HAVE_SIGPENDING)
397
398
PyDoc_STRVAR(signal_sigpending__doc__,
399
"sigpending($module, /)\n"
400
"--\n"
401
"\n"
402
"Examine pending signals.\n"
403
"\n"
404
"Returns a set of signal numbers that are pending for delivery to\n"
405
"the calling thread.");
406
407
#define SIGNAL_SIGPENDING_METHODDEF    \
408
    {"sigpending", (PyCFunction)signal_sigpending, METH_NOARGS, signal_sigpending__doc__},
409
410
static PyObject *
411
signal_sigpending_impl(PyObject *module);
412
413
static PyObject *
414
signal_sigpending(PyObject *module, PyObject *Py_UNUSED(ignored))
415
{
416
    return signal_sigpending_impl(module);
417
}
418
419
#endif /* defined(HAVE_SIGSET_T) && defined(HAVE_SIGPENDING) */
420
421
#if defined(HAVE_SIGSET_T) && defined(HAVE_SIGWAIT)
422
423
PyDoc_STRVAR(signal_sigwait__doc__,
424
"sigwait($module, sigset, /)\n"
425
"--\n"
426
"\n"
427
"Wait for a signal.\n"
428
"\n"
429
"Suspend execution of the calling thread until the delivery of one of the\n"
430
"signals specified in the signal set sigset.  The function accepts the signal\n"
431
"and returns the signal number.");
432
433
#define SIGNAL_SIGWAIT_METHODDEF    \
434
    {"sigwait", (PyCFunction)signal_sigwait, METH_O, signal_sigwait__doc__},
435
436
static PyObject *
437
signal_sigwait_impl(PyObject *module, sigset_t sigset);
438
439
static PyObject *
440
signal_sigwait(PyObject *module, PyObject *arg)
441
{
442
    PyObject *return_value = NULL;
443
    sigset_t sigset;
444
445
    if (!_Py_Sigset_Converter(arg, &sigset)) {
  Branch (445:9): [True: 0, False: 0]
446
        goto exit;
447
    }
448
    return_value = signal_sigwait_impl(module, sigset);
449
450
exit:
451
    return return_value;
452
}
453
454
#endif /* defined(HAVE_SIGSET_T) && defined(HAVE_SIGWAIT) */
455
456
#if ((defined(HAVE_SIGFILLSET) && defined(HAVE_SIGSET_T)) || defined(MS_WINDOWS))
457
458
PyDoc_STRVAR(signal_valid_signals__doc__,
459
"valid_signals($module, /)\n"
460
"--\n"
461
"\n"
462
"Return a set of valid signal numbers on this platform.\n"
463
"\n"
464
"The signal numbers returned by this function can be safely passed to\n"
465
"functions like `pthread_sigmask`.");
466
467
#define SIGNAL_VALID_SIGNALS_METHODDEF    \
468
    {"valid_signals", (PyCFunction)signal_valid_signals, METH_NOARGS, signal_valid_signals__doc__},
469
470
static PyObject *
471
signal_valid_signals_impl(PyObject *module);
472
473
static PyObject *
474
signal_valid_signals(PyObject *module, PyObject *Py_UNUSED(ignored))
475
{
476
    return signal_valid_signals_impl(module);
477
}
478
479
#endif /* ((defined(HAVE_SIGFILLSET) && defined(HAVE_SIGSET_T)) || defined(MS_WINDOWS)) */
480
481
#if defined(HAVE_SIGSET_T) && defined(HAVE_SIGWAITINFO)
482
483
PyDoc_STRVAR(signal_sigwaitinfo__doc__,
484
"sigwaitinfo($module, sigset, /)\n"
485
"--\n"
486
"\n"
487
"Wait synchronously until one of the signals in *sigset* is delivered.\n"
488
"\n"
489
"Returns a struct_siginfo containing information about the signal.");
490
491
#define SIGNAL_SIGWAITINFO_METHODDEF    \
492
    {"sigwaitinfo", (PyCFunction)signal_sigwaitinfo, METH_O, signal_sigwaitinfo__doc__},
493
494
static PyObject *
495
signal_sigwaitinfo_impl(PyObject *module, sigset_t sigset);
496
497
static PyObject *
498
signal_sigwaitinfo(PyObject *module, PyObject *arg)
499
{
500
    PyObject *return_value = NULL;
501
    sigset_t sigset;
502
503
    if (!_Py_Sigset_Converter(arg, &sigset)) {
  Branch (503:9): [True: 0, False: 0]
504
        goto exit;
505
    }
506
    return_value = signal_sigwaitinfo_impl(module, sigset);
507
508
exit:
509
    return return_value;
510
}
511
512
#endif /* defined(HAVE_SIGSET_T) && defined(HAVE_SIGWAITINFO) */
513
514
#if defined(HAVE_SIGSET_T) && defined(HAVE_SIGTIMEDWAIT)
515
516
PyDoc_STRVAR(signal_sigtimedwait__doc__,
517
"sigtimedwait($module, sigset, timeout, /)\n"
518
"--\n"
519
"\n"
520
"Like sigwaitinfo(), but with a timeout.\n"
521
"\n"
522
"The timeout is specified in seconds, with floating point numbers allowed.");
523
524
#define SIGNAL_SIGTIMEDWAIT_METHODDEF    \
525
    {"sigtimedwait", _PyCFunction_CAST(signal_sigtimedwait), METH_FASTCALL, signal_sigtimedwait__doc__},
526
527
static PyObject *
528
signal_sigtimedwait_impl(PyObject *module, sigset_t sigset,
529
                         PyObject *timeout_obj);
530
531
static PyObject *
532
signal_sigtimedwait(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
533
{
534
    PyObject *return_value = NULL;
535
    sigset_t sigset;
536
    PyObject *timeout_obj;
537
538
    if (!_PyArg_CheckPositional("sigtimedwait", nargs, 2, 2)) {
539
        goto exit;
540
    }
541
    if (!_Py_Sigset_Converter(args[0], &sigset)) {
  Branch (541:9): [True: 0, False: 1]
542
        goto exit;
543
    }
544
    timeout_obj = args[1];
545
    return_value = signal_sigtimedwait_impl(module, sigset, timeout_obj);
546
547
exit:
548
    return return_value;
549
}
550
551
#endif /* defined(HAVE_SIGSET_T) && defined(HAVE_SIGTIMEDWAIT) */
552
553
#if defined(HAVE_PTHREAD_KILL)
554
555
PyDoc_STRVAR(signal_pthread_kill__doc__,
556
"pthread_kill($module, thread_id, signalnum, /)\n"
557
"--\n"
558
"\n"
559
"Send a signal to a thread.");
560
561
#define SIGNAL_PTHREAD_KILL_METHODDEF    \
562
    {"pthread_kill", _PyCFunction_CAST(signal_pthread_kill), METH_FASTCALL, signal_pthread_kill__doc__},
563
564
static PyObject *
565
signal_pthread_kill_impl(PyObject *module, unsigned long thread_id,
566
                         int signalnum);
567
568
static PyObject *
569
signal_pthread_kill(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
570
{
571
    PyObject *return_value = NULL;
572
    unsigned long thread_id;
573
    int signalnum;
574
575
    if (!_PyArg_CheckPositional("pthread_kill", nargs, 2, 2)) {
576
        goto exit;
577
    }
578
    if (!PyLong_Check(args[0])) {
  Branch (578:9): [True: 0, False: 1]
579
        _PyArg_BadArgument("pthread_kill", "argument 1", "int", args[0]);
580
        goto exit;
581
    }
582
    thread_id = PyLong_AsUnsignedLongMask(args[0]);
583
    signalnum = _PyLong_AsInt(args[1]);
584
    if (signalnum == -1 && 
PyErr_Occurred()0
) {
  Branch (584:9): [True: 0, False: 1]
  Branch (584:28): [True: 0, False: 0]
585
        goto exit;
586
    }
587
    return_value = signal_pthread_kill_impl(module, thread_id, signalnum);
588
589
exit:
590
    return return_value;
591
}
592
593
#endif /* defined(HAVE_PTHREAD_KILL) */
594
595
#if (defined(__linux__) && defined(__NR_pidfd_send_signal))
596
597
PyDoc_STRVAR(signal_pidfd_send_signal__doc__,
598
"pidfd_send_signal($module, pidfd, signalnum, siginfo=None, flags=0, /)\n"
599
"--\n"
600
"\n"
601
"Send a signal to a process referred to by a pid file descriptor.");
602
603
#define SIGNAL_PIDFD_SEND_SIGNAL_METHODDEF    \
604
    {"pidfd_send_signal", _PyCFunction_CAST(signal_pidfd_send_signal), METH_FASTCALL, signal_pidfd_send_signal__doc__},
605
606
static PyObject *
607
signal_pidfd_send_signal_impl(PyObject *module, int pidfd, int signalnum,
608
                              PyObject *siginfo, int flags);
609
610
static PyObject *
611
signal_pidfd_send_signal(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
612
{
613
    PyObject *return_value = NULL;
614
    int pidfd;
615
    int signalnum;
616
    PyObject *siginfo = Py_None;
617
    int flags = 0;
618
619
    if (!_PyArg_CheckPositional("pidfd_send_signal", nargs, 2, 4)) {
620
        goto exit;
621
    }
622
    pidfd = _PyLong_AsInt(args[0]);
623
    if (pidfd == -1 && 
PyErr_Occurred()0
) {
  Branch (623:9): [True: 0, False: 3]
  Branch (623:24): [True: 0, False: 0]
624
        goto exit;
625
    }
626
    signalnum = _PyLong_AsInt(args[1]);
627
    if (signalnum == -1 && 
PyErr_Occurred()0
) {
  Branch (627:9): [True: 0, False: 3]
  Branch (627:28): [True: 0, False: 0]
628
        goto exit;
629
    }
630
    if (nargs < 3) {
  Branch (630:9): [True: 2, False: 1]
631
        goto skip_optional;
632
    }
633
    siginfo = args[2];
634
    if (nargs < 4) {
  Branch (634:9): [True: 0, False: 1]
635
        goto skip_optional;
636
    }
637
    flags = _PyLong_AsInt(args[3]);
638
    if (flags == -1 && 
PyErr_Occurred()0
) {
  Branch (638:9): [True: 0, False: 1]
  Branch (638:24): [True: 0, False: 0]
639
        goto exit;
640
    }
641
skip_optional:
642
    return_value = signal_pidfd_send_signal_impl(module, pidfd, signalnum, siginfo, flags);
643
644
exit:
645
    return return_value;
646
}
647
648
#endif /* (defined(__linux__) && defined(__NR_pidfd_send_signal)) */
649
650
#ifndef SIGNAL_ALARM_METHODDEF
651
    #define SIGNAL_ALARM_METHODDEF
652
#endif /* !defined(SIGNAL_ALARM_METHODDEF) */
653
654
#ifndef SIGNAL_PAUSE_METHODDEF
655
    #define SIGNAL_PAUSE_METHODDEF
656
#endif /* !defined(SIGNAL_PAUSE_METHODDEF) */
657
658
#ifndef SIGNAL_SIGINTERRUPT_METHODDEF
659
    #define SIGNAL_SIGINTERRUPT_METHODDEF
660
#endif /* !defined(SIGNAL_SIGINTERRUPT_METHODDEF) */
661
662
#ifndef SIGNAL_SETITIMER_METHODDEF
663
    #define SIGNAL_SETITIMER_METHODDEF
664
#endif /* !defined(SIGNAL_SETITIMER_METHODDEF) */
665
666
#ifndef SIGNAL_GETITIMER_METHODDEF
667
    #define SIGNAL_GETITIMER_METHODDEF
668
#endif /* !defined(SIGNAL_GETITIMER_METHODDEF) */
669
670
#ifndef SIGNAL_PTHREAD_SIGMASK_METHODDEF
671
    #define SIGNAL_PTHREAD_SIGMASK_METHODDEF
672
#endif /* !defined(SIGNAL_PTHREAD_SIGMASK_METHODDEF) */
673
674
#ifndef SIGNAL_SIGPENDING_METHODDEF
675
    #define SIGNAL_SIGPENDING_METHODDEF
676
#endif /* !defined(SIGNAL_SIGPENDING_METHODDEF) */
677
678
#ifndef SIGNAL_SIGWAIT_METHODDEF
679
    #define SIGNAL_SIGWAIT_METHODDEF
680
#endif /* !defined(SIGNAL_SIGWAIT_METHODDEF) */
681
682
#ifndef SIGNAL_VALID_SIGNALS_METHODDEF
683
    #define SIGNAL_VALID_SIGNALS_METHODDEF
684
#endif /* !defined(SIGNAL_VALID_SIGNALS_METHODDEF) */
685
686
#ifndef SIGNAL_SIGWAITINFO_METHODDEF
687
    #define SIGNAL_SIGWAITINFO_METHODDEF
688
#endif /* !defined(SIGNAL_SIGWAITINFO_METHODDEF) */
689
690
#ifndef SIGNAL_SIGTIMEDWAIT_METHODDEF
691
    #define SIGNAL_SIGTIMEDWAIT_METHODDEF
692
#endif /* !defined(SIGNAL_SIGTIMEDWAIT_METHODDEF) */
693
694
#ifndef SIGNAL_PTHREAD_KILL_METHODDEF
695
    #define SIGNAL_PTHREAD_KILL_METHODDEF
696
#endif /* !defined(SIGNAL_PTHREAD_KILL_METHODDEF) */
697
698
#ifndef SIGNAL_PIDFD_SEND_SIGNAL_METHODDEF
699
    #define SIGNAL_PIDFD_SEND_SIGNAL_METHODDEF
700
#endif /* !defined(SIGNAL_PIDFD_SEND_SIGNAL_METHODDEF) */
701
/*[clinic end generated code: output=6ca1b70310eecdba input=a9049054013a1b77]*/