Commit Graph

318 Commits

Author SHA1 Message Date
Windel Bouwman
71896fd2aa Merge branch 'master' of https://github.com/RustPython/RustPython into exceptions 2018-08-26 11:40:30 +02:00
Windel Bouwman
a833526223 Add traceback and msg to exception objects 2018-08-26 11:40:23 +02:00
Windel Bouwman
6ce1dbce26 Add issiubclass 2018-08-26 10:54:03 +02:00
cthulahoops
c295a4514c Merge pull request #82 from RustPython/bools_2
Bools 2
2018-08-26 09:52:28 +01:00
Windel Bouwman
4ca3314d4c Merge pull request #83 from OddBloke/import
Make imports relative to the importing file
2018-08-26 10:49:10 +02:00
Adam Kelly
de0dde21f0 Don't create extra JumpIfOrPop instructions.
As discussed:

https://github.com/RustPython/RustPython/pull/82#discussion_r212809238
2018-08-26 09:36:27 +01:00
Adam Kelly
e10dfa4f87 Compile and and or. 2018-08-26 09:36:27 +01:00
Adam Kelly
fb2c959cc4 Missing __bool__ is truthy and None is falsey. 2018-08-26 09:36:27 +01:00
Windel Bouwman
2053544199 Merge pull request #85 from RustPython/exceptions
Check that raise command raises exception type
2018-08-26 10:01:40 +02:00
Daniel Watkins
a457153ce1 Consider imports relative to their source
Currently they are considered relative to the current working directory
of the interpreter, which is incorrect.

Fixes #83.
2018-08-25 19:45:19 -04:00
Daniel Watkins
767ceaefb5 Start storing the source_path of a code object
This will be required for (at least) import and exception display.
2018-08-25 19:45:19 -04:00
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
a0edc4203f Check that raise command raises exception type 2018-08-26 00:30:01 +02:00
Windel Bouwman
c41370a26f Merge pull request #84 from OddBloke/newline
Don't double-count newlines in comments
2018-08-25 23:02:52 +02:00
Daniel Watkins
159a524f3f Don't double-count newlines in comments
lex_comment doesn't consume the newlines, (correctly) leaving them to
the regular newline parsing.  As such, it shouldn't call self.new_line,
or we end up double-counting lines.
2018-08-25 10:54:31 -04:00
cthulahoops
6aff83e2e5 Merge pull request #78 from RustPython/exceptions
Implement exception type checking at catch
2018-08-25 14:45:19 +01: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
Windel Bouwman
81546c6f94 Merge pull request #81 from OddBloke/newline
Fix a couple of newline-in-string nits
2018-08-25 08:25:38 +02:00
Windel Bouwman
33f5e7c632 Merge pull request #77 from OddBloke/import
Implement PYTHONPATH
2018-08-25 08:25:10 +02:00
Daniel Watkins
a06044dc6b Reject newlines in single-quoted strings 2018-08-25 00:21:37 -04:00
Daniel Watkins
367806f845 Increment lexer row count for newlines in strings 2018-08-25 00:20:03 -04: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
Windel Bouwman
42f7ecaaec Merge pull request #76 from RustPython/bools
Bools
2018-08-24 21:21:02 +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
d5668c32ee Add test for bools. 2018-08-24 18:23:20 +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
cthulahoops
3a72111c9f Merge pull request #75 from RustPython/str
Str Type
2018-08-24 17:43:53 +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
Daniel Watkins
db77f4d9d3 Merge pull request #74 from RustPython/dict_protocols
Complete Improvement to DictProtocol and AttributeProtocol
2018-08-24 09:23:02 -04: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
cthulahoops
97042187f6 Merge pull request #73 from RustPython/exceptions
Add BaseException class
2018-08-24 10:13:18 +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
adfd6ad5bb Merge pull request #72 from RustPython/exceptions
Add row and column info to lexer
2018-08-22 19:07:52 +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