This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: Posix module init function name should not be compiler-dependent
Type: compile error Stage:
Components: Interpreter Core, Windows Versions: Python 3.5
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: Arfrever, Jeffrey.Armstrong, georg.brandl, loewis, pitrou, vstinner
Priority: normal Keywords: patch

Created on 2014-10-08 13:26 by Jeffrey.Armstrong, last changed 2022-04-11 14:58 by admin. This issue is now closed.

File name Uploaded Description Edit
posix_init.patch Jeffrey.Armstrong, 2014-10-08 13:26 Patch to check for MS_WINDOWS when determining name of posix module's init function
Messages (6)
msg228789 - (view) Author: Jeffrey Armstrong (Jeffrey.Armstrong) * Date: 2014-10-08 13:26
The determination of the name of the posix module's initialization function (at Modules/posixmodule.c:12055)  is currently dependent on the compiler being used.  For MSVC, Watcom, or Borland, the name is defined as "PyInit_nt."  However, both Open Watcom and Borland have shipped compilers for GNU/Linux (and other platforms), making determining the posix module initialization function based on compiler incorrect.

Most other places in Modules/posixmodule.c correctly use the "MS_WINDOWS" preprocessor definition to determine if Windows routines should be used.  Naming the intialization function for the posix module should be dependent on this as well rather than compiler identifiers.  

Linking the interpreter natively with Open Watcom fails under GNU/Linux due to "PyInit_posix" being undefined.  This occurs because of the reasons described above.  The patch included corrects the issue.
msg228861 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2014-10-09 11:50
The patch looks good to me, but I would prefer that someone else double check.
msg228908 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2014-10-09 20:41
There is also

#if !defined(__QNX__)
#if defined(MS_WINDOWS) || defined(__BORLANDC__) || defined(__WATCOMC__) || defined(__DJGPP__)
#define SEP L'\\'
#define ALTSEP L'/'
#define MAXPATHLEN 256
#define DELIM L';'

in Include/osdefs.h
msg228911 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2014-10-09 21:08
I would remove the "|| defined(__BORLANDC__) || defined(__WATCOMC__) || defined(__DJGPP__)" part, since it's probably for MSDOS variants of those compilers.
msg228914 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2014-10-09 21:17
> I would remove the "|| defined(__BORLANDC__) || defined(__WATCOMC__) || defined(__DJGPP__)" part, since it's probably for MSDOS variants of those compilers.

I agree, but IMO it is unrelated to this issue. Jeffrey wants to support a new C compiler (OpenWatcom) on Windows, not drop support of MS-DOS or old C compiler.

I created the issue #22591 to drop support of MS-DOS specific code.
msg228929 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2014-10-09 22:14
Ok, I pushed the change:
changeset:   92900:c7adad17f663
user:        Victor Stinner <>
date:        Fri Oct 10 00:09:47 2014 +0200
files:       Modules/posixmodule.c

Closes #22579: Fix posixmodule.c to support any C compiler on Windows

Oh, I forgot to mention that Jeffrey Armstrong wrote it, sorry :-(

I created the issue #22592 "Drop support of Borland C compiler". See also the issue #22591 for MS-DOS.
Date User Action Args
2022-04-11 14:58:08adminsetgithub: 66769
2014-10-09 22:14:23vstinnersetstatus: open -> closed
resolution: fixed
messages: + msg228929
2014-10-09 22:06:10Arfreversetnosy: + Arfrever
2014-10-09 21:17:07vstinnersetmessages: + msg228914
2014-10-09 21:08:11pitrousetmessages: + msg228911
2014-10-09 20:41:01georg.brandlsetnosy: + georg.brandl
messages: + msg228908
2014-10-09 11:50:08vstinnersetversions: + Python 3.5, - Python 3.4
nosy: + loewis, vstinner, pitrou

messages: + msg228861

components: + Windows
2014-10-08 13:26:55Jeffrey.Armstrongcreate