Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
12202ad3
Commit
12202ad3
authored
Jul 27, 2013
by
Victor Stinner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #15893: frozenmain.c now handles PyMem_Malloc() failure
parent
063e2bf1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
8 deletions
+19
-8
Modules/python.c
Modules/python.c
+10
-6
Python/frozenmain.c
Python/frozenmain.c
+9
-2
No files found.
Modules/python.c
View file @
12202ad3
...
...
@@ -18,11 +18,19 @@ wmain(int argc, wchar_t **argv)
int
main
(
int
argc
,
char
**
argv
)
{
wchar_t
**
argv_copy
=
(
wchar_t
**
)
PyMem_Malloc
(
sizeof
(
wchar_t
*
)
*
(
argc
+
1
))
;
wchar_t
**
argv_copy
;
/* We need a second copy, as Python might modify the first one. */
wchar_t
**
argv_copy2
=
(
wchar_t
**
)
PyMem_Malloc
(
sizeof
(
wchar_t
*
)
*
(
argc
+
1
))
;
wchar_t
**
argv_copy2
;
int
i
,
res
;
char
*
oldloc
;
argv_copy
=
(
wchar_t
**
)
PyMem_Malloc
(
sizeof
(
wchar_t
*
)
*
(
argc
+
1
));
argv_copy2
=
(
wchar_t
**
)
PyMem_Malloc
(
sizeof
(
wchar_t
*
)
*
(
argc
+
1
));
if
(
!
argv_copy
||
!
argv_copy2
)
{
fprintf
(
stderr
,
"out of memory
\n
"
);
return
1
;
}
/* 754 requires that FP exceptions run in "no stop" mode by default,
* and until C vendors implement C99's ways to control FP exceptions,
* Python requires non-stop mode. Alas, some platforms enable FP
...
...
@@ -34,10 +42,6 @@ main(int argc, char **argv)
m
=
fpgetmask
();
fpsetmask
(
m
&
~
FP_X_OFL
);
#endif
if
(
!
argv_copy
||
!
argv_copy2
)
{
fprintf
(
stderr
,
"out of memory
\n
"
);
return
1
;
}
oldloc
=
strdup
(
setlocale
(
LC_ALL
,
NULL
));
setlocale
(
LC_ALL
,
""
);
for
(
i
=
0
;
i
<
argc
;
i
++
)
{
...
...
Python/frozenmain.c
View file @
12202ad3
...
...
@@ -20,9 +20,16 @@ Py_FrozenMain(int argc, char **argv)
int
inspect
=
0
;
int
unbuffered
=
0
;
char
*
oldloc
;
wchar_t
**
argv_copy
=
PyMem_Malloc
(
sizeof
(
wchar_t
*
)
*
argc
)
;
wchar_t
**
argv_copy
;
/* We need a second copies, as Python might modify the first one. */
wchar_t
**
argv_copy2
=
PyMem_Malloc
(
sizeof
(
wchar_t
*
)
*
argc
);
wchar_t
**
argv_copy2
;
argv_copy
=
PyMem_Malloc
(
sizeof
(
wchar_t
*
)
*
argc
);
argv_copy2
=
PyMem_Malloc
(
sizeof
(
wchar_t
*
)
*
argc
);
if
(
!
argv_copy
||
!
argv_copy2
)
{
fprintf
(
stderr
,
"out of memory
\n
"
);
return
1
;
}
Py_FrozenFlag
=
1
;
/* Suppress errors from getpath.c */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment