Mercurial > cpython-lru_cache-weakref
annotate Objects/stringlib/ucs4lib.h @ 87690:66c1c9f32567 default tip
Add use_weakref option to functools.lru_cache
The use_weakref option makes lru_cache create weak references to the function
arguments when creating the cache key, which prevents them from staying in the
memory forever even after all other references to them are gone.
This is a proof of concept for http://bugs.python.org/issue19859
| author | Radomir Dopieralski <devel@sheep.art.pl> |
|---|---|
| date | Tue, 03 Dec 2013 16:02:48 +0100 |
| parents | cd92610b04d3 |
| children |
| rev | line source |
|---|---|
| 72475 | 1 /* this is sort of a hack. there's at least one place (formatting |
| 2 floats) where some stringlib code takes a different path if it's | |
| 3 compiled as unicode. */ | |
| 4 #define STRINGLIB_IS_UNICODE 1 | |
| 5 | |
| 6 #define FASTSEARCH ucs4lib_fastsearch | |
| 7 #define STRINGLIB(F) ucs4lib_##F | |
| 8 #define STRINGLIB_OBJECT PyUnicodeObject | |
|
72874
bfd3fcfb02f3
Fix fastsearch for UCS2 and UCS4
Victor Stinner <victor.stinner@haypocalc.com>
parents:
72500
diff
changeset
|
9 #define STRINGLIB_SIZEOF_CHAR 4 |
|
76862
e08c3791f035
Issue #14738: Speed-up UTF-8 decoding on non-ASCII data. Patch by Serhiy Storchaka.
Antoine Pitrou <solipsis@pitrou.net>
parents:
75231
diff
changeset
|
10 #define STRINGLIB_MAX_CHAR 0x10FFFFu |
| 72475 | 11 #define STRINGLIB_CHAR Py_UCS4 |
| 12 #define STRINGLIB_TYPE_NAME "unicode" | |
| 13 #define STRINGLIB_PARSE_CODE "U" | |
| 14 #define STRINGLIB_EMPTY unicode_empty | |
| 15 #define STRINGLIB_ISSPACE Py_UNICODE_ISSPACE | |
| 16 #define STRINGLIB_ISLINEBREAK BLOOM_LINEBREAK | |
| 17 #define STRINGLIB_ISDECIMAL Py_UNICODE_ISDECIMAL | |
| 18 #define STRINGLIB_TODECIMAL Py_UNICODE_TODECIMAL | |
|
72876
62fd915c4e0b
stringlib: Fix STRINGLIB_STR for UCS2/UCS4
Victor Stinner <victor.stinner@haypocalc.com>
parents:
72874
diff
changeset
|
19 #define STRINGLIB_STR PyUnicode_4BYTE_DATA |
| 72475 | 20 #define STRINGLIB_LEN PyUnicode_GET_LENGTH |
|
72500
347fb9006c6f
Mark PyUnicode_FromUCS[124] as private
Victor Stinner <victor.stinner@haypocalc.com>
parents:
72475
diff
changeset
|
21 #define STRINGLIB_NEW _PyUnicode_FromUCS4 |
| 72475 | 22 #define STRINGLIB_CHECK PyUnicode_Check |
| 23 #define STRINGLIB_CHECK_EXACT PyUnicode_CheckExact | |
| 24 | |
| 25 #define STRINGLIB_TOSTR PyObject_Str | |
| 26 #define STRINGLIB_TOASCII PyObject_ASCII | |
| 27 | |
| 28 #define _Py_InsertThousandsGrouping _PyUnicode_ucs4_InsertThousandsGrouping | |
| 29 |
