[New-bugs-announce] [issue12034] check_GetFinalPathNameByHandle() suboptimal

Antoine Pitrou report at bugs.python.org
Sun May 8 22:00:06 CEST 2011

New submission from Antoine Pitrou <pitrou at free.fr>:

The code for check_GetFinalPathNameByHandle() goes like this:

static int has_GetFinalPathNameByHandle = 0;

static int
    HINSTANCE hKernel32;
    /* only recheck */
    if (!has_GetFinalPathNameByHandle)
        has_GetFinalPathNameByHandle = Py_GetFinalPathNameByHandleA &&
    return has_GetFinalPathNameByHandle;

It means that if the computed value is 0 (system doesn't have GetFinalPathNameByHandle*), the value will be re-computed each time the function is called.  has_GetFinalPathNameByHandle should probably be tri-state instead (0, 1, unknown).

components: Extension Modules
keywords: easy
messages: 135540
nosy: brian.curtin, pitrou
priority: low
severity: normal
status: open
title: check_GetFinalPathNameByHandle() suboptimal
type: performance
versions: Python 3.2, Python 3.3

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list