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
b0991a74
Commit
b0991a74
authored
Jan 19, 2016
by
Marius Wachtler
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1056 from undingen/file_fixes
add support for avro
parents
66cbe50c
c178fbe0
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
31 additions
and
2 deletions
+31
-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/extra/avro_test.py
test/extra/avro_test.py
+24
-0
test/tests/file.py
test/tests/file.py
+1
-0
No files found.
from_cpython/Lib/test/test_file.py
View file @
b0991a74
# 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 @
b0991a74
...
...
@@ -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 @
b0991a74
...
...
@@ -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 @
b0991a74
...
...
@@ -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/extra/avro_test.py
0 → 100644
View file @
b0991a74
import
os
,
sys
,
subprocess
sys
.
path
.
append
(
os
.
path
.
dirname
(
__file__
)
+
"/../lib"
)
from
test_helper
import
create_virtenv
,
run_test
ENV_NAME
=
"avro_test_env_"
+
os
.
path
.
basename
(
sys
.
executable
)
PYTHON_EXE
=
os
.
path
.
abspath
(
os
.
path
.
join
(
ENV_NAME
,
"bin"
,
"python"
))
NOSETESTS_EXE
=
os
.
path
.
abspath
(
os
.
path
.
join
(
ENV_NAME
,
"bin"
,
"nosetests"
))
AVRO_DIR
=
os
.
path
.
abspath
(
os
.
path
.
join
(
ENV_NAME
,
"avro-1.7.7"
))
packages
=
[
"nose==1.3.7"
,
"avro==1.7.7"
]
create_virtenv
(
ENV_NAME
,
packages
,
force_create
=
True
)
url
=
"https://pypi.python.org/packages/source/a/avro/avro-1.7.7.tar.gz"
subprocess
.
check_call
([
"wget"
,
url
],
cwd
=
ENV_NAME
)
subprocess
.
check_call
([
"tar"
,
"-zxf"
,
"avro-1.7.7.tar.gz"
],
cwd
=
ENV_NAME
)
env
=
os
.
environ
env
[
"PYTHONPATH"
]
=
os
.
path
.
abspath
(
os
.
path
.
join
(
ENV_NAME
,
"site-packages"
))
# this tests also fail when run in cpython with nose.
# pytest makes two of this work but we can't currently run pytest...
expected
=
[{
'ran'
:
51
,
'errors'
:
3
}]
run_test
([
NOSETESTS_EXE
],
env
=
env
,
cwd
=
AVRO_DIR
,
expected
=
expected
)
test/tests/file.py
View file @
b0991a74
...
...
@@ -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