+1 for overall.

On Thu, Feb 3, 2022 at 7:45 AM Eric Snow <ericsnowcurren...@gmail.com> wrote:
>
>
> I'd also like to actually get rid of _Py_IDENTIFIER(), along with
> other related API including ~14 (private) C-API functions.  Dropping
> all that helps reduce maintenance costs.  However, at least one PyPI
> project (blender) is using _Py_IDENTIFIER().  So, before we could get
> rid of it, we'd first have to deal with that project (and any others).
>

It would be nice to provide something similar to _PY_IDENTIFIER, but
designed (and documented) for 3rd party modules like this.

```
typedef struct {
    Py_IDENTIFIER(foo);
...
} Modstate;
...
    // in some func
    Modstate *state = (Modstate*)PyModule_GetState(module);
    PyObject_GetAttr(o, PY_IDENTIFIER_STR(state->foo));
...
// m_free()
static void mod_free(PyObject *module) {
    Modstate *state = (Modstate*)PyModule_GetState(module);
    Py_IDENTIFIER_CLEAR(state->foo);
}
```


-- 
Inada Naoki  <songofaca...@gmail.com>
_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/ZZ5QOZDOAO734SDRJGMXW6AJGAVEPUHE/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to