equal
deleted
inserted
replaced
50 const char *cpath = PyBytes_AS_STRING(path); |
50 const char *cpath = PyBytes_AS_STRING(path); |
51 Py_ssize_t pos = PyBytes_GET_SIZE(path); |
51 Py_ssize_t pos = PyBytes_GET_SIZE(path); |
52 PyObject *key = NULL; |
52 PyObject *key = NULL; |
53 int ret = -1; |
53 int ret = -1; |
54 |
54 |
|
55 /* This loop is super critical for performance. That's why we inline |
|
56 * access to Python structs instead of going through a supported API. |
|
57 * The implementation, therefore, is heavily dependent on CPython |
|
58 * implementation details. We also commit violations of the Python |
|
59 * "protocol" such as mutating immutable objects. But since we only |
|
60 * mutate objects created in this function or in other well-defined |
|
61 * locations, the references are known so these violations should go |
|
62 * unnoticed. */ |
55 while ((pos = _finddir(cpath, pos - 1)) != -1) { |
63 while ((pos = _finddir(cpath, pos - 1)) != -1) { |
56 PyObject *val; |
64 PyObject *val; |
57 |
65 |
58 /* It's likely that every prefix already has an entry |
66 /* It's likely that every prefix already has an entry |
59 in our dict. Try to avoid allocating and |
67 in our dict. Try to avoid allocating and |