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
85643b74
Commit
85643b74
authored
Jan 15, 2016
by
Marius Wachtler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
getiter(): don't ignore CAPI exception and add file.encoding
parent
66cbe50c
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
7 additions
and
2 deletions
+7
-2
from_cpython/Lib/test/test_file.py
from_cpython/Lib/test/test_file.py
+2
-1
src/runtime/file.cpp
src/runtime/file.cpp
+2
-0
src/runtime/objmodel.cpp
src/runtime/objmodel.cpp
+2
-0
test/CPYTHON_TEST_NOTES.md
test/CPYTHON_TEST_NOTES.md
+0
-1
test/tests/file.py
test/tests/file.py
+1
-0
No files found.
from_cpython/Lib/test/test_file.py
View file @
85643b74
# expected: fail
# NOTE: this file tests the new `io` library backported from Python 3.x.
# Similar tests for the builtin file object can be found in test_file2k.py.
...
...
@@ -27,6 +26,8 @@ class AutoFileTests(unittest.TestCase):
self
.
f
.
close
()
os
.
remove
(
TESTFN
)
# pyston change:
@
unittest
.
skip
(
"does not work with GC"
)
def
testWeakRefs
(
self
):
# verify weak references
p
=
proxy
(
self
.
f
)
...
...
src/runtime/file.cpp
View file @
85643b74
...
...
@@ -1882,6 +1882,8 @@ void setupFile() {
new
BoxedMemberDescriptor
(
BoxedMemberDescriptor
::
OBJECT
,
offsetof
(
BoxedFile
,
f_name
),
true
));
file_cls
->
giveAttr
(
"mode"
,
new
BoxedMemberDescriptor
(
BoxedMemberDescriptor
::
OBJECT
,
offsetof
(
BoxedFile
,
f_mode
),
true
));
file_cls
->
giveAttr
(
"encoding"
,
new
BoxedMemberDescriptor
(
BoxedMemberDescriptor
::
OBJECT
,
offsetof
(
BoxedFile
,
f_encoding
),
true
));
file_cls
->
giveAttr
(
"__new__"
,
new
BoxedFunction
(
FunctionMetadata
::
create
((
void
*
)
fileNew
,
UNKNOWN
,
4
,
false
,
false
),
{
boxString
(
"r"
),
boxInt
(
-
1
)
}));
...
...
src/runtime/objmodel.cpp
View file @
85643b74
...
...
@@ -5726,6 +5726,8 @@ Box* getiter(Box* o) {
Box
*
r
=
NULL
;
if
(
PyType_HasFeature
(
type
,
Py_TPFLAGS_HAVE_ITER
)
&&
type
->
tp_iter
!=
slot_tp_iter
&&
type
->
tp_iter
)
{
r
=
type
->
tp_iter
(
o
);
if
(
!
r
&&
PyErr_Occurred
())
throwCAPIException
();
}
else
{
r
=
type
->
callIterIC
(
o
);
}
...
...
test/CPYTHON_TEST_NOTES.md
View file @
85643b74
...
...
@@ -97,7 +97,6 @@ test_extcall f(**kw) crashes if kw isn't a dict
test_file2k we abort when you try to open() a directory
test_file_eintr not sure
test_fileio [unknown]
test_file wontfix: we don't destruct file objects when the test wants
test_fork1 [unknown]
test_frozen [unknown]
test_ftplib [unknown]
...
...
test/tests/file.py
View file @
85643b74
...
...
@@ -20,6 +20,7 @@ def chop(s):
for
desc
in
[
sys
.
stderr
,
sys
.
stdout
,
sys
.
stdin
]:
print
chop
(
str
(
desc
))
print
desc
.
encoding
f
=
open
(
"/dev/null"
,
'w'
)
print
chop
(
str
(
f
))
...
...
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