Fix build problem of CPython 2.7 with Readline 6.3 (#126, #131, #149)

The patch was taken from latest changes in CPython 2.7

* http://hg.python.org/cpython/rev/79b82ebc4fd1
* http://hg.python.org/cpython/rev/5e42e5764ac6
* http://hg.python.org/cpython/rev/0b5b0bfcc7b1
Fix build problem of CPython 2.6 with Readline 6.3 (#126, #131, #149)
Fix build problem of CPython 3.3 with Readline 6.3 (#126, #131, #149)

The patch was taken from CPython 3.3.5
Fix build problem of CPython 3.2 with Readline 6.3 (#126, #131, #149)
Fix build problem of CPython 3.1 with Readline 6.3 (#126, #131, #149)
Merge pull request #152 from yyuu/readline63

Fix CPython build problem with Readline 6.3 (fixes #126, fixes #149)