Mercurial > cpython-lru_cache-weakref
annotate Modules/makexp_aix @ 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 | 57f630a9de26 |
| children |
| rev | line source |
|---|---|
|
3967
53019e3a6d5a
Re-install aix files (what happened?)
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1 #!/bin/sh |
|
53019e3a6d5a
Re-install aix files (what happened?)
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2 # |
|
53019e3a6d5a
Re-install aix files (what happened?)
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
3 # =========================================================================== |
|
53019e3a6d5a
Re-install aix files (what happened?)
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
4 # FILE: makexp_aix |
|
53019e3a6d5a
Re-install aix files (what happened?)
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
5 # TYPE: standalone executable |
|
53019e3a6d5a
Re-install aix files (what happened?)
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
6 # SYSTEM: AIX 3.2.5 and AIX 4 |
|
53019e3a6d5a
Re-install aix files (what happened?)
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
7 # |
|
53019e3a6d5a
Re-install aix files (what happened?)
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
8 # DESCRIPTION: This script creates an export list of ALL global symbols |
|
53019e3a6d5a
Re-install aix files (what happened?)
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
9 # from a list of object or archive files. |
|
53019e3a6d5a
Re-install aix files (what happened?)
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
10 # |
|
53019e3a6d5a
Re-install aix files (what happened?)
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
11 # USAGE: makexp_aix <OutputFile> "<FirstLine>" <InputFile> ... |
|
53019e3a6d5a
Re-install aix files (what happened?)
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
12 # |
|
53019e3a6d5a
Re-install aix files (what happened?)
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
13 # where: |
|
53019e3a6d5a
Re-install aix files (what happened?)
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
14 # <OutputFile> is the target export list filename. |
|
53019e3a6d5a
Re-install aix files (what happened?)
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
15 # <FirstLine> is the path/file string to be appended |
|
53019e3a6d5a
Re-install aix files (what happened?)
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
16 # after the "#!" symbols in the first line of the |
|
53019e3a6d5a
Re-install aix files (what happened?)
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
17 # export file. Passing "" means deferred resolution. |
|
53019e3a6d5a
Re-install aix files (what happened?)
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
18 # <InputFile> is an object (.o) or an archive file (.a). |
|
53019e3a6d5a
Re-install aix files (what happened?)
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
19 # |
|
53019e3a6d5a
Re-install aix files (what happened?)
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
20 # HISTORY: |
|
7947
a2c1b3e17952
remove C++ entries of the form Class::method
Guido van Rossum <guido@python.org>
parents:
3967
diff
changeset
|
21 # 3-Apr-1998 -- remove C++ entries of the form Class::method |
|
a2c1b3e17952
remove C++ entries of the form Class::method
Guido van Rossum <guido@python.org>
parents:
3967
diff
changeset
|
22 # Vladimir Marangozov |
|
a2c1b3e17952
remove C++ entries of the form Class::method
Guido van Rossum <guido@python.org>
parents:
3967
diff
changeset
|
23 # |
|
3967
53019e3a6d5a
Re-install aix files (what happened?)
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
24 # 1-Jul-1996 -- added header information |
|
53019e3a6d5a
Re-install aix files (what happened?)
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
25 # Vladimir Marangozov |
|
53019e3a6d5a
Re-install aix files (what happened?)
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
26 # |
|
53019e3a6d5a
Re-install aix files (what happened?)
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
27 # 28-Jun-1996 -- initial code |
|
53019e3a6d5a
Re-install aix files (what happened?)
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
28 # Vladimir Marangozov (Vladimir.Marangozov@imag.fr) |
|
53019e3a6d5a
Re-install aix files (what happened?)
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
29 # ========================================================================== |
|
53019e3a6d5a
Re-install aix files (what happened?)
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
30 |
|
53019e3a6d5a
Re-install aix files (what happened?)
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
31 # Variables |
|
53019e3a6d5a
Re-install aix files (what happened?)
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
32 expFileName=$1 |
|
53019e3a6d5a
Re-install aix files (what happened?)
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
33 toAppendStr=$2 |
|
53019e3a6d5a
Re-install aix files (what happened?)
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
34 shift; shift; |
|
53019e3a6d5a
Re-install aix files (what happened?)
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
35 inputFiles=$* |
|
53019e3a6d5a
Re-install aix files (what happened?)
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
36 automsg="Generated automatically by makexp_aix" |
|
53019e3a6d5a
Re-install aix files (what happened?)
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
37 notemsg="NOTE: lists _all_ global symbols defined in the above file(s)." |
|
53019e3a6d5a
Re-install aix files (what happened?)
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
38 curwdir=`pwd` |
|
53019e3a6d5a
Re-install aix files (what happened?)
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
39 |
|
53019e3a6d5a
Re-install aix files (what happened?)
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
40 # Create the export file and setup the header info |
|
53019e3a6d5a
Re-install aix files (what happened?)
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
41 echo "#!"$toAppendStr > $expFileName |
|
53019e3a6d5a
Re-install aix files (what happened?)
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
42 echo "*" >> $expFileName |
|
53019e3a6d5a
Re-install aix files (what happened?)
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
43 echo "* $automsg (`date -u`)" >> $expFileName |
|
53019e3a6d5a
Re-install aix files (what happened?)
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
44 echo "*" >> $expFileName |
|
53019e3a6d5a
Re-install aix files (what happened?)
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
45 echo "* Base Directory: $curwdir" >> $expFileName |
|
53019e3a6d5a
Re-install aix files (what happened?)
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
46 echo "* Input File(s) : $inputFiles" >> $expFileName |
|
53019e3a6d5a
Re-install aix files (what happened?)
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
47 echo "*" >> $expFileName |
|
53019e3a6d5a
Re-install aix files (what happened?)
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
48 echo "* $notemsg" >> $expFileName |
|
53019e3a6d5a
Re-install aix files (what happened?)
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
49 echo "*" >> $expFileName |
|
53019e3a6d5a
Re-install aix files (what happened?)
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
50 |
|
53019e3a6d5a
Re-install aix files (what happened?)
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
51 # Extract the symbol list using 'nm' which produces quite |
|
53019e3a6d5a
Re-install aix files (what happened?)
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
52 # different output under AIX 4 than under AIX 3.2.5. |
|
53019e3a6d5a
Re-install aix files (what happened?)
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
53 # The following handles both versions by using a common flagset. |
|
53019e3a6d5a
Re-install aix files (what happened?)
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
54 # Here are some hidden tricks: |
|
53019e3a6d5a
Re-install aix files (what happened?)
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
55 # 1. Use /usr/ccs/bin/nm. Relevant to AIX 3.2.5 which has |
|
53019e3a6d5a
Re-install aix files (what happened?)
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
56 # another version under /usr/ucb/bin/nm. |
|
53019e3a6d5a
Re-install aix files (what happened?)
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
57 # 2. Use the -B flag to have a standard BSD representation |
|
53019e3a6d5a
Re-install aix files (what happened?)
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
58 # of the symbol list on both AIX 3.2.5 and AIX 4. The "-B" |
|
53019e3a6d5a
Re-install aix files (what happened?)
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
59 # flag is missing in the AIX 3.2.5 online usage help of 'nm'. |
|
53019e3a6d5a
Re-install aix files (what happened?)
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
60 # 3. Use the -x flag to have a hex representation of the symbol |
|
53019e3a6d5a
Re-install aix files (what happened?)
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
61 # values. This fills the leading whitespaces on AIX 4, |
|
53019e3a6d5a
Re-install aix files (what happened?)
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
62 # thus simplifying the sed statement. |
|
53019e3a6d5a
Re-install aix files (what happened?)
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
63 # 4. Eliminate all entries except those with either "B", "D" |
|
53019e3a6d5a
Re-install aix files (what happened?)
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
64 # or "T" key letters. We are interested only in the global |
|
53019e3a6d5a
Re-install aix files (what happened?)
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
65 # (extern) BSS, DATA and TEXT symbols. With the same statement |
|
53019e3a6d5a
Re-install aix files (what happened?)
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
66 # we eliminate object member lines relevant to AIX 4. |
|
53019e3a6d5a
Re-install aix files (what happened?)
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
67 # 5. Eliminate entries containing a dot. We can have a dot only |
|
53019e3a6d5a
Re-install aix files (what happened?)
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
68 # as a symbol prefix, but such symbols are undefined externs. |
|
53019e3a6d5a
Re-install aix files (what happened?)
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
69 # 6. Eliminate everything including the key letter, so that we're |
|
53019e3a6d5a
Re-install aix files (what happened?)
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
70 # left with just the symbol name. |
|
7947
a2c1b3e17952
remove C++ entries of the form Class::method
Guido van Rossum <guido@python.org>
parents:
3967
diff
changeset
|
71 # 7. Eliminate all entries containing two colons, like Class::method |
|
3967
53019e3a6d5a
Re-install aix files (what happened?)
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
72 # |
|
35551
57f630a9de26
- Changes donated by Elemental Security to make it work on AIX 5.3
Guido van Rossum <guido@python.org>
parents:
7947
diff
changeset
|
73 |
|
57f630a9de26
- Changes donated by Elemental Security to make it work on AIX 5.3
Guido van Rossum <guido@python.org>
parents:
7947
diff
changeset
|
74 # Use -X32_64 if it appears to be implemented in this version of 'nm'. |
|
57f630a9de26
- Changes donated by Elemental Security to make it work on AIX 5.3
Guido van Rossum <guido@python.org>
parents:
7947
diff
changeset
|
75 NM=/usr/ccs/bin/nm |
|
57f630a9de26
- Changes donated by Elemental Security to make it work on AIX 5.3
Guido van Rossum <guido@python.org>
parents:
7947
diff
changeset
|
76 xopt=-X32_64 |
|
57f630a9de26
- Changes donated by Elemental Security to make it work on AIX 5.3
Guido van Rossum <guido@python.org>
parents:
7947
diff
changeset
|
77 $NM -e $xopt $1 >/dev/null 2>&1 || xopt="" |
|
57f630a9de26
- Changes donated by Elemental Security to make it work on AIX 5.3
Guido van Rossum <guido@python.org>
parents:
7947
diff
changeset
|
78 |
|
57f630a9de26
- Changes donated by Elemental Security to make it work on AIX 5.3
Guido van Rossum <guido@python.org>
parents:
7947
diff
changeset
|
79 $NM -Bex $xopt $inputFiles \ |
|
7947
a2c1b3e17952
remove C++ entries of the form Class::method
Guido van Rossum <guido@python.org>
parents:
3967
diff
changeset
|
80 | sed -e '/ [^BDT] /d' -e '/\./d' -e 's/.* [BDT] //' -e '/::/d' \ |
|
3967
53019e3a6d5a
Re-install aix files (what happened?)
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
81 | sort | uniq >> $expFileName |
