Title: Add python buffer api support by thesn10 · Pull Request #980 · pythonnet/pythonnet · GitHub
Open Graph Title: Add python buffer api support by thesn10 · Pull Request #980 · pythonnet/pythonnet
X Title: Add python buffer api support by thesn10 · Pull Request #980 · pythonnet/pythonnet
Description: What does this implement/fix? Explain your changes. Passing data like images from managed to python will be easyer than ever! I implemented the python buffer api which makes copying big chunks of data directly into the python object buffer possible! You can copy strings to python object: PyObject array = scope.Eval("bytearray(3)"); byte[] managedArr = new UTF8Encoding().GetBytes(new char[] { 'a', 'b', 'c' }); PyBuffer buf = array.GetBuffer(out bool success, 0); if (success) { buf.WriteToBuffer(managedArr, 0, managedArr.Length); buf.Release(); } Or copy images to python byte arrays: byte[] imageArr = LoadImage(); PyObject array = scope.Eval("bytearray(" + managedArr.Length + ")"); PyBuffer buf = array.GetBuffer(out bool success, 0); if (success) { buf.WriteToBuffer(managedArr, 0, managedArr.Length); buf.Release(); } Does this close any currently open issues? No Any other comments? ... Checklist Check all those that are applicable and complete. Make sure to include one or more tests for your change If an enhancement PR, please create docs and at best an example Add yourself to AUTHORS Updated the CHANGELOG
Open Graph Description: What does this implement/fix? Explain your changes. Passing data like images from managed to python will be easyer than ever! I implemented the python buffer api which makes copying big chunks of d...
X Description: What does this implement/fix? Explain your changes. Passing data like images from managed to python will be easyer than ever! I implemented the python buffer api which makes copying big chunks of d...
Opengraph URL: https://github.com/pythonnet/pythonnet/pull/980
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:8c835bd0-42b5-c6cc-f0b9-e9bffc8bb39c |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | C992:73C2E:1DF12A7:29D4AE2:6970E7DF |
| html-safe-nonce | d14abfa415acb6d074737e8be7f9e2315e1bded4685879939406f40ca97ed343 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDOTkyOjczQzJFOjFERjEyQTc6MjlENEFFMjo2OTcwRTdERiIsInZpc2l0b3JfaWQiOiI4Mjg5OTkyMDYwODQ0NDM1NDIzIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 9757bc5133f47876c37169d47d8f55a502545e505ecbcb8b44d2a587ae241141 |
| hovercard-subject-tag | pull_request:332887226 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/pythonnet/pythonnet/pull/980/files |
| twitter:image | https://avatars.githubusercontent.com/u/38666407?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/38666407?s=400&v=4 |
| og:image:alt | What does this implement/fix? Explain your changes. Passing data like images from managed to python will be easyer than ever! I implemented the python buffer api which makes copying big chunks of d... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | a8b3a33ad16bd33428ccc7800d4ea7bfc6b4990584847afdcb92b020b61a949b |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/pythonnet/pythonnet git https://github.com/pythonnet/pythonnet.git |
| octolytics-dimension-user_id | 6050430 |
| octolytics-dimension-user_login | pythonnet |
| octolytics-dimension-repository_id | 14748123 |
| octolytics-dimension-repository_nwo | pythonnet/pythonnet |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 14748123 |
| octolytics-dimension-repository_network_root_nwo | pythonnet/pythonnet |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | b8a8c883a585a3dc6cb57fa8b7997b70c86a696c |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width