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: Allocating too much memory for pathes
Type: Stage:
Components: Windows Versions: Python 2.7
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: amaury.forgeotdarc, danimo, georg.brandl
Priority: normal Keywords:

Created on 2010-12-02 12:32 by danimo, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (3)
msg123067 - (view) Author: Daniel Molkentin (danimo) Date: 2010-12-02 12:32
from PC/getpathp.c:538


    if (pythonhome != NULL) {
        char *p;
        bufsz = 1;
        for (p = PYTHONPATH; *p; p++) {
            if (*p == DELIM)
                bufsz++; /* number of DELIM plus one */
        }
        bufsz *= strlen(pythonhome);
    }

The second last line should probably read

        bufsz += strlen(pythonhome);
msg123068 - (view) Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) Date: 2010-12-02 12:40
Hmm, not sure.
Try with 
   set PYTHONPATH=.\a;.\b
sys.path will contains the entries:
   <current_dir>\a
   <current_dir>\b
a multiplication seems necessary.
msg123085 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2010-12-02 17:35
Before the multiplication, "bufsz" is not aptly named: as your snippet shows it's counting the number of delimiters in the PYTHONPATH.
History
Date User Action Args
2022-04-11 14:57:09adminsetgithub: 54813
2010-12-02 17:35:40georg.brandlsetstatus: open -> closed

nosy: + georg.brandl
messages: + msg123085

resolution: not a bug
2010-12-02 12:40:50amaury.forgeotdarcsetnosy: + amaury.forgeotdarc
messages: + msg123068
2010-12-02 12:32:34danimocreate