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.

classification
Title: Fixes for Windows sources
Type: Stage:
Components: Windows Versions:
process
Status: closed Resolution: rejected
Dependencies: Superseder:
Assigned To: loewis Nosy List: Carlo_Bramini, brian.curtin, ezio.melotti, loewis, rpetrov, vstinner
Priority: normal Keywords:

Created on 2010-11-28 11:17 by Carlo_Bramini, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
python.txt Carlo_Bramini, 2010-11-28 11:17
python-svn.txt Carlo_Bramini, 2010-11-28 13:57
python-svn.txt Carlo_Bramini, 2010-11-29 01:02
Messages (11)
msg122651 - (view) Author: Carlo Bramini (Carlo_Bramini) Date: 2010-11-28 11:17
Hello,
I was able to compile latest python sources with MSVC5, by importing and fixing a bit the project workspaces of MSVC6.
During this action I received some messages, so I gave a look to the sources and I would like to suggest the following fixes:

1) in posixmodule.c, I had a warning of constant out of range for secs_between_epochs.
The problem has been solved by applying "i64" suffix as suggested in MSDN for doing correct declaration of 64 bits constants.
While doing this fix, I took this chance for adding support for all currently supported platforms: MSVC, GCC and Watcom.

2) in posixmodule.c, I fixed a bit check_gfax() function:
- Function declaration has been fixed with 'void' in its parameter section (fixes a warning).
- I removed the variable 'checked' and I placed instead the handle to kernel32 module.
- I removed the L-value assignment: all other source codes in Python are already corrected in that manner, this is the last one that needs to be fixed.

3) in posixmodule.c, there is a bug in function Py_GetFileAttributesExW(): it tests for 'gfaxa' but later it uses 'gfaxw'.

4) in dl_nt.c, I fixed function prototypes with "void" (solves a warning).

5) in dl_nt.c, in function _LoadActCtxPointers(), I do not see a good reason for using widechar version of GetModuleHandle, since it just need to retrieve the instance of kernel32.

6) in dynload_win.c, I fixed _Py_ActivateActCtx prototype declaration (solves a warning).

7) in dynload_win.c, I suggest to rename local strcasecmp() to something less dangerous to prototype conflicts.

8) in dynload_win.c, in function _PyImport_GetDynLoadFunc() the first 'cookie' variable is not used, so its declaration has been removed.

I hope you will find this useful.

Sincerely,

Carlo Bramini.
msg122656 - (view) Author: Carlo Bramini (Carlo_Bramini) Date: 2010-11-28 13:57
According to the instructions received at #python-dev, I'm posting a new patch with the same fixes made on the most recent SVN sources (py3k).
Actually the new patch does not include the fixes made on the GetFileAttributesEx wrappers since they have been removed in the SVN sources; however I would like to remember that removing that code will also break support for Windows 98 and Windows ME: it's true that they have it but only ASCII version is working.

Sincerely,

Carlo Bramini.
msg122685 - (view) Author: Roumen Petrov (rpetrov) * Date: 2010-11-28 17:26
posix_module has to use Py_LL(...)
msg122696 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2010-11-28 18:26
> According to the instructions received at #python-dev, I'm posting a
> new patch with the same fixes made on the most recent SVN sources
> (py3k). Actually the new patch does not include the fixes made on the
> GetFileAttributesEx wrappers since they have been removed in the SVN
> sources; however I would like to remember that removing that code
> will also break support for Windows 98 and Windows ME: it's true that
> they have it but only ASCII version is working.

Python has not been supporting Windows 98 anymore for quite some time
now. I don't see the need to support MSVC5, either. Since Windows 2000
isn't supported anymore, either, the LoadActCtxPointers function can
be dropped, and be replaced with a direct call to GetCurrentActCtx.
msg122754 - (view) Author: Carlo Bramini (Carlo_Bramini) Date: 2010-11-29 01:02
I modified the patch by using Py_LL() as suggested in a previous comment.

I just would like to say that these fixes are not required to compiling under MSVC5: I was able to compile all the sources as they were, even without changes and this is a great thing.
I have just noticed, from some strange warning messages, that few things required to be fixed, now reduced to correct __STDC__ syntax to some functions (declaring in that manner is wrong anyways, since it's C89) and fix a constant with the right modifier.
msg182724 - (view) Author: Ezio Melotti (ezio.melotti) * (Python committer) Date: 2013-02-23 07:48
Is this issue still valid?
msg182733 - (view) Author: Carlo Bramini (Carlo_Bramini) Date: 2013-02-23 10:58
I have downloaded the latest sources with HG and, with the only exception of the variable "cookie" now conditionally declared with an "#ifdef HAVE_SXS", yes, all these fixes are still actual.
msg182736 - (view) Author: Roumen Petrov (rpetrov) * Date: 2013-02-23 12:16
yes
msg182741 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2013-02-23 13:25
-    HINSTANCE hKernel32 = GetModuleHandleW(L"kernel32.dll");
+    HINSTANCE hKernel32 = GetModuleHandle(TEXT("KERNEL32"));

I prefer to be explicit and force the usage of the wide character API, espacially in Python 3.
msg182883 - (view) Author: Carlo Bramini (Carlo_Bramini) Date: 2013-02-24 18:17
Hello,
no problem, the fix on GetModuleHandle() can be avoided without problems if you want. Anyways, although nowadays the "hybrid" operating systems like Windows 9x/ME are dead and burried, in this particular case I would still suggest to use directly GetModuleHandleA(), because the instance to find is just "KERNEL32" and it is not made by esoteric characters. Normally, as developer for Windows platform, I would surely agree to use the wide char version, but due to the highly portable nature of Python, with my experience I learned that some particular conditions can make the cross compiling for Windows easier, if you do not explicitely add "-fshort-wchar".
BTW, the ".dll" in the string of the parameter is redundant as you can see from MSDN page of GetModuleHandle(), there are also few other points in the sources of Python that can be "optimized", but afterall these are just "fine" improvements, not so much important if they are compared to other things...
msg184420 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2013-03-18 04:03
I'm rejecting the patch, on grounds of PEP 11. We only support MSVC compilers up to 3 years after the extended support by Microsoft has expired. For MSC 5, this is long past. For MSC 6, extended support was discontinued in 2005, for MSVC 2002, in 2009. For all these versions, we will not accept patches anymore.

MSVC 2003 will be supported until 08/10/2013, 2005 until 12/04/2016, and 2008 until 10/04/2018, so we would continue to accept for any of these for quite some time.
History
Date User Action Args
2022-04-11 14:57:09adminsetgithub: 54769
2013-03-18 04:03:11loewissetstatus: open -> closed
resolution: rejected
messages: + msg184420
2013-02-24 18:17:56Carlo_Braminisetmessages: + msg182883
2013-02-23 13:25:58vstinnersetnosy: + vstinner
messages: + msg182741
2013-02-23 12:16:50rpetrovsetmessages: + msg182736
2013-02-23 10:58:38Carlo_Braminisetstatus: pending -> open

messages: + msg182733
2013-02-23 07:48:10ezio.melottisetstatus: open -> pending
nosy: + ezio.melotti, brian.curtin
messages: + msg182724

2010-11-29 01:02:22Carlo_Braminisetfiles: + python-svn.txt

messages: + msg122754
2010-11-28 18:26:58loewissetmessages: + msg122696
2010-11-28 17:26:28rpetrovsetnosy: + rpetrov
messages: + msg122685
2010-11-28 13:57:05Carlo_Braminisetfiles: + python-svn.txt

messages: + msg122656
2010-11-28 12:54:25georg.brandlsetassignee: loewis

nosy: + loewis
2010-11-28 11:17:56Carlo_Braminicreate