How to implement a with statement #4113
Unanswered
HealthyPear
asked this question in
Q&A
Replies: 1 comment
-
It seems that
does the job! Even though there is a side-problem (but I am not sure if it's becasue how the C++ library has been designed): This is now not doing exactly what I was expecting,
becasue I would expect the object |
Beta Was this translation helpful? Give feedback.
0 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.
-
I am developing Python bindings with pybind11 for a C++ project of which I am not the author.
Such project implements a File Data Format.
One of the classes I managed to expose to Python is the one that implements the File object.
The class' header looks something like this (among many other things),
I managed to do (among other things)
But I don't know how
__exit__
should look like in this syntax.Python docs say it should look like
object.__exit__(self, exc_type, exc_value, traceback)
, but I don't know how to translate this into pybind11, hoping that the class I am trying to expose doesn't need to be modified.With the solution above I indeed receive the following error,
Beta Was this translation helpful? Give feedback.
All reactions