- Notifications
You must be signed in to change notification settings - Fork749
added missing PyThreadState_Swap to Runtime and its Delegates#1673
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
lostmsu commentedJan 15, 2022 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
This looks good but without usages there's not much point merging it. We only have P/Invoke signatures for functions that are used by |
@lostmsu I'm using this in a fork that I have working with sub-interpreters. Whichever you decide. I thought it's better to PR to master |
Are you planning to upstream subinterpreters? Or is it not yet ready? |
We are about to release 3.0 with breaking changes. If subinterpreters require more breaking changes, it might make sense to try getting them in, otherwise you might need to wait until 4.0 |
eirannejad commentedJan 15, 2022 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
@lostmsu I definitely am. To be honest I'm a little in the dark as to what is the overall scope and design goal for pythonnet. I'd appreciate your help and info on this. It'd help me push more generic code upstream. Q: Is
|
Actually,this passage does not look promising:
I wonder what is your use case? Is |
eirannejad commentedJan 15, 2022 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
@lostmsu I'm embedding pythonnet in a dotnet application and creating a cpython IDE over it. I need to run a mini language server on the python engine as well that doesn't have anything to do with the actual user scripts being executed by the engine. Effectively this creates two completely independent usages for pythonnet under the same process. I need to create a sub-interpreter for these reasons:
Please let me know if there is a better way to do this P.S. I don't see |
Regarding PythonEngine: We will have to break this one eventually anyhow if we ever want subinterpreters, so if you want to make a proposal, go ahead. From my perspective, it only exists for compatibility reasons, all newer functionalities were added to the relatively ergonomic Regarding PyScope: This is indeed |
My understanding is that the issue requires more involved changes.
Now if you think about it, the modules that Python.NET creates to reflect .NET namespaces if simply copied to the new subinterpreter won't get notified of newly loaded assemblies. The following passage is also unclear to the exact effect:
We can probably defer that issue to users, but the problem is that because most usages of Python.NET are higher-level, we will get a lot of people asking why it does not work like they expect it should. BTW,@eirannejad, according to the first quote above in the example you mentioned, Python.NET will only be initialized once. As for running a language server, why not useLanguage Server Protocol used in VS Code for all languages. Then you should be able to just reuse existing Python language server that Microsoft developed for VS Code. This does not use subinterpreters, and instead just runs language server library in a separate process. AFAIK, Python language server in VS Code does not autocomplete .NET types, and this is something we might want to address instead. |
As discussed, we are not taking it in the current form. I hope the LSP is good alternative for you@eirannejad |
What does this implement/fix? Explain your changes.
PyThreadState_Swap
was missing inRuntime
andRuntime.Delegates
codeDoes this close any currently open issues?
No
Any other comments?
N/A
Checklist
Check all those that are applicable and complete.
AUTHORS
CHANGELOG