Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

distutils.sysconfig.customize_compiler will try to read variable that has not been initialized #66122

Closed
alex opened this issue Jul 5, 2014 · 5 comments
Assignees
Labels
stdlib Python modules in the Lib dir

Comments

@alex
Copy link
Member

alex commented Jul 5, 2014

BPO 21923
Nosy @ned-deily, @merwok, @alex, @dstufft
Files
  • sysconfig.diff
  • issue21923_3x.patch
  • issue21923_27.patch
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = 'https://github.com/ned-deily'
    closed_at = <Date 2014-07-07.04:30:15.047>
    created_at = <Date 2014-07-05.16:44:20.009>
    labels = ['library']
    title = 'distutils.sysconfig.customize_compiler will try to read variable that has not been initialized'
    updated_at = <Date 2014-07-07.04:30:15.046>
    user = 'https://github.com/alex'

    bugs.python.org fields:

    activity = <Date 2014-07-07.04:30:15.046>
    actor = 'ned.deily'
    assignee = 'ned.deily'
    closed = True
    closed_date = <Date 2014-07-07.04:30:15.047>
    closer = 'ned.deily'
    components = ['Distutils']
    creation = <Date 2014-07-05.16:44:20.009>
    creator = 'alex'
    dependencies = []
    files = ['35870', '35872', '35873']
    hgrepos = []
    issue_num = 21923
    keywords = ['patch']
    message_count = 5.0
    messages = ['222373', '222400', '222405', '222424', '222432']
    nosy_count = 5.0
    nosy_names = ['ned.deily', 'eric.araujo', 'alex', 'python-dev', 'dstufft']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue21923'
    versions = ['Python 2.7', 'Python 3.4', 'Python 3.5']

    @alex
    Copy link
    Member Author

    alex commented Jul 5, 2014

    If one invokes some distutils code too early, this function will try to read _config_vars before it is initialized. http://bpaste.net/show/1DOGhL8sdnkPyLTL06AZ/ is an example traceback that results.

    The attached patch uses the public API which guarantees that it is defined.

    @alex alex added the stdlib Python modules in the Lib dir label Jul 5, 2014
    @ned-deily ned-deily self-assigned this Jul 5, 2014
    @ned-deily
    Copy link
    Member

    Thanks for the patch, Alex, and sorry about the bug. The fix looks good. I've added a test that should be valid whether or not a compiler is available and, I hope, on Windows (I haven't tested it there).

    @alex
    Copy link
    Member Author

    alex commented Jul 6, 2014

    Test looks reasonable to me.

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Jul 6, 2014

    New changeset bdbfbb57e37e by Ned Deily in branch '2.7':
    Issue bpo-21923: Prevent AttributeError in distutils.sysconfig.customize_compiler
    http://hg.python.org/cpython/rev/bdbfbb57e37e

    New changeset 78fa18e95445 by Ned Deily in branch '3.4':
    Issue bpo-21923: Prevent AttributeError in distutils.sysconfig.customize_compiler
    http://hg.python.org/cpython/rev/78fa18e95445

    New changeset 12546bfa1f4f by Ned Deily in branch 'default':
    Issue bpo-21923: merge from 3.4
    http://hg.python.org/cpython/rev/12546bfa1f4f

    @ned-deily
    Copy link
    Member

    Committed for release in 2.7.9, 3.4.2, and 3.5.0.

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    stdlib Python modules in the Lib dir
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants