mirror of
https://github.com/python/cpython
synced 2026-09-29 12:10:30 +03:00
gh-94772: Fix off-by-one error in Windows launcher (GH-94779)
This commit is contained in:
parent
bbb2ab70b6
commit
407ff6556c
3 changed files with 28 additions and 1 deletions
|
|
@ -874,7 +874,9 @@ checkShebang(SearchInfo *search)
|
|||
while (--bytesRead > 0 && *++b != '\r' && *b != '\n') { }
|
||||
wchar_t *shebang;
|
||||
int shebangLength;
|
||||
int exitCode = _decodeShebang(search, start, (int)(b - start + 1), onlyUtf8, &shebang, &shebangLength);
|
||||
// We add 1 when bytesRead==0, as in that case we hit EOF and b points
|
||||
// to the last character in the file, not the newline
|
||||
int exitCode = _decodeShebang(search, start, (int)(b - start + (bytesRead == 0)), onlyUtf8, &shebang, &shebangLength);
|
||||
if (exitCode) {
|
||||
return exitCode;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue