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
bbb19558
Commit
bbb19558
authored
May 11, 2015
by
Marius Wachtler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add round(int), property.__doc__, code.co_firstlineno return -1 if not set
parent
43c13953
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
12 additions
and
8 deletions
+12
-8
from_cpython/Include/pyconfig.h
from_cpython/Include/pyconfig.h
+1
-0
src/runtime/builtin_modules/builtins.cpp
src/runtime/builtin_modules/builtins.cpp
+2
-4
src/runtime/code.cpp
src/runtime/code.cpp
+3
-0
src/runtime/descr.cpp
src/runtime/descr.cpp
+1
-1
src/runtime/objmodel.cpp
src/runtime/objmodel.cpp
+2
-1
test/tests/builtins.py
test/tests/builtins.py
+1
-1
test/tests/property.py
test/tests/property.py
+2
-1
No files found.
from_cpython/Include/pyconfig.h
View file @
bbb19558
...
...
@@ -129,6 +129,7 @@
#define HAVE_UNISTD_H 1
#define HAVE_UTIME_H 1
#define HAVE_WCHAR_H 1
#define HAVE_WORKING_TZSET 1
#define HAVE_PUTENV 1
// Added this for some Pyston modifications:
...
...
src/runtime/builtin_modules/builtins.cpp
View file @
bbb19558
...
...
@@ -1017,12 +1017,10 @@ Box* input(Box* prompt) {
}
Box
*
builtinRound
(
Box
*
_number
,
Box
*
_ndigits
)
{
if
(
!
isSubclass
(
_number
->
cls
,
float_cls
))
double
x
=
PyFloat_AsDouble
(
_number
);
if
(
PyErr_Occurred
())
raiseExcHelper
(
TypeError
,
"a float is required"
);
BoxedFloat
*
number
=
(
BoxedFloat
*
)
_number
;
double
x
=
number
->
d
;
/* interpret 2nd argument as a Py_ssize_t; clip on overflow */
Py_ssize_t
ndigits
=
PyNumber_AsSsize_t
(
_ndigits
,
NULL
);
if
(
ndigits
==
-
1
&&
PyErr_Occurred
())
...
...
src/runtime/code.cpp
View file @
bbb19558
...
...
@@ -62,6 +62,9 @@ public:
return
boxInt
(
-
1
);
}
if
(
cl
->
source
->
ast
->
lineno
==
(
uint32_t
)
-
1
)
return
boxInt
(
-
1
);
return
boxInt
(
cl
->
source
->
ast
->
lineno
);
}
...
...
src/runtime/descr.cpp
View file @
bbb19558
...
...
@@ -188,7 +188,7 @@ void setupDescr() {
new
BoxedMemberDescriptor
(
BoxedMemberDescriptor
::
OBJECT
,
offsetof
(
BoxedProperty
,
prop_set
)));
property_cls
->
giveAttr
(
"fdel"
,
new
BoxedMemberDescriptor
(
BoxedMemberDescriptor
::
OBJECT
,
offsetof
(
BoxedProperty
,
prop_del
)));
property_cls
->
giveAttr
(
"
fdoc
"
,
property_cls
->
giveAttr
(
"
__doc__
"
,
new
BoxedMemberDescriptor
(
BoxedMemberDescriptor
::
OBJECT
,
offsetof
(
BoxedProperty
,
prop_doc
)));
property_cls
->
freeze
();
...
...
src/runtime/objmodel.cpp
View file @
bbb19558
...
...
@@ -2111,7 +2111,8 @@ extern "C" bool nonzero(Box* obj) {
ASSERT
(
isUserDefined
(
obj
->
cls
)
||
obj
->
cls
==
classobj_cls
||
obj
->
cls
==
type_cls
||
isSubclass
(
obj
->
cls
,
Exception
)
||
obj
->
cls
==
file_cls
||
obj
->
cls
==
traceback_cls
||
obj
->
cls
==
instancemethod_cls
||
obj
->
cls
==
module_cls
||
obj
->
cls
==
capifunc_cls
||
obj
->
cls
==
builtin_function_or_method_cls
||
obj
->
cls
==
method_cls
,
||
obj
->
cls
==
builtin_function_or_method_cls
||
obj
->
cls
==
method_cls
||
obj
->
cls
==
frame_cls
||
obj
->
cls
==
capi_getset_cls
||
obj
->
cls
==
pyston_getset_cls
,
"%s.__nonzero__"
,
getTypeName
(
obj
));
// TODO
// TODO should rewrite these?
...
...
test/tests/builtins.py
View file @
bbb19558
...
...
@@ -108,7 +108,7 @@ print callable(lambda: 1)
print
range
(
5L
,
7L
)
for
n
in
[
0
,
1
,
2
,
3
,
4
,
5
]:
print
round
(
-
1.1
,
n
),
round
(
-
1.9
,
n
),
round
(
0.5
,
n
),
round
(
-
0.5
,
n
),
round
(
-
0.123456789
,
n
)
print
round
(
-
1.1
,
n
),
round
(
-
1.9
,
n
),
round
(
0.5
,
n
),
round
(
-
0.5
,
n
),
round
(
-
0.123456789
,
n
)
,
round
(
1
,
n
)
print
list
(
iter
(
xrange
(
100
).
__iter__
().
next
,
20
))
...
...
test/tests/property.py
View file @
bbb19558
...
...
@@ -8,7 +8,7 @@ class C(object):
def
fset
(
self
,
val
):
print
'in fset, val ='
,
val
x
=
property
(
fget
,
fset
)
x
=
property
(
fget
,
fset
,
None
,
"Doc String"
)
c
=
C
()
print
c
.
x
...
...
@@ -16,6 +16,7 @@ print C.x.__get__(c, C)
print
type
(
C
.
x
.
__get__
(
None
,
C
))
c
.
x
=
7
print
c
.
x
print
C
.
x
.
__doc__
class
C2
(
object
):
@
property
...
...
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