| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
There was a problem hiding this comment.
_PyUnicode_LATIN1_INIT is wrong name. You can statically initialize utf8 representation only in ASCII strings.
Sorry, something went wrong.
There was a problem hiding this comment.
I'd like @ericsnowcurrently to review this too.
Sorry, something went wrong.
|
Are you generating utf8 strings separately from the ascii string, or do they share the same data? |
Sorry, something went wrong.
The utf8 cache strings are only ever created and used for non-ASCII strings (i.e. at least one character is 128 or larger). The unicode string object is smart enough to know that for pure ASCII strings the utf8 is identical so it doesn't bother creating or using the utf8 cache value. This PR only generates utf8 data for exactly 6 strings in deepfreeze.c. I'm sure those are the ones with at least non-ASCII character. In order to see a leak one would have to request the utf8 encoding of at least one of those 6 strings. |
Sorry, something went wrong.
There was a problem hiding this comment.
LGTM
Sorry, something went wrong.
What do you mean? Keep in mind that the macro is used exclusively to statically initialize latin-1 strings. |
Sorry, something went wrong.
Indeed -- in fact the macro is only used in pycore_runtime_init_generated.h (a generated file :-) to initialize the _latin1 field of unicode objects. So the name seems eminently reasonable. |
Sorry, something went wrong.
|
Sorry, now I see that _PyUnicode_LATIN1_INIT takes a new argument. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Uh oh!
There was an error while loading. Please reload this page.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.