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

"SO" config var not getting set #63754

Closed
msabramo mannequin opened this issue Nov 11, 2013 · 12 comments
Closed

"SO" config var not getting set #63754

msabramo mannequin opened this issue Nov 11, 2013 · 12 comments
Assignees
Labels
stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@msabramo
Copy link
Mannequin

msabramo mannequin commented Nov 11, 2013

BPO 19555
Nosy @warsaw, @doko42, @vstinner, @msabramo
Files
  • issue19555.txt
  • 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/warsaw'
    closed_at = <Date 2013-11-22.16:09:39.550>
    created_at = <Date 2013-11-11.17:29:57.624>
    labels = ['type-bug', 'library']
    title = '"SO" config var not getting set'
    updated_at = <Date 2014-03-09.22:50:24.773>
    user = 'https://github.com/msabramo'

    bugs.python.org fields:

    activity = <Date 2014-03-09.22:50:24.773>
    actor = 'python-dev'
    assignee = 'barry'
    closed = True
    closed_date = <Date 2013-11-22.16:09:39.550>
    closer = 'barry'
    components = ['Distutils']
    creation = <Date 2013-11-11.17:29:57.624>
    creator = 'Marc.Abramowitz'
    dependencies = []
    files = ['32577']
    hgrepos = []
    issue_num = 19555
    keywords = []
    message_count = 12.0
    messages = ['202634', '202637', '202638', '202639', '202648', '202649', '202650', '203701', '203735', '203793', '203865', '212996']
    nosy_count = 5.0
    nosy_names = ['barry', 'doko', 'vstinner', 'python-dev', 'Marc.Abramowitz']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = None
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue19555'
    versions = ['Python 3.4']

    @msabramo
    Copy link
    Mannequin Author

    msabramo mannequin commented Nov 11, 2013

    I just installed Python 3.0a4 from source on an Ubuntu system and noticed that it doesn't seem to set the distutils.sysconfig config var: "SO":

    vagrant@ubuntu:~/src/Python-3.4.0a4$ python3.4
    Python 3.4.0a4 (default, Nov 11 2013, 17:11:59)
    [GCC 4.6.3] on linux
    Type "help", "copyright", "credits" or "license" for more information.
    >>> from distutils import sysconfig
    >>> sysconfig.get_config_var("SO")
    >>> sysconfig.get_config_var("SO") is None
    True
    

    This worked fine for me in Python 3.3:

    vagrant@ubuntu:~/src/Python-3.4.0a4$ python3.3
    Python 3.3.2 (default, May 16 2013, 18:32:41)
    [GCC 4.6.3] on linux
    Type "help", "copyright", "credits" or "license" for more information.
    >>> from distutils import sysconfig
    >>> sysconfig.get_config_var("SO")
    '.so'
    

    @msabramo msabramo mannequin assigned merwok Nov 11, 2013
    @msabramo msabramo mannequin added stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error labels Nov 11, 2013
    @warsaw
    Copy link
    Member

    warsaw commented Nov 11, 2013

    Indeed, this happens for me too in default head.

    @warsaw
    Copy link
    Member

    warsaw commented Nov 11, 2013

    Never mind, this is an intentional change:

    • Issue bpo-16754: Fix the incorrect shared library extension on linux. Introduce
      two makefile macros SHLIB_SUFFIX and EXT_SUFFIX. SO now has the value of
      SHLIB_SUFFIX again (as in 2.x and 3.1). The SO macro is removed in 3.4.

    Although this does introduce some backward compatibility issues. Perhaps sysconfig.get_config_var('SO') should be deprecated in 3.4 and removed in 3.5.

    @msabramo
    Copy link
    Mannequin Author

    msabramo mannequin commented Nov 11, 2013

    Thanks Barry, for tracking down that this is intentional.

    I wonder how one gets this value in Python code now? For example, the reason I stumbled upon this in the first place is that there is some code in PyCrypto (https://github.com/dlitz/pycrypto/blob/master/lib/Crypto/SelfTest/PublicKey/test_RSA.py#L464) that uses get_config_var("SO") thusly:

        except ImportError:
            from distutils.sysconfig import get_config_var
            import inspect
            _fm_path = os.path.normpath(os.path.dirname(os.path.abspath(
                inspect.getfile(inspect.currentframe())))
                +"/../../PublicKey/_fastmath"+get_config_var("SO"))
            if os.path.exists(_fm_path):
                raise ImportError("While the _fastmath module exists, importing "+
                    "it failed. This may point to the gmp or mpir shared library "+
                    "not being in the path. _fastmath was found at "+_fm_path)
    

    What would be the way to express this now in Python >= 3.4?

    @warsaw
    Copy link
    Member

    warsaw commented Nov 11, 2013

    Here's a patch, sans NEWS and any docs.

    @warsaw warsaw changed the title "SO" config var not getting set SO configuration variable should be deprecated in 3.4 Nov 11, 2013
    @warsaw
    Copy link
    Member

    warsaw commented Nov 11, 2013

    Note that obviously the DeprecationWarning is not raised if you do

    sysconfig.get_config_vars()['SO']

    but it still gets mapped to EXT_SUFFIX in that case.

    @warsaw
    Copy link
    Member

    warsaw commented Nov 11, 2013

    On Nov 11, 2013, at 06:27 PM, Marc Abramowitz wrote:

    What would be the way to express this now in Python >= 3.4?

    For now, use sysconfig.get_config_var('EXT_SUFFIX') though if no one objects
    to my patch, I'll restore 'SO' for 3.4. We'll add a DeprecationWarning and
    get rid of it in 3.5.

    @warsaw warsaw changed the title SO configuration variable should be deprecated in 3.4 "SO" config var not getting set Nov 11, 2013
    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Nov 21, 2013

    New changeset fedc2b8fbb6e by Barry Warsaw in branch 'default':

    @warsaw warsaw closed this as completed Nov 22, 2013
    @vstinner
    Copy link
    Member

    Test is failing on Windows:

    http://buildbot.python.org/all/builders/x86%20Windows%20Server%202003%20%5BSB%5D%203.x/builds/1758/steps/test/logs/stdio

    ======================================================================
    ERROR: test_SO_in_vars (test.test_sysconfig.TestSysConfig)
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "E:\Data\buildslave\cpython\3.x.snakebite-win2k3r2sp2-x86\build\lib\test\test_sysconfig.py", line 388, in test_SO_in_vars
        self.assertIsNotNone(vars['SO'])
    KeyError: 'SO'

    ======================================================================
    FAIL: test_SO_value (test.test_sysconfig.TestSysConfig)
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "E:\Data\buildslave\cpython\3.x.snakebite-win2k3r2sp2-x86\build\lib\test\test_sysconfig.py", line 382, in test_SO_value
        sysconfig.get_config_var('EXT_SUFFIX'))
    AssertionError: None != '.pyd'

    @vstinner vstinner reopened this Nov 22, 2013
    @warsaw warsaw self-assigned this Nov 22, 2013
    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Nov 22, 2013

    New changeset 331b7a8bb830 by Barry Warsaw in branch 'default':
    A fix for bpo-19555 on Windows.
    http://hg.python.org/cpython/rev/331b7a8bb830

    @warsaw warsaw closed this as completed Nov 22, 2013
    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Nov 22, 2013

    New changeset 8a130fd92255 by Barry Warsaw in branch 'default':
    bpo-19555 for distutils, plus a little clean up (pyflakes, line lengths).
    http://hg.python.org/cpython/rev/8a130fd92255

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Mar 9, 2014

    New changeset ac2ee9fc353a by R David Murray in branch 'default':
    whatsnew: deprecation of sysconfig SO key (bpo-19555).
    http://hg.python.org/cpython/rev/ac2ee9fc353a

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    bryanwweber added a commit to bryanwweber/cpython that referenced this issue Apr 18, 2022
    Per @warsaw in python#63754, this was
    deprecated in Python 3.4 and was suggested for removal in Python 3.5.
    warsaw added a commit that referenced this issue Apr 18, 2022
    * Removes SO config variable in sysconfig
    
    Per @warsaw in #63754, this was
    deprecated in Python 3.4 and was suggested for removal in Python 3.5.
    
    * Add NEWS
    
    * Update Misc/NEWS.d/next/Library/2022-04-18-15-23-24.gh-issue-91670.6eyChw.rst
    
    Co-authored-by: Éric <merwok@netwok.org>
    
    Co-authored-by: Barry Warsaw <barry@python.org>
    Co-authored-by: Éric <merwok@netwok.org>
    sumslogs added a commit to sumslogs/ViennaRNA that referenced this issue Dec 12, 2022
    sysconfig.get_config_var('SO') isn't consistently set.
    
    Causes "cannot import name '_RNA' from partially initialized module
    'RNA'" as PYTHON3_SO becomes "None".
    
    See: python/cpython#63754
    sumslogs added a commit to sumslogs/ViennaRNA that referenced this issue Dec 12, 2022
    distutils.sysconfig.get_config_var('SO') was deprecated in python 3.4, and is unset in python 3.11.0.
    Causes PYTHON3_SO=None -> _RNA.so builds as "_RNANone" -> build failure:
    ```
    ImportError: cannot import name '_RNA' from partially initialized module 'RNA'
    ```
    See: python/cpython#60958, python/cpython#63754 and [deprecation notice here](https://github.com/python/cpython/blob/dd53b79de0ea98af6a11481217a961daef4e9774/Doc/whatsnew/3.4.rst#deprecations-in-the-python-api).
    
    Further, module [distutils](https://docs.python.org/3/library/distutils.html) is deprecated, and has planned removal in 3.12.
    Functions get_python_inc, get_python_lib are removed, see: python/cpython#92584.
    sumslogs added a commit to sumslogs/ViennaRNA that referenced this issue Dec 12, 2022
    distutils.sysconfig.get_config_var('SO') was deprecated in python 3.4, and is unset in python 3.11.0.
    
    Causes PYTHON3_SO=None -> _RNA.so builds as "_RNANone" -> build failure:
    ```
    ImportError: cannot import name '_RNA' from partially initialized module 'RNA'
    ```
    See: python/cpython#60958, python/cpython#63754 and [deprecation notice here](https://github.com/python/cpython/blob/dd53b79de0ea98af6a11481217a961daef4e9774/Doc/whatsnew/3.4.rst#deprecations-in-the-python-api).
    
    Also, module [distutils](https://docs.python.org/3/library/distutils.html) is deprecated and has planned removal in 3.12.
    Functions get_python_inc, get_python_lib are removed, see: python/cpython#92584.
    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 type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    3 participants