Daniel Watkins
eecddd417b
Distinguish between a mutable and non-mutable borrow of vm.current_frame
...
This renames the existing (mutable) VirtualMachine.current_frame to
current_frame_mut and introduces VirtualMachine.current_frame which is
(a) public, and (b) does not take a mutable reference.
(This also switches callers to use the non-mutable version where
possible.)
2018-08-25 19:35:48 -04:00
Windel Bouwman
6aa9c01180
Merge branch 'master' of https://github.com/RustPython/RustPython into exceptions
2018-08-25 10:18:51 +02:00
Windel Bouwman
882606ba1a
Move exceptions to own struct
2018-08-25 10:11:21 +02:00
Daniel Watkins
da34b86a9c
Implement PYTHONPATH
...
This modifies the import logic to use sys.path, and uses PYTHONPATH to
generate the initial contents of sys.path.
2018-08-24 22:55:30 -04:00
Windel Bouwman
f76472c00b
Add some base exceptions
2018-08-24 23:36:26 +02:00
Windel Bouwman
0f22c1a5c1
Implement exception type checking at catch
2018-08-24 22:42:20 +02:00
Adam Kelly
6d673dc56d
0 == 0.0 and 0.0 == 0
2018-08-24 18:48:34 +01:00
Adam Kelly
d60dfd2ad8
Test __bool__ and fix it.
2018-08-24 18:48:09 +01:00
Adam Kelly
046e5e9c60
Add unary not support to parser.
2018-08-24 18:23:05 +01:00
Adam Kelly
2b6cab4e97
Add JumpIfFalse instruction to avoid negation.
2018-08-24 18:23:05 +01:00
Adam Kelly
e9b9725860
JumpIf - evaluate truthyness of argument.
2018-08-24 18:23:05 +01:00
Adam Kelly
3ff5f16a43
Integer divison leads to floats.
2018-08-24 18:23:05 +01:00
Adam Kelly
cc1641fad8
Fully support __bool__.
2018-08-24 18:23:04 +01:00
Adam Kelly
3c5b887d20
Add bool and float types.
2018-08-24 15:32:54 +01:00
Adam Kelly
91a11e25c2
Replace str built-in with str.__new__
2018-08-24 15:13:06 +01:00
Adam Kelly
481186a097
Finish clean-up of type creation.
2018-08-24 15:13:06 +01:00
Adam Kelly
4b322fe5aa
Improve rest of attribute protocol interface.
2018-08-24 10:16:45 +01:00
Adam Kelly
4278a1ecc8
Move __dict__ to object.
2018-08-24 10:16:45 +01:00
Windel Bouwman
16ce7df578
Add isinstance method
2018-08-23 23:59:54 +02:00
Windel Bouwman
d4e735783e
Some formatting
2018-08-23 23:11:57 +02:00
Windel Bouwman
04b786f0f3
Add try except to compiler
2018-08-22 21:42:18 +02:00
Windel Bouwman
583818378b
Add BaseException class
2018-08-22 20:29:47 +02:00
Windel Bouwman
f595553371
Add location vector to code object
2018-08-22 18:35:32 +02:00
Windel Bouwman
c2550ad3f1
Introduce LocatedStatement after idea from review
2018-08-22 17:49:07 +02:00
Windel Bouwman
fb69804a30
Some formatting
2018-08-22 17:01:54 +02:00
Windel Bouwman
4897e10714
Add location to statement ast type
2018-08-22 16:18:47 +02:00
Daniel Watkins
a0efee1fc6
Merge pull request #69 from RustPython/floats
...
Add float type
2018-08-21 15:32:39 -04:00
Adam Kelly
99829d8903
Use has_attr rather than getattribute for looking up __init__
2018-08-21 08:17:36 +01:00
Windel Bouwman
17a952dbf1
fix #34
2018-08-20 22:06:01 +02:00
Windel Bouwman
20d73d7478
Some formatting
2018-08-20 21:48:58 +02:00
Windel Bouwman
823730f023
Fix cast test snippet
2018-08-20 21:37:21 +02:00
Windel Bouwman
15e274210f
Add float type
2018-08-20 21:22:14 +02:00
Adam Kelly
b3b8048cf7
Fix objtype tests.
2018-08-20 20:00:47 +01:00
Adam Kelly
8b0ba28a36
dict built-in and dict.__new__.
2018-08-20 19:54:19 +01:00
Adam Kelly
483256959a
Trinity of Type, Object and Dict all mutally referential.
2018-08-20 19:54:19 +01:00
Adam Kelly
1884948bb7
Cleanup object type.
2018-08-20 19:54:19 +01:00
Adam Kelly
9f2dac74dc
Create dictionary type
2018-08-20 19:54:19 +01:00
Adam Kelly
29133dd299
Rename objclass -> objobject.
2018-08-20 19:54:19 +01:00
Adam Kelly
61d7c26787
Simplify construction of list and type.
2018-08-20 19:54:19 +01:00
Adam Kelly
a9c3349943
Specify bases in normal class definitions.
2018-08-19 20:55:37 +01:00
Adam Kelly
f89b51407f
Compute linearised MRO.
2018-08-19 20:54:45 +01:00
Adam Kelly
110a7ca38c
Add __class__ and __dict__ to type_type.
2018-08-19 20:54:45 +01:00
Adam Kelly
25dc93915a
Add method descriptors and __mro__.
2018-08-19 20:54:45 +01:00
Adam Kelly
6bdf4148b5
Simplify new_list/new_tuple api.
2018-08-19 20:54:45 +01:00
Adam Kelly
ca7b792497
Get both forms of type to work properly.
...
Includes basic ability to traverse method resolution order (mro), but
not to derive mro or read parents from class definitions.
New and init called when creating types and instances.
__call__ works on types and instances.
Descriptors have have priority over instance variables.
2018-08-18 11:54:00 +01:00
Adam Kelly
19b4c704db
set_attr for classes.
2018-08-16 07:46:04 +01:00
Adam Kelly
79ec7990a8
builtin_build_class should call objtype::new
2018-08-16 07:44:00 +01:00
Adam Kelly
fd116b7d3f
Add object class.
2018-08-15 17:03:29 +01:00
cthulahoops
66c5f0f96a
Merge pull request #63 from RustPython/list_append
...
Add getattr and hasattr builtins
2018-08-15 16:59:18 +01:00
Windel Bouwman
a7ff8a01bc
Rust formatting
2018-08-15 14:29:01 +02:00