10000 gh-126782: Support qualified referencing for `ntpath.abspath()` by nineteendo · Pull Request #126784 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content
Open
wants to merge 19 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix undeclared variable
  • Loading branch information
nineteendo committed Nov 13, 2024
commit b7743100c0ec61b811edb49e3ecaf140052f798f
32 changes: 15 additions & 17 deletions Python/fileutils.c
Original file line number Diff line number Diff line change
Expand Up @@ -2510,6 +2510,8 @@ _Py_normpath_and_size(wchar_t *path, Py_ssize_t size, Py_ssize_t *normsize,
#endif
#define SEP_OR_END(x) (IS_SEP(x) || IS_END(x))

Py_ssize_t drvsize, rootsize;
_Py_skiproot(path, size, &drvsize, &rootsize);
if (p1[0] == L'.' && IS_SEP(&p1[1])) {
// Skip leading '.\'
path = &path[2];
Expand All @@ -2520,29 +2522,25 @@ _Py_normpath_and_size(wchar_t *path, Py_ssize_t size, Py_ssize_t *normsize,
lastC = SEP;
explicit = 1;
}
else {
Py_ssize_t drvsize, rootsize;
_Py_skiproot(path, size, &drvsize, &rootsize);
if (drvsize || rootsize) {
// Skip past root and update minP2
p1 = &path[drvsize + rootsize];
else if (drvsize || rootsize) {
// Skip past root and update minP2
p1 = &path[drvsize + rootsize];
#ifndef ALTSEP
p2 = p1;
p2 = p1;
#else
for (; p2 < p1; ++p2) {
if (*p2 == ALTSEP) {
*p2 = SEP;
}
for (; p2 < p1; ++p2) {
if (*p2 == ALTSEP) {
*p2 = SEP;
}
}
#endif
minP2 = p2 - 1;
lastC = *minP2;
minP2 = p2 - 1;
lastC = *minP2;
#ifdef MS_WINDOWS
if (lastC != SEP) {
minP2++;
}
#endif
if (lastC != SEP) {
minP2++;
}
#endif
}

/* if pEnd is specified, check that. Else, check for null terminator */
Expand Down
Loading
0