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
6ca5522e
Commit
6ca5522e
authored
Sep 05, 2016
by
Marius Wachtler
Committed by
GitHub
Sep 05, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1355 from undingen/_heapq
fix a bug where compare could ignore CAPI exceptions and add _heapq
parents
dc8e8251
e4e23719
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
40 additions
and
34 deletions
+40
-34
from_cpython/CMakeLists.txt
from_cpython/CMakeLists.txt
+1
-0
from_cpython/Lib/test/test_heapq.py
from_cpython/Lib/test/test_heapq.py
+0
-1
from_cpython/Modules/_heapqmodule.c
from_cpython/Modules/_heapqmodule.c
+3
-1
src/runtime/objmodel.cpp
src/runtime/objmodel.cpp
+3
-0
src/runtime/types.cpp
src/runtime/types.cpp
+33
-31
test/CPYTHON_TEST_NOTES.md
test/CPYTHON_TEST_NOTES.md
+0
-1
No files found.
from_cpython/CMakeLists.txt
View file @
6ca5522e
...
...
@@ -39,6 +39,7 @@ file(GLOB_RECURSE STDMODULE_SRCS Modules
_collectionsmodule.c
_csv.c
_functoolsmodule.c
_heapqmodule.c
_iomodule.c
_math.c
_randommodule.c
...
...
from_cpython/Lib/test/test_heapq.py
View file @
6ca5522e
# expected: fail
"""Unittests for heapq."""
import
sys
...
...
from_cpython/Modules/_heapqmodule.c
View file @
6ca5522e
...
...
@@ -23,6 +23,8 @@ cmp_lt(PyObject *x, PyObject *y)
lt
=
PyString_FromString
(
"__lt__"
);
if
(
lt
==
NULL
)
return
-
1
;
// Pyston change:
PyGC_RegisterStaticConstant
(
lt
);
}
if
(
PyObject_HasAttr
(
x
,
lt
))
return
PyObject_RichCompareBool
(
x
,
y
,
Py_LT
);
...
...
@@ -621,7 +623,7 @@ maintains the heap invariant!\n");
PyDoc_STRVAR
(
__about__
,
"Heap queues
\n
\
\n
\
[explanation by Franois Pinard]
\n
\
[explanation by Fran
ç
ois Pinard]
\n
\
\n
\
Heaps are arrays for which a[k] <= a[2*k+1] and a[k] <= a[2*k+2] for
\n
\
all k, counting elements from 0. For the sake of comparison,
\n
\
...
...
src/runtime/objmodel.cpp
View file @
6ca5522e
...
...
@@ -5913,12 +5913,15 @@ Box* compareInternal(Box* lhs, Box* rhs, int op_type, CompareRewriteArgs* rewrit
assert
(
!
lhs
->
cls
->
is_user_defined
);
Box
*
r
=
lhs
->
cls
->
tp_richcompare
(
lhs
,
rhs
,
cpython_op_type
);
if
(
!
r
)
throwCAPIException
();
RELEASE_ASSERT
(
r
!=
NotImplemented
,
"%s returned notimplemented?"
,
lhs
->
cls
->
tp_name
);
if
(
rewrite_args
)
{
rewrite_args
->
out_rtn
=
rewrite_args
->
rewriter
->
call
(
true
,
(
void
*
)
lhs
->
cls
->
tp_richcompare
,
rewrite_args
->
lhs
,
rewrite_args
->
rhs
,
rewrite_args
->
rewriter
->
loadConst
(
cpython_op_type
))
->
setType
(
RefType
::
OWNED
);
rewrite_args
->
rewriter
->
checkAndThrowCAPIException
(
rewrite_args
->
out_rtn
);
rewrite_args
->
out_success
=
true
;
}
return
r
;
...
...
src/runtime/types.cpp
View file @
6ca5522e
...
...
@@ -51,49 +51,50 @@
#include "runtime/super.h"
#include "runtime/util.h"
extern
"C"
void
initarray
();
extern
"C"
void
init_ast
();
extern
"C"
void
initbinascii
();
extern
"C"
void
init_bisect
();
extern
"C"
void
init_codecs
();
extern
"C"
void
init_collections
();
extern
"C"
void
initcStringIO
();
extern
"C"
void
init_csv
();
extern
"C"
void
initdatetime
();
extern
"C"
void
initerrno
();
extern
"C"
void
init_sha
();
extern
"C"
void
init_sha256
();
extern
"C"
void
init_sha512
();
extern
"C"
void
init_md5
();
extern
"C"
void
init_random
();
extern
"C"
void
init_sre
();
extern
"C"
void
initfcntl
();
extern
"C"
void
init_functools
();
extern
"C"
void
initgc
();
extern
"C"
void
init_heapq
();
extern
"C"
void
initimp
();
extern
"C"
void
init_io
();
extern
"C"
void
inititertools
();
extern
"C"
void
initmath
();
extern
"C"
void
init_md5
();
extern
"C"
void
initoperator
();
extern
"C"
void
initbinascii
();
extern
"C"
void
initpwd
();
extern
"C"
void
initposix
();
extern
"C"
void
init_struct
();
extern
"C"
void
initdatetime
();
extern
"C"
void
init_functools
();
extern
"C"
void
init_collections
();
extern
"C"
void
inititertools
();
extern
"C"
void
initpwd
();
extern
"C"
void
init_random
();
extern
"C"
void
initresource
();
extern
"C"
void
initsignal
();
extern
"C"
void
initselect
();
extern
"C"
void
initfcntl
();
extern
"C"
void
inittime
();
extern
"C"
void
initarray
();
extern
"C"
void
initzlib
();
extern
"C"
void
init_codecs
();
extern
"C"
void
init_sha
();
extern
"C"
void
init_sha256
();
extern
"C"
void
init_sha512
();
extern
"C"
void
initsignal
();
extern
"C"
void
init_socket
();
extern
"C"
void
_PyUnicode_Init
();
extern
"C"
void
_PyWarnings_Init
()
noexcept
;
extern
"C"
void
_string_init
();
extern
"C"
void
init_sqlite3
();
extern
"C"
void
init_sre
();
extern
"C"
void
init_ssl
();
extern
"C"
void
initstrop
();
extern
"C"
void
init_struct
();
extern
"C"
void
inittime
();
extern
"C"
void
initunicodedata
();
extern
"C"
void
init_weakref
();
extern
"C"
void
initcStringIO
();
extern
"C"
void
init_io
();
extern
"C"
void
initzipimport
();
extern
"C"
void
init_csv
();
extern
"C"
void
init_ssl
();
extern
"C"
void
init_sqlite3
();
extern
"C"
void
initzlib
();
extern
"C"
void
PyMarshal_Init
();
extern
"C"
void
initstrop
();
extern
"C"
void
initgc
();
extern
"C"
void
init_ast
();
extern
"C"
void
initimp
();
extern
"C"
void
_PyUnicode_Init
();
extern
"C"
void
_PyWarnings_Init
()
noexcept
;
extern
"C"
void
_string_init
();
namespace
pyston
{
...
...
@@ -4101,6 +4102,7 @@ struct _inittab _PyImport_Inittab[] = { { "array", initarray },
{
"errno"
,
initerrno
},
{
"fcntl"
,
initfcntl
},
{
"_functools"
,
init_functools
},
{
"_heapq"
,
init_heapq
},
{
"imp"
,
initimp
},
{
"_io"
,
init_io
},
{
"itertools"
,
inititertools
},
...
...
test/CPYTHON_TEST_NOTES.md
View file @
6ca5522e
...
...
@@ -92,7 +92,6 @@ test_getargs2 [unknown]
test_global SyntaxWarnings for global statements after uses
test_gl [unknown]
test_grammar bug in our tokenizer
test_heapq [unknown]
test_hotshot [unknown]
test_idle [unknown]
test_imageop [unknown]
...
...
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