Replies: 1 comment 2 replies
-
This is probably easiest do by making your own wrapper type ( |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Some of the functions in my extension take as input a "mutable bool" (
BoolRef
). I've declared this type in a .py file that's part of my extension package. (Source of BoolRef at the bottom of this post.)It's working fine in my extension: I can get and set the
value
field in my extension's C++ code. The class works naturally in the API I'm binding, and I like that it's defined in a Python file as it's then easy for users of my package to see and understand.It's all great except that I don't know how to let stubgen know about this type. For example, here's how I'm currently binding a function that uses this BoolRef class:
As I declare the
open
argument tobegin()
as justnb::handle
, stubgen of course has no idea that this is typedBoolRef
and will generate the following signature for it:I can get it to work by rewriting the signature in a pattern file like below, but it'd be nice if could somehow annotate that
open
is aBoolRef
and get rid of my pattern file. Any tips on where to start with this?Here's what the
BoolRef
looks like. This is something I'd prefer to keep as normal Python, as it's easier to modify and easier for users of my package to inspect.Beta Was this translation helpful? Give feedback.
All reactions