Title: Add PyHandle by amos402 · Pull Request #1087 · pythonnet/pythonnet · GitHub
Open Graph Title: Add PyHandle by amos402 · Pull Request #1087 · pythonnet/pythonnet
X Title: Add PyHandle by amos402 · Pull Request #1087 · pythonnet/pythonnet
Description: What does this implement/fix? Explain your changes.
Add a wrapper named PyHandle to replace IntPtr of C API.
Refactor Rutime.XDecref and Runtime.XIncref.
Add implcit operator for BorrowedReference and NewReference
NewReference and BorrowedReference seem be good for helping user comprehend the type of return value quickly. But it should not interfere the general usage.
When I tried to merge the code, I found that the DangerousGetAddress just keep annoying me. In many cases we have to use the raw IntPtr(e.g. put the Python object to a clr collection). Keep typing the long method name DangerousGetAddress just verbose since I must know that C API does return borrowed reference or new reference before using the C API.
Also I can't the NewReference or BorrowedReference to the collection, because they're non-copyable. This may good cause no matter which put to the collection wouldn't make sense(e.g. List
Open Graph Description: What does this implement/fix? Explain your changes. Add a wrapper named PyHandle to replace IntPtr of C API. Refactor Rutime.XDecref and Runtime.XIncref. Add implcit operator for BorrowedReference...
X Description: What does this implement/fix? Explain your changes. Add a wrapper named PyHandle to replace IntPtr of C API. Refactor Rutime.XDecref and Runtime.XIncref. Add implcit operator for BorrowedReference...
Opengraph URL: https://github.com/pythonnet/pythonnet/pull/1087
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/checks(.:format) |
| route-controller | pull_requests |
| route-action | checks |
| fetch-nonce | v2:d71a1cf7-3482-4388-2c25-50873f128bb0 |
| current-catalog-service-hash | 87dc3bc62d9b466312751bfd5f889726f4f1337bdff4e8be7da7c93d6c00a25a |
| request-id | DC52:19AC80:284D523:359E78B:6971CB66 |
| html-safe-nonce | 21a2dccb09e182a6d2cfdfba0c43bbd2955d3f2daba6d882bbac6674d762580a |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEQzUyOjE5QUM4MDoyODRENTIzOjM1OUU3OEI6Njk3MUNCNjYiLCJ2aXNpdG9yX2lkIjoiNjA0NjEwODI2NzAyMjc2NDkwMiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | d92a8e52e770e63f3526fda0d1b1188057bb27c6120e761bc080c880d3c492be |
| hovercard-subject-tag | pull_request:386104974 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,checks,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/1087/checks |
| twitter:image | https://avatars.githubusercontent.com/u/3406561?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/3406561?s=400&v=4 |
| og:image:alt | What does this implement/fix? Explain your changes. Add a wrapper named PyHandle to replace IntPtr of C API. Refactor Rutime.XDecref and Runtime.XIncref. Add implcit operator for BorrowedReference... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | ac615aa66802dad9a938c6abe95edf09ee43c0c7f508315b64b08612858ef32e |
| turbo-cache-control | no-preview |
| 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 full-width-p-0 |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 6b618569a5f93e0b31f97f620112341421ef5f69 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width