[New-bugs-announce] [issue39138] import a pycapsule object that's attached on many modules

Yorkie Liu report at bugs.python.org
Thu Dec 26 06:14:01 EST 2019


New submission from Yorkie Liu <yorkiefixer at gmail.com>:

Current PyCapsule's name is corresponding to the `modulename.attrname`, which requires it could be imported in the specified module.

And it's possible to implement a feature which shares the same capsule object between different modules, and supports importing them like this:

```
PyCapsule* cap = PyCapsule_New("foobar");
PyObject_SetAttrString(module1, cap->name);
PyObject_SetAttrString(module2, cap->name);

PyCapsule_Import("module1.foobar", 0);
PyCapsule_Import("module2.foobar", 0);
```

----------
components: C API
messages: 358886
nosy: yorkie
priority: normal
severity: normal
status: open
title: import a pycapsule object that's attached on many modules
type: enhancement
versions: Python 3.9

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue39138>
_______________________________________


More information about the New-bugs-announce mailing list