|
Name |
|
Date |
Size |
#Lines |
LOC |
| .. | | - | - |
| NEWS.d/ | | 12-May-2024 | - | 86,495 | 60,802 |
| ACKS | D | 12-May-2024 | 28.8 KiB | 2,002 | 1,996 |
| HISTORY | D | 12-May-2024 | 1.3 MiB | 34,822 | 24,028 |
| Porting | D | 12-May-2024 | 63 | 2 | 1 |
| README | D | 12-May-2024 | 1.4 KiB | 29 | 25 |
| README.AIX | D | 12-May-2024 | 4.6 KiB | 126 | 87 |
| README.coverity | D | 12-May-2024 | 845 | 23 | 15 |
| README.valgrind | D | 12-May-2024 | 4.7 KiB | 106 | 84 |
| SpecialBuilds.txt | D | 12-May-2024 | 4 KiB | 104 | 74 |
| coverity_model.c | D | 12-May-2024 | 4 KiB | 180 | 113 |
| gdbinit | D | 12-May-2024 | 4.8 KiB | 177 | 160 |
| indent.pro | D | 12-May-2024 | 557 | 25 | 24 |
| python-config.in | D | 12-May-2024 | 2 KiB | 75 | 52 |
| python-config.sh.in | D | 12-May-2024 | 2.9 KiB | 117 | 99 |
| python-embed.pc.in | D | 12-May-2024 | 310 | 14 | 12 |
| python-wing3.wpr | D | 12-May-2024 | 555 | 14 | 8 |
| python-wing4.wpr | D | 12-May-2024 | 835 | 19 | 13 |
| python-wing5.wpr | D | 12-May-2024 | 835 | 19 | 13 |
| python.man | D | 12-May-2024 | 17.9 KiB | 576 | 548 |
| python.pc.in | D | 12-May-2024 | 268 | 14 | 12 |
| requirements-test.txt | D | 12-May-2024 | 15 | 2 | 1 |
| stable_abi.txt | D | 12-May-2024 | 45.2 KiB | 2,161 | 2,105 |
| svnmap.txt | D | 12-May-2024 | 4.1 MiB | 72,547 | 72,546 |
| valgrind-python.supp | D | 12-May-2024 | 8.6 KiB | 500 | 442 |
| vgrindefs | D | 12-May-2024 | 500 | 11 | 9 |
README
1Python Misc subdirectory
2========================
3
4This directory contains files that wouldn't fit in elsewhere. Some
5documents are only of historic importance.
6
7Files found here
8----------------
9
10ACKS Acknowledgements
11gdbinit Handy stuff to put in your .gdbinit file, if you use gdb
12HISTORY News from previous releases -- oldest last
13indent.pro GNU indent profile approximating my C style
14NEWS News for this release (for some meaning of "this")
15Porting Mini-FAQ on porting to new platforms
16python-config.in Python script template for python-config
17python.man UNIX man page for the python interpreter
18python.pc.in Package configuration info template for pkg-config
19python-wing*.wpr Wing IDE project file
20README The file you're reading now
21README.AIX Information about using Python on AIX
22README.coverity Information about running Coverity's Prevent on Python
23README.valgrind Information for Valgrind users, see valgrind-python.supp
24SpecialBuilds.txt Describes extra symbols you can set for debug builds
25svnmap.txt Map of old SVN revs and branches to hg changeset ids,
26 help history-digging
27valgrind-python.supp Valgrind suppression file, see README.valgrind
28vgrindefs Python configuration for vgrind (a generic pretty printer)
29
README.AIX
1
2This documentation tries to help people who intend to use Python on
3AIX.
4
5There used to be many issues with Python on AIX, but the major ones
6have been corrected for version 3.2, so that Python should now work
7rather well on this platform. The remaining known issues are listed in
8this document.
9
10
11======================================================================
12 Compiling Python
13----------------------------------------------------------------------
14
15You can compile Python with gcc or the native AIX compiler. The native
16compiler used to give better performances on this system with older
17versions of Python. With Python 3.2 it may not be the case anymore,
18as this compiler does not allow compiling Python with computed gotos.
19Some benchmarks need to be done.
20
21Compiling with gcc:
22
23cd Python-3.2
24CC=gcc OPT="-O2" ./configure --enable-shared
25make
26
27There are various aliases for the native compiler. The recommended
28alias for compiling Python is 'xlc_r', which provides a better level of
29compatibility and handles thread initialization properly.
30
31It is a good idea to add the '-qmaxmem=70000' option, otherwise the
32compiler considers various files too complex to optimize.
33
34Compiling with xlc:
35
36cd Python-3.2
37CC=xlc_r OPT="-O2 -qmaxmem=70000" ./configure --without-computed-gotos --enable-shared
38make
39
40
41======================================================================
42 Memory Limitations
43----------------------------------------------------------------------
44
45Note: this section may not apply when compiling Python as a 64 bit
46application.
47
48By default on AIX each program gets one segment register for its data
49segment. As each segment register covers 256 MiB, a Python program that
50would use more than 256 MiB will raise a MemoryError. The standard
51Python test suite is one such application.
52
53To allocate more segment registers to Python, you must use the linker
54option -bmaxdata or the ldedit tool to specify the number of bytes you
55need in the data segment.
56
57For example, if you want to allow 512 MiB of memory for Python (this is
58enough for the test suite to run without MemoryErrors), you should run
59the following command at the end of compilation:
60
61ldedit -b maxdata:0x20000000 ./python
62
63You can allow up to 2 GiB of memory for Python by using the value
640x80000000 for maxdata.
65
66It is also possible to go beyond 2 GiB of memory by activating Large
67Page Use. You should consult the IBM documentation if you need to use
68this option. You can also follow the discussion of this problem
69in issue 11212 at bugs.python.org.
70
71http://publib.boulder.ibm.com/infocenter/aix/v6r1/index.jsp?topic=/com.ibm.aix.cmds/doc/aixcmds3/ldedit.htm
72
73
74======================================================================
75 Known issues
76----------------------------------------------------------------------
77
78Those issues are currently affecting Python on AIX:
79
80* Python has not been fully tested on AIX when compiled as a 64 bit
81 application.
82
83* issue 3526: the memory used by a Python process will never be
84 released to the system. If you have a Python application on AIX that
85 uses a lot of memory, you should read this issue and you may
86 consider using the provided patch that implements a custom malloc
87 implementation
88
89* issue 11192: test_socket fails
90
91* issue 11190: test_locale fails
92
93* issue 11193: test_subprocess fails
94
95* issue 9920: minor arithmetic issues in cmath
96
97* issue 11215: test_fileio fails
98
99
100
101======================================================================
102 Implementation details for developers
103----------------------------------------------------------------------
104
105Python and python modules can now be built as shared libraries on AIX
106as usual.
107
108AIX shared libraries require that an "export" and "import" file be
109provided at compile time to list all extern symbols which may be
110shared between modules. The "export" file (named python.exp) for the
111modules and the libraries that belong to the Python core is created by
112the "makexp_aix" script before performing the link of the python
113binary. It lists all global symbols (exported during the link) of the
114modules and the libraries that make up the python executable.
115
116When shared library modules (.so files) are made, a second shell
117script is invoked. This script is named "ld_so_aix" and is also
118provided with the distribution in the Modules subdirectory. This
119script acts as an "ld" wrapper which hides the explicit management of
120"export" and "import" files; it adds the appropriate arguments (in the
121appropriate order) to the link command that creates the shared module.
122Among other things, it specifies that the "python.exp" file is an
123"import" file for the shared module.
124
125This mechanism should be transparent.
126
README.coverity
1
2Coverity has a static analysis tool (Prevent) which is similar to Klocwork.
3They run their tool on the Python source code (SVN head) on a daily basis.
4The results are available at:
5
6 http://scan.coverity.com/
7
8About 20 people have access to the analysis reports. Other
9people can be added by request.
10
11Prevent was first run on the Python 2.5 source code in March 2006.
12There were originally about 100 defects reported. Some of these
13were false positives. Over 70 issues were uncovered.
14
15Each warning has a unique id and comments that can be made on it.
16When checking in changes due to a warning, the unique id
17as reported by the tool was added to the SVN commit message.
18
19False positives were annotated so that the comments can
20be reviewed and reversed if the analysis was incorrect.
21
22Contact python-dev@python.org for more information.
23
README.valgrind
1This document describes some caveats about the use of Valgrind with
2Python. Valgrind is used periodically by Python developers to try
3to ensure there are no memory leaks or invalid memory reads/writes.
4
5If you want to enable valgrind support in Python, you will need to
6configure Python --with-valgrind option or an older option
7--without-pymalloc.
8
9UPDATE: Python 3.6 now supports PYTHONMALLOC=malloc environment variable which
10can be used to force the usage of the malloc() allocator of the C library.
11
12If you don't want to read about the details of using Valgrind, there
13are still two things you must do to suppress the warnings. First,
14you must use a suppressions file. One is supplied in
15Misc/valgrind-python.supp. Second, you must uncomment the lines in
16Misc/valgrind-python.supp that suppress the warnings for PyObject_Free and
17PyObject_Realloc.
18
19If you want to use Valgrind more effectively and catch even more
20memory leaks, you will need to configure python --without-pymalloc.
21PyMalloc allocates a few blocks in big chunks and most object
22allocations don't call malloc, they use chunks doled about by PyMalloc
23from the big blocks. This means Valgrind can't detect
24many allocations (and frees), except for those that are forwarded
25to the system malloc. Note: configuring python --without-pymalloc
26makes Python run much slower, especially when running under Valgrind.
27You may need to run the tests in batches under Valgrind to keep
28the memory usage down to allow the tests to complete. It seems to take
29about 5 times longer to run --without-pymalloc.
30
31Apr 15, 2006:
32 test_ctypes causes Valgrind 3.1.1 to fail (crash).
33 test_socket_ssl should be skipped when running valgrind.
34 The reason is that it purposely uses uninitialized memory.
35 This causes many spurious warnings, so it's easier to just skip it.
36
37
38Details:
39--------
40Python uses its own small-object allocation scheme on top of malloc,
41called PyMalloc.
42
43Valgrind may show some unexpected results when PyMalloc is used.
44Starting with Python 2.3, PyMalloc is used by default. You can disable
45PyMalloc when configuring python by adding the --without-pymalloc option.
46If you disable PyMalloc, most of the information in this document and
47the supplied suppressions file will not be useful. As discussed above,
48disabling PyMalloc can catch more problems.
49
50PyMalloc uses 256KB chunks of memory, so it can't detect anything
51wrong within these blocks. For that reason, compiling Python
52--without-pymalloc usually increases the usefulness of other tools.
53
54If you use valgrind on a default build of Python, you will see
55many errors like:
56
57 ==6399== Use of uninitialised value of size 4
58 ==6399== at 0x4A9BDE7E: PyObject_Free (obmalloc.c:711)
59 ==6399== by 0x4A9B8198: dictresize (dictobject.c:477)
60
61These are expected and not a problem. Tim Peters explains
62the situation:
63
64 PyMalloc needs to know whether an arbitrary address is one
65 that's managed by it, or is managed by the system malloc.
66 The current scheme allows this to be determined in constant
67 time, regardless of how many memory areas are under pymalloc's
68 control.
69
70 The memory pymalloc manages itself is in one or more "arenas",
71 each a large contiguous memory area obtained from malloc.
72 The base address of each arena is saved by pymalloc
73 in a vector. Each arena is carved into "pools", and a field at
74 the start of each pool contains the index of that pool's arena's
75 base address in that vector.
76
77 Given an arbitrary address, pymalloc computes the pool base
78 address corresponding to it, then looks at "the index" stored
79 near there. If the index read up is out of bounds for the
80 vector of arena base addresses pymalloc maintains, then
81 pymalloc knows for certain that this address is not under
82 pymalloc's control. Otherwise the index is in bounds, and
83 pymalloc compares
84
85 the arena base address stored at that index in the vector
86
87 to
88
89 the arbitrary address pymalloc is investigating
90
91 pymalloc controls this arbitrary address if and only if it lies
92 in the arena the address's pool's index claims it lies in.
93
94 It doesn't matter whether the memory pymalloc reads up ("the
95 index") is initialized. If it's not initialized, then
96 whatever trash gets read up will lead pymalloc to conclude
97 (correctly) that the address isn't controlled by it, either
98 because the index is out of bounds, or the index is in bounds
99 but the arena it represents doesn't contain the address.
100
101 This determination has to be made on every call to one of
102 pymalloc's free/realloc entry points, so its speed is critical
103 (Python allocates and frees dynamic memory at a ferocious rate
104 -- everything in Python, from integers to "stack frames",
105 lives in the heap).
106