Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
Pyston
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
Boxiang Sun
Pyston
Commits
13229158
Commit
13229158
authored
Mar 09, 2015
by
Marius Wachtler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
file: support close function pointer
parent
02c39c34
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
4 deletions
+3
-4
src/runtime/file.cpp
src/runtime/file.cpp
+3
-4
No files found.
src/runtime/file.cpp
View file @
13229158
...
@@ -824,8 +824,7 @@ extern "C" void PyFile_SetFP(PyObject* _f, FILE* fp) noexcept {
...
@@ -824,8 +824,7 @@ extern "C" void PyFile_SetFP(PyObject* _f, FILE* fp) noexcept {
}
}
extern
"C"
PyObject
*
PyFile_FromFile
(
FILE
*
fp
,
char
*
name
,
char
*
mode
,
int
(
*
close
)(
FILE
*
))
noexcept
{
extern
"C"
PyObject
*
PyFile_FromFile
(
FILE
*
fp
,
char
*
name
,
char
*
mode
,
int
(
*
close
)(
FILE
*
))
noexcept
{
RELEASE_ASSERT
(
close
==
fclose
,
"unsupported"
);
return
new
BoxedFile
(
fp
,
name
,
mode
,
close
);
return
new
BoxedFile
(
fp
,
name
,
mode
);
}
}
extern
"C"
FILE
*
PyFile_AsFile
(
PyObject
*
f
)
noexcept
{
extern
"C"
FILE
*
PyFile_AsFile
(
PyObject
*
f
)
noexcept
{
...
@@ -1082,8 +1081,8 @@ void fileDestructor(Box* b) {
...
@@ -1082,8 +1081,8 @@ void fileDestructor(Box* b) {
assert
(
isSubclass
(
b
->
cls
,
file_cls
));
assert
(
isSubclass
(
b
->
cls
,
file_cls
));
BoxedFile
*
self
=
static_cast
<
BoxedFile
*>
(
b
);
BoxedFile
*
self
=
static_cast
<
BoxedFile
*>
(
b
);
if
(
self
->
f_fp
)
if
(
self
->
f_fp
&&
self
->
f_close
)
f
close
(
self
->
f_fp
);
self
->
f_
close
(
self
->
f_fp
);
self
->
f_fp
=
NULL
;
self
->
f_fp
=
NULL
;
}
}
...
...
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