annotate 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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
72163
385c2ec78f16 Issue #12802: the Windows error ERROR_DIRECTORY (numbered 267) is now
Antoine Pitrou <solipsis@pitrou.net>
parents: 61467
diff changeset
1 #include <windows.h>
385c2ec78f16 Issue #12802: the Windows error ERROR_DIRECTORY (numbered 267) is now
Antoine Pitrou <solipsis@pitrou.net>
parents: 61467
diff changeset
2 #include <fcntl.h>
385c2ec78f16 Issue #12802: the Windows error ERROR_DIRECTORY (numbered 267) is now
Antoine Pitrou <solipsis@pitrou.net>
parents: 61467
diff changeset
3 #include <io.h>
38453
29ae5e0fc348 Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
4 #include <stdio.h>
29ae5e0fc348 Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
5 #include <errno.h>
29ae5e0fc348 Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
6
29ae5e0fc348 Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
7 /* Extract the mapping of Win32 error codes to errno */
29ae5e0fc348 Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
8
29ae5e0fc348 Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
9 int main()
29ae5e0fc348 Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
10 {
61467
f197407bdba2 Recorded merge of revisions 81032 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents: 38453
diff changeset
11 int i;
72163
385c2ec78f16 Issue #12802: the Windows error ERROR_DIRECTORY (numbered 267) is now
Antoine Pitrou <solipsis@pitrou.net>
parents: 61467
diff changeset
12 _setmode(fileno(stdout), O_BINARY);
61467
f197407bdba2 Recorded merge of revisions 81032 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents: 38453
diff changeset
13 printf("/* Generated file. Do not edit. */\n");
f197407bdba2 Recorded merge of revisions 81032 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents: 38453
diff changeset
14 printf("int winerror_to_errno(int winerror)\n");
72163
385c2ec78f16 Issue #12802: the Windows error ERROR_DIRECTORY (numbered 267) is now
Antoine Pitrou <solipsis@pitrou.net>
parents: 61467
diff changeset
15 printf("{\n switch(winerror) {\n");
61467
f197407bdba2 Recorded merge of revisions 81032 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents: 38453
diff changeset
16 for(i=1; i < 65000; i++) {
f197407bdba2 Recorded merge of revisions 81032 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents: 38453
diff changeset
17 _dosmaperr(i);
72163
385c2ec78f16 Issue #12802: the Windows error ERROR_DIRECTORY (numbered 267) is now
Antoine Pitrou <solipsis@pitrou.net>
parents: 61467
diff changeset
18 if (errno == EINVAL) {
385c2ec78f16 Issue #12802: the Windows error ERROR_DIRECTORY (numbered 267) is now
Antoine Pitrou <solipsis@pitrou.net>
parents: 61467
diff changeset
19 /* Issue #12802 */
385c2ec78f16 Issue #12802: the Windows error ERROR_DIRECTORY (numbered 267) is now
Antoine Pitrou <solipsis@pitrou.net>
parents: 61467
diff changeset
20 if (i == ERROR_DIRECTORY)
385c2ec78f16 Issue #12802: the Windows error ERROR_DIRECTORY (numbered 267) is now
Antoine Pitrou <solipsis@pitrou.net>
parents: 61467
diff changeset
21 errno = ENOTDIR;
72790
d8d8374ddbcc Issue #13063: the Windows error ERROR_NO_DATA (numbered 232 and described
Antoine Pitrou <solipsis@pitrou.net>
parents: 72163
diff changeset
22 /* Issue #13063 */
d8d8374ddbcc Issue #13063: the Windows error ERROR_NO_DATA (numbered 232 and described
Antoine Pitrou <solipsis@pitrou.net>
parents: 72163
diff changeset
23 else if (i == ERROR_NO_DATA)
d8d8374ddbcc Issue #13063: the Windows error ERROR_NO_DATA (numbered 232 and described
Antoine Pitrou <solipsis@pitrou.net>
parents: 72163
diff changeset
24 errno = EPIPE;
72163
385c2ec78f16 Issue #12802: the Windows error ERROR_DIRECTORY (numbered 267) is now
Antoine Pitrou <solipsis@pitrou.net>
parents: 61467
diff changeset
25 else
385c2ec78f16 Issue #12802: the Windows error ERROR_DIRECTORY (numbered 267) is now
Antoine Pitrou <solipsis@pitrou.net>
parents: 61467
diff changeset
26 continue;
385c2ec78f16 Issue #12802: the Windows error ERROR_DIRECTORY (numbered 267) is now
Antoine Pitrou <solipsis@pitrou.net>
parents: 61467
diff changeset
27 }
385c2ec78f16 Issue #12802: the Windows error ERROR_DIRECTORY (numbered 267) is now
Antoine Pitrou <solipsis@pitrou.net>
parents: 61467
diff changeset
28 printf(" case %d: return %d;\n", i, errno);
61467
f197407bdba2 Recorded merge of revisions 81032 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents: 38453
diff changeset
29 }
72163
385c2ec78f16 Issue #12802: the Windows error ERROR_DIRECTORY (numbered 267) is now
Antoine Pitrou <solipsis@pitrou.net>
parents: 61467
diff changeset
30 printf(" default: return EINVAL;\n");
385c2ec78f16 Issue #12802: the Windows error ERROR_DIRECTORY (numbered 267) is now
Antoine Pitrou <solipsis@pitrou.net>
parents: 61467
diff changeset
31 printf(" }\n}\n");
38453
29ae5e0fc348 Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
32 }