mirror of
https://github.com/python/cpython.git
synced 2025-11-02 03:01:58 +00:00
bpo-39968: Convert extension modules' macros of get_module_state() to inline functions (GH-19017)
This commit is contained in:
parent
4ab362cec6
commit
f707d94af6
17 changed files with 279 additions and 164 deletions
|
|
@ -86,13 +86,18 @@ typedef struct {
|
|||
PyObject *endidx;
|
||||
} readlinestate;
|
||||
|
||||
|
||||
#define readline_state(o) ((readlinestate *)PyModule_GetState(o))
|
||||
static inline readlinestate*
|
||||
get_readline_state(PyModule *module)
|
||||
{
|
||||
void *state = PyModule_GetState(module);
|
||||
assert(state != NULL);
|
||||
return (readlinestate *)state;
|
||||
}
|
||||
|
||||
static int
|
||||
readline_clear(PyObject *m)
|
||||
{
|
||||
readlinestate *state = readline_state(m);
|
||||
readlinestate *state = get_readline_state(m);
|
||||
Py_CLEAR(state->completion_display_matches_hook);
|
||||
Py_CLEAR(state->startup_hook);
|
||||
Py_CLEAR(state->pre_input_hook);
|
||||
|
|
@ -105,7 +110,7 @@ readline_clear(PyObject *m)
|
|||
static int
|
||||
readline_traverse(PyObject *m, visitproc visit, void *arg)
|
||||
{
|
||||
readlinestate *state = readline_state(m);
|
||||
readlinestate *state = get_readline_state(m);
|
||||
Py_VISIT(state->completion_display_matches_hook);
|
||||
Py_VISIT(state->startup_hook);
|
||||
Py_VISIT(state->pre_input_hook);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue