Updates from Python SVN, Part 19
Here we are with another update from Python 2.x SVN.
Added os.O_NOATIME constant. It serves the purpose to not update the access time within read operations.
Added os.fchmod() and os.fchown().
sys.py3kwarning flag has been exposed. True when python is started with -3 flag on command line. Also warning.warnpy3k() has been added to help the transition.
Added PyFloat_GetMax, PyFloat_GetMin, PyFloat_GetInfo to the C API and float_info dictionary to the sys module which contains information about the internal floating point type.
Added test suite for the cmd module.
Added Python on Windows documentation.
Implemented PEP 366 (Main module explicit relative imports).
Support loading pickles of random.Random objects created on 32-bit systems on 64-bit systems, and vice versa. As a consequence of the change, Random pickles created by Python 2.6 cannot be loaded in Python 2.5.
Changed GeneratorExit’s base class from Exception to BaseException.
os.access now always returns True on Windows for any existing directory since there are no read only directories on Windows.
Added msvcrt.getwch(), msvcrt.getwche(), msvcrt.putwch(), msvcrt.ungetwch() to handle wide chars.
namedtuple.asdict and namedtuple.replace are now namedtuple._asdict() and namedtuple._replace()
Dictionary construction had a speed-up of about 10%. There is a new opcode, STORE_MAP that saves the compiler from awkward stack manipulations and specializes for dicts using PyDict_SetItem instead of PyObject_SetItem. From the log message:
Old disassembly:
0 BUILD_MAP 0
3 DUP_TOP
4 LOAD_CONST 1 (1)
7 ROT_TWO
8 LOAD_CONST 2 ('x')
11 STORE_SUBSCR
12 DUP_TOP
13 LOAD_CONST 3 (2)
16 ROT_TWO
17 LOAD_CONST 4 ('y')
20 STORE_SUBSCR
New disassembly:
0 BUILD_MAP 0
3 LOAD_CONST 1 (1)
6 LOAD_CONST 2 ('x')
9 STORE_MAP
10 LOAD_CONST 3 (2)
13 LOAD_CONST 4 ('y')
16 STORE_MAP
Another optimization has been added: BUILD_MAP now has a meaning. It’s the estimated size of the dictionary. Allows dictionaries to be pre-sized (upto 255 elements) saving time lost to re-sizes with their attendant mallocs and re-insertions. Has zero effect on small dictionaries (5 elements or fewer), a slight benefit for dicts upto 22 elements (because they had to resize once anyway), and more benefit for dicts upto 255 elements (saving multiple resizes during the build-up and reducing the number of collisions on the first insertions). Beyond 255 elements, there is no addional benefit.
Renamed Py_Size, Py_Type and Py_Refcnt to Py_SIZE, Py_TYPE and Py_REFCNT. Macros for compatibility are available.
Added signal.set_wakeup_fd(). There is a correspondent C API as well: PySignal_SetWakeupFd.
Slightly change in __ hash __ behavior and rich comparison: __ hash __ can be inherited when one __ lt __, __ le __, __ gt __, __ ge __ are overridden, as long as __ eq __ and __ ne __ aren’t.
Improved performance of built-in any()/all() by avoiding PyIter_Next().

