[Patches] [ python-Patches-1685563 ] MSVCCompiler creates redundant and long PATH strings

SourceForge.net noreply at sourceforge.net
Sun Apr 1 20:30:05 CEST 2007


Patches item #1685563, was opened at 2007-03-21 15:05
Message generated for change (Comment added) made by nnorwitz
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1685563&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Distutils and setup.py
>Group: Python 2.5
>Status: Closed
>Resolution: Accepted
Priority: 5
Private: No
Submitted By: Scott Dial (geekmug)
>Assigned to: Neal Norwitz (nnorwitz)
Summary: MSVCCompiler creates redundant and long PATH strings

Initial Comment:
The current code in MSVCCompiler.initialiaze will throw  an OSError on the assignment to os.environ['path'] after repeated usages of MSVCCompilers because the string produced may exceeed 4096 characters (usually after several compilations). In the call to initialize, the needed paths for compiling via the compiler selected are added on to the front of the path regardless of what the current path is set to be. This is bad because we could be adding redundant paths (and thus exceeding the 4096 character limit needlessly)

Furthmore, this happens regularly whenever anyone uses the VCToolkit2003 compiler because you end up in the "if self.__version >= 7:" control path of get_msvc_paths which merely returns the current path back to the callee. This results in initialize /duplicating the entire path/.

The proposed patch adds a pass through the new path that removes duplicates while maintaining the ordering.

Unfortunately it is difficult for me to provide a real test case for this as it arises out of trying to run the translate code with PyPy. However, I hope that the change is obviously fixing a bug that I've made clear exists.


----------------------------------------------------------------------

>Comment By: Neal Norwitz (nnorwitz)
Date: 2007-04-01 11:30

Message:
Logged In: YES 
user_id=33168
Originator: NO

Committed revision 54644.
Committed revision 54645. (2.5)

Backporting might be considered a little sketchy, but it fixes a real
problem and is not too likely to break something important (ha! that's just
inviting Murphy in).  Please test 2.5.1c1 that will be coming out in a few
days.  I modified the patch to use a utility function and added comments
and docstrings.


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1685563&group_id=5470


More information about the Patches mailing list