Mercurial > cpython-lru_cache-weakref
view PC/generrmap.c @ 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 | d8d8374ddbcc |
| children |
line wrap: on
line source
#include <windows.h> #include <fcntl.h> #include <io.h> #include <stdio.h> #include <errno.h> /* Extract the mapping of Win32 error codes to errno */ int main() { int i; _setmode(fileno(stdout), O_BINARY); printf("/* Generated file. Do not edit. */\n"); printf("int winerror_to_errno(int winerror)\n"); printf("{\n switch(winerror) {\n"); for(i=1; i < 65000; i++) { _dosmaperr(i); if (errno == EINVAL) { /* Issue #12802 */ if (i == ERROR_DIRECTORY) errno = ENOTDIR; /* Issue #13063 */ else if (i == ERROR_NO_DATA) errno = EPIPE; else continue; } printf(" case %d: return %d;\n", i, errno); } printf(" default: return EINVAL;\n"); printf(" }\n}\n"); }
