Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
Cpython
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
sip
Cpython
Commits
407ff655
Unverified
Commit
407ff655
authored
Jul 16, 2022
by
Paul Moore
Committed by
GitHub
Jul 16, 2022
Browse files
Options
Downloads
Patches
Plain Diff
gh-94772: Fix off-by-one error in Windows launcher (GH-94779)
parent
bbb2ab70
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
Lib/test/test_launcher.py
+24
-0
24 additions, 0 deletions
Lib/test/test_launcher.py
Misc/NEWS.d/next/Windows/2022-07-12-20-45-43.gh-issue-94772.uNMmdG.rst
+1
-0
1 addition, 0 deletions
...ext/Windows/2022-07-12-20-45-43.gh-issue-94772.uNMmdG.rst
PC/launcher2.c
+3
-1
3 additions, 1 deletion
PC/launcher2.c
with
28 additions
and
1 deletion
Lib/test/test_launcher.py
+
24
−
0
View file @
407ff655
...
...
@@ -515,6 +515,30 @@ def test_py3_shebang(self):
self
.
assertEqual
(
"
3.100-arm64
"
,
data
[
"
SearchInfo.tag
"
])
self
.
assertEqual
(
f
"
X.Y-arm64.exe -X fake_arg_for_test -prearg
{
script
}
-postarg
"
,
data
[
"
stdout
"
].
strip
())
def
test_py_shebang_nl
(
self
):
with
self
.
py_ini
(
TEST_PY_COMMANDS
):
with
self
.
script
(
"
#! /usr/bin/env python -prearg
\n
"
)
as
script
:
data
=
self
.
run_py
([
script
,
"
-postarg
"
])
self
.
assertEqual
(
"
PythonTestSuite
"
,
data
[
"
SearchInfo.company
"
])
self
.
assertEqual
(
"
3.100
"
,
data
[
"
SearchInfo.tag
"
])
self
.
assertEqual
(
f
"
X.Y.exe -prearg
{
script
}
-postarg
"
,
data
[
"
stdout
"
].
strip
())
def
test_py2_shebang_nl
(
self
):
with
self
.
py_ini
(
TEST_PY_COMMANDS
):
with
self
.
script
(
"
#! /usr/bin/env python2 -prearg
\n
"
)
as
script
:
data
=
self
.
run_py
([
script
,
"
-postarg
"
])
self
.
assertEqual
(
"
PythonTestSuite
"
,
data
[
"
SearchInfo.company
"
])
self
.
assertEqual
(
"
3.100-32
"
,
data
[
"
SearchInfo.tag
"
])
self
.
assertEqual
(
f
"
X.Y-32.exe -prearg
{
script
}
-postarg
"
,
data
[
"
stdout
"
].
strip
())
def
test_py3_shebang_nl
(
self
):
with
self
.
py_ini
(
TEST_PY_COMMANDS
):
with
self
.
script
(
"
#! /usr/bin/env python3 -prearg
\n
"
)
as
script
:
data
=
self
.
run_py
([
script
,
"
-postarg
"
])
self
.
assertEqual
(
"
PythonTestSuite
"
,
data
[
"
SearchInfo.company
"
])
self
.
assertEqual
(
"
3.100-arm64
"
,
data
[
"
SearchInfo.tag
"
])
self
.
assertEqual
(
f
"
X.Y-arm64.exe -X fake_arg_for_test -prearg
{
script
}
-postarg
"
,
data
[
"
stdout
"
].
strip
())
def
test_install
(
self
):
data
=
self
.
run_py
([
"
-V:3.10
"
],
env
=
{
"
PYLAUNCHER_ALWAYS_INSTALL
"
:
"
1
"
},
expect_returncode
=
111
)
cmd
=
data
[
"
stdout
"
].
strip
()
...
...
This diff is collapsed.
Click to expand it.
Misc/NEWS.d/next/Windows/2022-07-12-20-45-43.gh-issue-94772.uNMmdG.rst
0 → 100644
+
1
−
0
View file @
407ff655
Fix incorrect handling of shebang lines in py.exe launcher
This diff is collapsed.
Click to expand it.
PC/launcher2.c
+
3
−
1
View file @
407ff655
...
...
@@ -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
;
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment