Title: Add a warning message about PyOS_snprintf by eric-wieser · Pull Request #95993 · python/cpython · GitHub
Open Graph Title: Add a warning message about PyOS_snprintf by eric-wieser · Pull Request #95993 · python/cpython
X Title: Add a warning message about PyOS_snprintf by eric-wieser · Pull Request #95993 · python/cpython
Description: The top google result for "determine sprintf buffer size" is https://stackoverflow.com/a/3923207/102441, which advocates code along the lines of int size = snprintf(NULL, 0, "%d", 132); char * a = malloc(size + 1); sprintf(a, "%d", 132); Unfortunately, this does not work for PyOS_snprintf, as it includes an assert to ensure the arguments are not NULL and 0. This PR simply documents this limitation.
Open Graph Description: The top google result for "determine sprintf buffer size" is https://stackoverflow.com/a/3923207/102441, which advocates code along the lines of int size = snprintf(NULL, 0, "%d"...
X Description: The top google result for "determine sprintf buffer size" is https://stackoverflow.com/a/3923207/102441, which advocates code along the lines of int size = snprintf(NULL, 0, &...
Opengraph URL: https://github.com/python/cpython/pull/95993
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/checks(.:format) |
| route-controller | pull_requests |
| route-action | checks |
| fetch-nonce | v2:ad9f18d0-67e2-ebd0-7efb-d14790abcdf4 |
| current-catalog-service-hash | 87dc3bc62d9b466312751bfd5f889726f4f1337bdff4e8be7da7c93d6c00a25a |
| request-id | 89CA:74E61:17CF94:217B94:696A0EF0 |
| html-safe-nonce | 5aac66982663966b485573a88a477d2a022173d9ec5c163834421b1d00e2fd72 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4OUNBOjc0RTYxOjE3Q0Y5NDoyMTdCOTQ6Njk2QTBFRjAiLCJ2aXNpdG9yX2lkIjoiNDI3OTQ5MTQwMTAyNDY3MTQ3MiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 8ac8054210f370301aad3cae1aa772891451c101f7603448e09e66a764fcd66f |
| hovercard-subject-tag | pull_request:1026298873 |
| 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/python/cpython/pull/95993/checks |
| twitter:image | https://avatars.githubusercontent.com/u/425260?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/425260?s=400&v=4 |
| og:image:alt | The top google result for "determine sprintf buffer size" is https://stackoverflow.com/a/3923207/102441, which advocates code along the lines of int size = snprintf(NULL, 0, "%d"... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 699227a00bbb7fe1eec276d2ae1c3a93068bc5ba483bd9dc4b2a27a8f4f2f595 |
| turbo-cache-control | no-preview |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| 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 | 7266b2d935baa1c6474b16dd9feaa5ca30607261 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width