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

-S hides standard dynamic modules #36928

Closed
freddrake opened this issue Jul 25, 2002 · 7 comments
Closed

-S hides standard dynamic modules #36928

freddrake opened this issue Jul 25, 2002 · 7 comments
Labels
interpreter-core (Objects, Python, Grammar, and Parser dirs)

Comments

@freddrake
Copy link
Member

BPO 586680
Nosy @freddrake, @brettcannon, @pitrou, @vstinner, @benjaminp
Superseder
  • bpo-9589: test_heapq: AttributeError: 'int' object has no attribute 'pop'
  • 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 = None
    closed_at = <Date 2010-08-14.09:52:10.170>
    created_at = <Date 2002-07-25.19:59:26.000>
    labels = ['interpreter-core']
    title = '-S hides standard dynamic modules'
    updated_at = <Date 2010-08-14.09:52:10.170>
    user = 'https://github.com/freddrake'

    bugs.python.org fields:

    activity = <Date 2010-08-14.09:52:10.170>
    actor = 'vstinner'
    assignee = 'none'
    closed = True
    closed_date = None
    closer = None
    components = ['Interpreter Core']
    creation = <Date 2002-07-25.19:59:26.000>
    creator = 'fdrake'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 586680
    keywords = []
    message_count = 7.0
    messages = ['11694', '11695', '73063', '73411', '73414', '113881', '113883']
    nosy_count = 5.0
    nosy_names = ['fdrake', 'brett.cannon', 'pitrou', 'vstinner', 'benjamin.peterson']
    pr_nums = []
    priority = 'normal'
    resolution = 'duplicate'
    stage = None
    status = 'closed'
    superseder = '9589'
    type = None
    url = 'https://bugs.python.org/issue586680'
    versions = []

    @freddrake
    Copy link
    Member Author

    This only applies when os.name == 'posix'.

    Running an un-installed build of Python with the -S
    option causes the directory containing the standard
    dynamically-built modules not to be placed on sys.path.

    The build/lib.<platform>-<version>/ directory
    containing those modules is added to sys.path by
    site.py rather than getpath.c, even though those
    modules are needed. This includes many modules on most
    Unix systems:

    array dbm math regex termios
    audioop dl md5 resource _testcapi
    binascii errno mmap rgbimg time
    bsddb fcntl mpz rotor timing
    cmath fpectl nis select _tkinter
    _codecs gdbm operator sha
    unicodedata
    cPickle grp parser _socket _weakref
    crypt _hotshot pcre _ssl
    xreadlines
    cStringIO _hotshot pwd strop zlib
    _curses_panel linuxaudiodev pyexpat struct
    _curses _locale readline syslog

    Perhaps the best way to fix this is to add the
    equivalent code to getpath.c. The relevant stanza in
    site.py is headed by a comment saying "especially for
    Guido".

    @freddrake freddrake added interpreter-core (Objects, Python, Grammar, and Parser dirs) labels Jul 25, 2002
    @brettcannon
    Copy link
    Member

    We have lived this long without changing this that I don't think this needs fixing. Requiring the use of site.py when running from a build from a repository checkout seems totally reasonable to me.

    @benjaminp
    Copy link
    Contributor

    Note that this does cause incompatibility between development copies and
    installed copies:

    $ python -S -c "import itertools; print itertools"
    <module 'itertools' from ...>
    $ ./python -S -c "import itertools; print itertools"
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
    ImportError: No module named itertools

    @brettcannon
    Copy link
    Member

    If we think once can reliably add the directory based purely on whether
    it starts with "build/lib.", and then potentially check for a suffix of
    "-pydebug" if we are in a debug build, I will support adding this to
    getpath.c to ditch the distutils import used by site.py.

    @brettcannon
    Copy link
    Member

    On Thu, Sep 18, 2008 at 6:58 PM, Brett Cannon <report@bugs.python.org> wrote:

    Brett Cannon <brett@python.org> added the comment:

    If we think once can reliably add the directory based purely on whether
    it starts with "build/lib.", and then potentially check for a suffix of
    "-pydebug" if we are in a debug build,

    ... and if there is more than one match in the build directory, either
    error out or choose one of the directories somehow. I guess the real
    question is how often to people actually have multiple versions of
    their built libraries in build/.

    @vstinner
    Copy link
    Member

    r83988 does really fix this issue in python 3.2, 8 years later, yeah!

    @vstinner
    Copy link
    Member

    Ooops, I didn't notice that Antoine did already updated this issue. Restore the resolution as duplicate since the superseder field is set.

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 9, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    interpreter-core (Objects, Python, Grammar, and Parser dirs)
    Projects
    None yet
    Development

    No branches or pull requests

    4 participants