tonybaloney / CSnakes

Embed Python in .NET
https://tonybaloney.github.io/CSnakes/
MIT License
343 stars 24 forks source link

Minimal overhead C# string to/from PyString conversions with CopyOnCopyPyString CPython implementation #271

Open minesworld opened 1 month ago

minesworld commented 1 month ago

Whats needed for that is:

CopyOnCopyPyString will use a pointer to the C# string character buffer. The difference to constructing a normal PyString is:

For most CPython ABI calls like passing the name of an attribute or key to get an item out of a dictionary - the will be no copy made. But there can be some "funny" Python code which does - and it will still work 100% correctly.