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

os.listdir fails on debug build (windows) #49156

Closed
ocean-city mannequin opened this issue Jan 10, 2009 · 3 comments
Closed

os.listdir fails on debug build (windows) #49156

ocean-city mannequin opened this issue Jan 10, 2009 · 3 comments
Labels
interpreter-core (Objects, Python, Grammar, and Parser dirs)

Comments

@ocean-city
Copy link
Mannequin

ocean-city mannequin commented Jan 10, 2009

BPO 4906
Nosy @kristjanvalur
Files
  • fix_thread_nt.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 = None
    closed_at = <Date 2009-01-10.12:14:50.269>
    created_at = <Date 2009-01-10.11:11:49.964>
    labels = ['interpreter-core']
    title = 'os.listdir fails on debug build (windows)'
    updated_at = <Date 2009-01-10.12:14:50.268>
    user = 'https://bugs.python.org/ocean-city'

    bugs.python.org fields:

    activity = <Date 2009-01-10.12:14:50.268>
    actor = 'kristjan.jonsson'
    assignee = 'none'
    closed = True
    closed_date = <Date 2009-01-10.12:14:50.269>
    closer = 'kristjan.jonsson'
    components = ['Interpreter Core']
    creation = <Date 2009-01-10.11:11:49.964>
    creator = 'ocean-city'
    dependencies = []
    files = ['12672']
    hgrepos = []
    issue_num = 4906
    keywords = ['patch', 'needs review']
    message_count = 3.0
    messages = ['79538', '79540', '79543']
    nosy_count = 2.0
    nosy_names = ['kristjan.jonsson', 'ocean-city']
    pr_nums = []
    priority = 'critical'
    resolution = 'fixed'
    stage = None
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue4906'
    versions = ['Python 2.7']

    @ocean-city
    Copy link
    Mannequin Author

    ocean-city mannequin commented Jan 10, 2009

    Due to r68455, os.listdir fails on debug build (windows).

    //////////////////////////////////

    Python 2.7a0 (trunk, Jan 10 2009, 18:36:15) [MSC v.1200 32 bit (Intel)]
    on win32

    Type "help", "copyright", "credits" or "license" for more information.
    >>> import os
    [33639 refs]
    >>> os.listdir(".")
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    WindowsError: [Error 0] この操作を正しく終了しました。: './*.*'
    [33678 refs]

    //////////////////////////////////

    Probably a following XP Buildbot error comes from same reason.

    http://www.python.org/dev/buildbot/trunk.stable/x86%20XP-4%
    20trunk/builds/1759/step-compile/0

    This error is raised near Modules/posixmodule.c (2205)

    	Py_BEGIN_ALLOW_THREADS
    	result = FindNextFile(hFindFile, &FileData);
    	Py_END_ALLOW_THREADS
    	/* FindNextFile sets error to ERROR_NO_MORE_FILES if
    	   it got to the end of the directory. */
    	if (!result && GetLastError() != ERROR_NO_MORE_FILES) {

    GetLastError() is sometimes 0 when should be ERROR_NO_MORE_FILES.
    This happens because, on debug build, Py_END_ALLOW_THREADS finally
    reaches PyThread_get_key_value in Python/thread_nt.h, and TlsGetValue
    in it calls SetValueError(0) when function succeeds. See
    http://msdn.microsoft.com/en-us/library/ms686812.aspx

    I've attached the patch to fix this. I believe LastError set by
    TlsGetValue on its failure is not used anywhere.

    @ocean-city ocean-city mannequin added the interpreter-core (Objects, Python, Grammar, and Parser dirs) label Jan 10, 2009
    @kristjanvalur
    Copy link
    Mannequin

    kristjanvalur mannequin commented Jan 10, 2009

    I see, so it was I that caused this :)
    I will owe up to it and submit a fix.

    @kristjanvalur
    Copy link
    Mannequin

    kristjanvalur mannequin commented Jan 10, 2009

    Checked in:
    Completed: At revision: 68476

    @kristjanvalur kristjanvalur mannequin closed this as completed Jan 10, 2009
    @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
    interpreter-core (Objects, Python, Grammar, and Parser dirs)
    Projects
    None yet
    Development

    No branches or pull requests

    0 participants