File: pycompat23.h

package info (click to toggle)
urjtag 2021.03-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 18,232 kB
  • sloc: ansic: 56,769; sh: 4,897; yacc: 2,159; lex: 1,545; vhdl: 1,324; makefile: 1,275; python: 72; sed: 16
file content (38 lines) | stat: -rw-r--r-- 943 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/*
 * some compatibility macros for python 2  / python 3
 * by Steve Tell
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 */

#if PY_MAJOR_VERSION >= 3

#define MODINIT_ERROR_VAL NULL
#define MODINIT_SUCCESS_VAL(val) val
#define MODINIT_DECL(name) PyMODINIT_FUNC PyInit_##name(void)

#else  /* assume python 2 */

#ifndef PyMODINIT_FUNC
#define PyMODINIT_FUNC void
#endif

#define MODINIT_ERROR_VAL
#define MODINIT_SUCCESS_VAL(val)
#define MODINIT_DECL(name) PyMODINIT_FUNC init##name(void)

struct PyModuleDef {
    int dc1;
    const char *name;
    const char *doc;
    int dc2;
    PyMethodDef *methods;
};
#define PyModuleDef_HEAD_INIT 0
#define PyModule_Create(dp) Py_InitModule3((dp)->name, (dp)->methods, (dp)->doc)

#endif