Compiling Python24a3 in MinGW & tests

A. B., Khalid abkhd at
Sun Sep 12 01:21:41 CEST 2004

Hello all.

After the effort of getting most of Python 2.3.4 Final compiled in
MinGW (see:,
and get the patch and read more about it here:, allow me to
report that it is now also possible to compile and build most of
python24a3 in MinGW as well.

Few issues remain. For a detailed list of those visit
( For now I just
want to mention that almost all tests of modules or code (as of CVS
Python source of Sept, 9th, 2004) that was compiled in MinGW pass or
skip quietly if invoked on their own.

However, and hoping that someone would know why, several module tests
fail (and crash the MinGW compiled python24a3: Windows bluescreen
shows) when run from the regrtest framework. These include:

  - test_codeccallbacks,
  - test_codecs,
  - test_normalization,
  - test_pyexpat,
  - test_re,
  - test_minidom,
  - test_stringprep,
  - test_ucn,
  - test_unicode
  - test_unicode_file, and
  - test_unicodedata

Some modules are also causing MinGW python24a3 to show the dreaded
Windows' bluescreen. These include:
  - zlib
  - _testcapi
  - pyexpat, but only when used by test_sax inside the regrtest.

My system:
 + Win98
 + GCC 3.4.1 mingw special
 + DEV-C++ v.
 + MYSYS v. 1.0.9

With that in mind, I am unable to test module _socket, as Windows 98
does not support some of the new API calls of the latest python:
getaddrinfo, and friends. However, I have a feeling that the patched
module will work if compiled in MinGW under anything higher than

For file sizes, here is the list:
PYTHON   EXE         6.656  09/09/04   3:53 python.exe
PYTHONW  EXE         6.656  09/09/04   3:53 pythonw.exe
W9XPOPEN EXE         6.144  09/09/04   3:51 w9xpopen.exe
PYTHON24 DLL     2.046.464  09/09/04   3:49 python24.dll

Running python24a3 from MSYS:
$ python -i
Python 2.4a3 (#56, Sep  9 2004, 03:39:46)
[GCC 3.4.1 (mingw special)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from test import test_unicode_file as t
>>> t.test_main()
test_directories (test.test_unicode_file.TestUnicodeFiles) ... ok
test_equivalent_files (test.test_unicode_file.TestUnicodeFiles) ... ok
test_single_files (test.test_unicode_file.TestUnicodeFiles) ... ok

Ran 3 tests in 0.870s


Summary of regrtest.main() output after renaming the
tests listed above and renaming _socket.pyd, pyexpat.pyd,
zlib.pyd, and _testcapi so as python cannot find them:
200 tests OK.
5 tests failed:
    test___all__ test_cookielib test_mailbox test_mimetools
72 tests skipped:
    test__locale test_aepack test_al test_applesingle test_asynchat
    test_bsddb test_bsddb185 test_bsddb3 test_capi test_cd test_cgi
    test_cl test_codecmaps_cn test_codecmaps_hk test_codecmaps_jp
    test_codecmaps_kr test_codecmaps_tw test_commands test_crypt
    test_curses test_dbm test_dl test_email test_email_codecs
    test_exceptions test_fcntl test_fork1 test_gdbm test_getargs2
    test_gl test_grp test_gzip test_httplib test_imaplib test_imgfile
    test_ioctl test_largefile test_linuxaudiodev test_logging
    test_macfs test_macostools test_mhlib test_mimetypes test_nis
    test_openpty test_ossaudiodev test_pep277 test_plistlib test_poll
    test_posix test_pty test_pwd test_resource test_robotparser
    test_sax test_scriptpackages test_signal test_socket
    test_socket_ssl test_socketserver test_sunaudiodev test_sundry
    test_tcl test_threadsignals test_timeout test_timing test_urllib
    test_urllib2 test_urllib2net test_urllibnet test_zipimport
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
363, in main
    e = _ExpectedSkips()
1064, in __init__
    from test import test_normalization
ImportError: cannot import name test_normalization
>>> raise SystemExit

And BTW, distutils was also patched to default to using the MinGW
compiler for building extensions when it detects that the python it is
running on was compiled in MinGW. It basically looks for the
sys.version info, and if it finds the string "mingw" it configures the
MinGW compiler for use.

Finally, this is provided in the hope that some people will benefit
from it, and that some will actually help improve the pyMinGW patch so
as using the MinGW compiler would get to be as easy as using any
other. Any thoughts are welcome.


Q. The purpose of life?

[A]: "I created the jinn and humankind only that they might
     worship Me." (Translation, Qur'an, 51:56)

[B]: "Let us hear the conclusion of the whole matter:
     Fear God, and keep his commandments: for this is the
     whole duty of man." (KJV, Ecclesiastes 12:13)

More information about the Python-list mailing list