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: incomplete revert in 2.7 Distutils left two copies of customize_compiler
Type: behavior Stage: resolved
Components: Distutils Versions: Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: eric.araujo Nosy List: Arfrever, benjamin.peterson, eric.araujo, lemburg, ned.deily, python-dev, tarek
Priority: release blocker Keywords: patch

Created on 2012-02-11 16:41 by ned.deily, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
issue13994_27.patch ned.deily, 2012-02-11 16:45
issue13994_compat.patch ned.deily, 2012-04-20 11:55
Messages (26)
msg153130 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2012-02-11 16:41
While final testing Distutils changes for Issue13590, I noticed that a few tests were failing unexpectedly on 2.7.x but passing on 3.2.x.  Upon further investigation, I discovered that in 2.7 there are two copies of "customize_compiler", the function being modified in Issue13590.  It appears that at one point prior to the decision to make no feature changes to Distutils, that customize_compiler was moved from distutils.sysconfig to distutils.ccompiler (fa69e891edf4).  Then, when the decision was made to revert changes and proceed with a new Distutils2/packaging, feature changes were reverted in 2.7 but, for unexplained reasons, only part of the changes were reverted (ad22bc22dddc).  Perhaps a clue is in the commit message:
  "reverting partially distutils to its 2.6.x state so 2.7a4 looks more
   like the 2.7b1 in this. the whole revert will occur after a4 is tagged "

From the change logs, I see no evidence that the whole revert ever happened.  This has left 2.7 Distutils with two virtually identical versions of customize_compiler with some commands and tests calling one and others calling the other.  (In 3.2.x, the only version is in distutils.sysconfig.)  They *were* virtually identically until Issue13590 changed one and missed the other.

Patch to follow which completes the revert for customize_compiler and brings 2.7.x and 3.2.2 back into sync with respect to this.  This patch is needed immediately for the upcoming 2.7.3 release.  I strongly urge a more complete audit for other discrepancies between the 2.7.x and 3.2.x versions of Distutils; this isn't the first time we've been burned recently by the effects of the reverts in 2.7.
msg153133 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2012-02-11 19:42
New changeset 6240ff5dfebe by Ned Deily in branch '2.7':
Issue #13994: Earler partial revert of Distutils enhancements in 2.7
http://hg.python.org/cpython/rev/6240ff5dfebe
msg153134 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2012-02-11 19:44
With the release manager's concurrence, I've applied this patch prior to the freeze for 2.7.3.
msg153149 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2012-02-12 03:03
FWIW I approve of the patch.

Quoting Ned:
> this isn't the first time we've been burned by the after effects of the 2.7 Distutils
> revert.  I really think we should go through and make sure there aren't other unnecessary
> discrepancies between the current state of 2.7.x and 3.2.x/default.
The revert indiscriminately reverted new features and bug and doc fixes, some of which have been fixed again later when rediscovered.  I never did a systematic review but I could.  One of the most painful difference between 2.7 and 3.x is the use of urllib vs. httplib in the register and upload commands, which does not let me port patches easily.
msg158766 - (view) Author: Marc-Andre Lemburg (lemburg) * (Python committer) Date: 2012-04-19 22:18
The patch broke egenix-mx-base, since it relies on the customize_compiler() being available in distutils.ccompiler:

https://www.egenix.com/mailman-archives/egenix-users/2012-April/114838.html

If you make such changes to dot releases, please make absolutely sure that when you move functions from one module to another, you keep backwards compatibility aliases around.
msg158767 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2012-04-19 22:24
Sorry for not thinking about this.  I’ll be more careful.
msg158768 - (view) Author: Marc-Andre Lemburg (lemburg) * (Python committer) Date: 2012-04-19 22:24
Here's the quote from mxSetup.py:

    # distutils changed a lot in Python 2.7 due to many
    # distutils.sysconfig APIs having been moved to the new
    # (top-level) sysconfig module.
    from sysconfig import \
         get_config_h_filename, parse_config_h, get_path, \
         get_config_vars, get_python_version, get_platform

    # This API was moved from distutils.sysconfig to distutils.ccompiler
    # in Python 2.7
    from distutils.ccompiler import customize_compiler

So in 2.7 the function was moved from sysconfig to ccompiler (where it belongs), and now you're reverting the change in the third dot release.
msg158769 - (view) Author: Marc-Andre Lemburg (lemburg) * (Python committer) Date: 2012-04-19 22:32
Éric Araujo wrote:
> 
> Sorry for not thinking about this.  I’ll be more careful.

No need to be sorry; these things can happen.

What I don't understand is this line in the news section:

"Complete the revert back to only having one in distutils.sysconfig as
 7.12 +  is the case in 3.x."

Back when I discussed these changes with Tarek, we both agreed that
customize_compiler() is better placed into the ccompiler module
than the sysconfig module, so I think the one in the sysconfig
module should be replaced with a reference to the version in the
ccompile module - in both 2.7 and 3.x.
msg158770 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2012-04-19 22:34
That's unfortunate.  But the documented location for customize_compiler is and, AFAIK, had always been in distutils.sysconfig.  It was an inadvertent consequence of the bad revert during the 2.7 development cycle that a second copy was made available in distutils.ccompiler.  That change was not supposed to be released in 2.7 and was never documented.  So I don't think there is anything that can or needs to be done as this point in Python itself.  Other opinions?
msg158774 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2012-04-19 23:27
And to recap the history here, there was a change in direction for Distutils during the 2.7 development cycle, as decided at the 2010 language summit, in particular to revert feature changes in Distutils for 2.7 to its 2.6.x state and, going forward, "Distutils in Python will be feature-frozen".

http://mail.python.org/pipermail/python-dev/2010-March/098135.html
msg158805 - (view) Author: Marc-Andre Lemburg (lemburg) * (Python committer) Date: 2012-04-20 08:38
Ned Deily wrote:
> 
> Ned Deily <nad@acm.org> added the comment:
> 
> That's unfortunate.  But the documented location for customize_compiler is and, AFAIK, had always been in distutils.sysconfig.  It was an inadvertent consequence of the bad revert during the 2.7 development cycle that a second copy was made available in distutils.ccompiler.  That change was not supposed to be released in 2.7 and was never documented.  So I don't think there is anything that can or needs to be done as this point in Python itself.  Other opinions?

Excuse me, Ned, but that's not how we do approach dot releases in Python.

Regardless of whether the documentation was fixed or not, you cannot
simply remove a non-private function without making sure that at least
the import continues to work.
msg158806 - (view) Author: Marc-Andre Lemburg (lemburg) * (Python committer) Date: 2012-04-20 08:45
Ned Deily wrote:
> 
> And to recap the history here, there was a change in direction for Distutils during the 2.7 development cycle, as decided at the 2010 language summit, in particular to revert feature changes in Distutils for 2.7 to its 2.6.x state and, going forward, "Distutils in Python will be feature-frozen".
> 
> http://mail.python.org/pipermail/python-dev/2010-March/098135.html

I know that distutils development was stopped (even though I don't
consider that a good thing), but since the code changes were let
into the wild, we have to deal with it properly now.
msg158807 - (view) Author: Marc-Andre Lemburg (lemburg) * (Python committer) Date: 2012-04-20 09:12
Marc-Andre Lemburg wrote:
> 
>> Ned Deily <nad@acm.org> added the comment:
>>
>> That's unfortunate.  But the documented location for customize_compiler is and, AFAIK, had always been in distutils.sysconfig.  It was an inadvertent consequence of the bad revert during the 2.7 development cycle that a second copy was made available in distutils.ccompiler.  That change was not supposed to be released in 2.7 and was never documented.  So I don't think there is anything that can or needs to be done as this point in Python itself.  Other opinions?
> 
> Excuse me, Ned, but that's not how we do approach dot releases in Python.
> 
> Regardless of whether the documentation was fixed or not, you cannot
> simply remove a non-private function without making sure that at least
> the import continues to work.

Turns out, the "fix" broke all our packages for Python 2.7.3 and
I can hardly believe we're the only ones affected by this.
msg158820 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2012-04-20 11:55
I agree that we should always try very hard not to break anything in point releases.  But I think it is fair to say that this is an unusual case.  Looking at the commit logs (and Tarek can correct me if I misread them), it appears the change that, among other things, moved customize_compiler was committed on 2010-01-23, in time for 2.7alpha3.  The language summit decision followed soon thereafter and the faulty partial revert happened on 2010-03-05, in time for 2.7alpha4.  So, if the revert had been completed as intended, the moved module should have only been in the wild for a little over a month.  Clearly you had a vested interest in making the change to your code base but it seems unlikely that anyone else would have gone to the trouble of changing their code since existing (2.6) code would have only been broken for that one small alpha window, 2.7 alpha3.  And considering that customize_compiler is probably not used by all that many packages to begin with it, I would think it is not unlikely that you *are* the only ones affected by it.

Nevertheless, what are the alternatives?  We could add a wrapper function into distutils.ccompiler that just calls the distutils.sysconfig version.  Here's a patch that attempts to do so. That should fix that breakage for the eGenix packages.  It would be great if you could test it.

It's up to the 2.7 release manager to decide what action to take, i.e. whether the patch is needed and, if so, how quickly to schedule a new release.  As a practical matter, regardless of whether the patch is applied in Python or not, I would assume that a faster solution for your end users would be to ship a version of the eGenix packages that reverts the changes(s) there.  By the way, it looks like you'll need to eventually do that anyway since the code in mxSetup.py incorrectly assumes that the corresponding changes were also made to Python 3.2.
msg158826 - (view) Author: Marc-Andre Lemburg (lemburg) * (Python committer) Date: 2012-04-20 12:47
ink it 
is not unlikely that you *are* the only ones affected by it.

With "in the wild" I'm referring to the function being released in
the ccompiler not only in alpha releases but also in the beta
releases, the 2.7, 2.7.1 and 2.7.2 release - in every release
since early in 2010.

We were unaware of the reversal of the changes by Tarek and
the way we coded things in mxSetup.py did not show that things
were removed again, simply because we support more than just
Python 2.7 and have proper fallback solutions for most things.

Only in this particular case, we were using different strategies
based on the Python version number and so there is no fallback.

> Nevertheless, what are the alternatives?  We could add a wrapper function into distutils.ccompiler that just calls the distutils.sysconfig version.  Here's a patch that attempts to do so. That should fix that breakage for the eGenix packages.  It would be great if you could test it.

The fix is easy: simply import the customize_compiler() API in
the ccompiler module to maintain compatibility with what had
already been release. No need to add a wrapper function,
a single

from distutils.sysconfig import customize_compiler()

in ccompile.py will do just fine.

> It's up to the 2.7 release manager to decide what action to take, i.e. whether the patch is needed and, if so, how quickly to schedule a new release.  As a practical matter, regardless of whether the patch is applied in Python or not, I would assume that a faster solution for your end users would be to ship a version of the eGenix packages that reverts the changes(s) there.  By the way, it looks like you'll need to eventually do that anyway since the code in mxSetup.py incorrectly assumes that the corresponding changes were also made to Python 3.2.

We don't support Python 3.x yet, so that's a non-issue at the moment.

But yes, we will have to release new patch level releases for all
our packages to get this fixed for our users.
msg158842 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2012-04-20 15:32
[MAL]
> I know that distutils development was stopped (even though I don't consider that a good thing)
This is OT, but could you tell a bit more?  The freeze appears to me to have been a necessary decision due to the impossibility of making non-trivial changes without breaking setup scripts or projects such as mxSetup.

> but since the code changes were let into the wild, we have to deal with it properly now.
This I agree with.  Saturday or Sunday I will have the time to commit a fix and test.
msg180858 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2013-01-28 14:46
Does this still need to block 2.7.4?
msg180861 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2013-01-28 16:31
2.7.3 broke some setup scripts, it wouldn’t be bad to fix this in 2.7.4.  I’ll make time before RC.
msg181176 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2013-02-02 16:28
It's not clear to me at all what needs to happen here, so I'm just going to have to drop it for 2.7.4.
msg181240 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2013-02-03 04:07
Benjamin: what’s missing is an import.

Is it too late?  I changed home today and that took a lot of my time and energy this week, so I may have missed 2.7.4.
msg181245 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2013-02-03 06:47
There's a window above about 12 hours now.
msg181275 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2013-02-03 16:30
On it.
msg181276 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2013-02-03 16:41
New changeset d4dd297fedb1 by Éric Araujo in branch '2.7':
Add alias to restore 2.7.2 compatibility for setup scripts (#13994).
http://hg.python.org/cpython/rev/d4dd297fedb1
msg181277 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2013-02-03 16:43
Benjamin, I don’t know if you are using a release clone or if you will just tag the main repo, so leaving this open for now.
msg181278 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2013-02-03 16:44
Not yet tagged.
msg181367 - (view) Author: Marc-Andre Lemburg (lemburg) * (Python committer) Date: 2013-02-04 18:33
Thanks for getting this in, Eric !
History
Date User Action Args
2022-04-11 14:57:26adminsetgithub: 58202
2013-02-04 18:33:20lemburgsetmessages: + msg181367
2013-02-03 16:44:23benjamin.petersonsetstatus: open -> closed

messages: + msg181278
2013-02-03 16:43:11eric.araujosetresolution: fixed
messages: + msg181277
stage: patch review -> resolved
2013-02-03 16:41:27python-devsetmessages: + msg181276
2013-02-03 16:30:47eric.araujosetpriority: normal -> release blocker

messages: + msg181275
2013-02-03 06:47:41benjamin.petersonsetmessages: + msg181245
2013-02-03 04:07:16eric.araujosetmessages: + msg181240
2013-02-02 16:28:59benjamin.petersonsetpriority: release blocker -> normal

messages: + msg181176
2013-01-28 16:31:25eric.araujosetmessages: + msg180861
2013-01-28 14:46:56benjamin.petersonsetmessages: + msg180858
2012-04-20 15:32:19eric.araujosetassignee: ned.deily -> eric.araujo
messages: + msg158842
2012-04-20 12:47:33lemburgsetmessages: + msg158826
2012-04-20 11:55:18ned.deilysetpriority: normal -> release blocker
files: + issue13994_compat.patch
messages: + msg158820

stage: resolved -> patch review
2012-04-20 09:12:28lemburgsetmessages: + msg158807
2012-04-20 08:45:14lemburgsetmessages: + msg158806
2012-04-20 08:42:06lemburgsetresolution: fixed -> (no value)
2012-04-20 08:38:13lemburgsetstatus: pending -> open

messages: + msg158805
2012-04-20 06:34:17Arfreversetstatus: open -> pending
2012-04-20 06:31:39Arfreversetstatus: pending -> open
nosy: + Arfrever
2012-04-19 23:27:45ned.deilysetstatus: open -> pending
resolution: fixed
messages: + msg158774

stage: resolved
2012-04-19 22:34:35ned.deilysetmessages: + msg158770
2012-04-19 22:32:32lemburgsetmessages: + msg158769
2012-04-19 22:24:24lemburgsetmessages: + msg158768
2012-04-19 22:24:01eric.araujosetmessages: + msg158767
stage: resolved -> (no value)
2012-04-19 22:18:48lemburgsetstatus: closed -> open

nosy: + lemburg
messages: + msg158766

resolution: fixed -> (no value)
2012-02-12 03:03:01eric.araujosetmessages: + msg153149
2012-02-11 19:44:40ned.deilysetstatus: open -> closed
priority: release blocker -> normal
messages: + msg153134

assignee: tarek -> ned.deily
resolution: fixed
stage: commit review -> resolved
2012-02-11 19:42:37python-devsetnosy: + python-dev
messages: + msg153133
2012-02-11 16:45:55ned.deilysetfiles: + issue13994_27.patch
keywords: + patch
stage: needs patch -> commit review
2012-02-11 16:41:56ned.deilycreate