-
Notifications
You must be signed in to change notification settings - Fork 0
Allow setting/getting global variables in Plugins #19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Since this plugin is supposed to do nothing, the global function will simply return a default constructed value for the getter and do nothing for the setter.
This will return the second template parameter of a template class. It will be used for retrieving the error of Expected when it is not clear that the class actually has enough template parameters. A default value can be passed in case the class does not have sufficient template parameters.
Although the class is called CallError, it is also used for errors when setting/getting variables. Thus, the new error class incorrectType can help narrowing down the actual issue when passing the wrong type for a variable. This can only be detected in the scripting languages.
This alternative is called RemoveCvrefT.
Previously, this was performed in PythonTuple. However, this is less flexible since an unnecessary PythonTuple needs to be constructed that way which is why it was moved to PythonObject.
Previously, the returned string was interpreted as a null-terminated C-string. However, a Python bytes object may contain null bytes in the string which is why the separately stored string length must be used to construct the correct string.
This feature will probably not be implemented and thus the placeholder does no longer make sense.
1c3aa07 to
703f04b
Compare
This will allow to indicate to the user if setting the variable was successful. This can happen for C++ if the symbol does not exist or theoretically for Python where the API indicates that an exception can be thrown by the set function.
…efinition Most member functions were already at the bottom of the header files or in their own source file. This commit moves the remaining definitions there as well.
Since Python does have its own philosophy for header includes (always include Python.h as first header which also includes all other required headers), it is not feasible to use the include-cleaner in this project. Since there is no common pattern for the Python headers, it is also not possible to simply use the option "IgnoreHeaders" to disable this check only for Python headers.
These includes are not part of the official API and thus can change between different Python versions. This makes them unsuitable to be used by external libraries. Thus, this project will rely on the official Python.h header which includes all the necessary headers. They were originally included to satisfy the include cleaner of clang-tidy.
The implicit conversion to CallError made it impossible to get the CallError::Code inside the object. Additionally, the name was confusing since the CallError is usually wrapped inside an Expected which also has a method called error().
2ebbcbd to
bf2d74e
Compare
This function will make developing and debugging the Lua part easier since it allows to inspect the entire Lua stack at certain points of execution.
Add some basic test cases to test the high-level Lua functionalities. They are part of a dedicated static library which will be linked into the test executable.
216e77d to
207b802
Compare
207b802 to
cbaabaa
Compare
The deleter of main_module_ in PythonInterpreter captured a this pointer which was invalidated by moving that instance. Instead, the actual state address is now stored which is not affected by a move operation.
PyInterpreterConfig_INIT is not yet part of the stable Python API. Instead of the unofficial experimental version with a leading underscore, the manual initialization should be more robust.
68b320b to
7f37b0b
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
C
Related to C plugin
C++
Related to C++ plugin
enhancement
New feature or request
Lua
Related to Lua plugin
python
Related to python plugin
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Add two functions for setting/getting global variables to each plugin type:
global<T>(variable_name)for getting global variablesglobal(variable_name, value)for setting global variablesResolves #12
Additionally, this PR introduces the new container types
std::vectorandstd::mapwhich can be filled with any of the already existing types.Resolves #23