Commit Graph

94 Commits

Author SHA1 Message Date
Adam Kelly
9ebbde8126 Replace special cases in boolval with __bool__ method on types. 2019-03-23 09:31:42 +00:00
ben
c1d5ce715f Change isinstance/issubclass to accept PyClassRef instead of PyCObject.
Also changed PyValue::class to return a PyClassRef.
2019-03-23 19:32:31 +13:00
Windel Bouwman
68ba050030 Use the extend class macro more. 2019-03-22 20:45:34 +01:00
coolreader18
a9051ab462 Convert all &mut VirtualMachine to &VirtualMachine 2019-03-22 01:48:14 -05:00
Joey
90db9812e5 Merge pull request #707 from RustPython/joey/proper-pyref-display
Fix the Display impl for PyRef
2019-03-21 09:32:02 -07:00
Adam Kelly
e66b5078a8 Introduce TryIntoRef<T> to make vm.get_attribute more usable. 2019-03-21 10:58:32 +00:00
Joey Hain
0b1b6682c1 Fix Display impl for PyRef 2019-03-20 18:32:25 -07:00
Adam Kelly
6b3f61f3ca Merge branch 'master' into objdict_refactor 2019-03-19 10:19:03 +00:00
Joey
d3b9714754 Convert print() builtin to new args style 2019-03-16 16:29:09 -07:00
Joey
9de7285d23 Merge remote-tracking branch 'origin/master' into joey/pyobject-function-split
Conflicts:
      vm/src/frame.rs
      vm/src/obj/objbytearray.rs
      vm/src/obj/objbytes.rs
      vm/src/obj/objcomplex.rs
2019-03-16 08:37:18 -07:00
Adam Kelly
9eeeeeae48 Change return type of vm.to_repr and vm.to_str to PyStringRef. 2019-03-16 09:42:54 +00:00
Joey
7bfd2e6e84 Move function items out of pyobject module 2019-03-15 21:27:11 -07:00
Adam
0e6e8b617d Merge branch 'master' into prefer_pyvalue_into_ref 2019-03-15 22:11:51 +00:00
Adam Kelly
111208b46f Remove PyRef::new/new_with_type. 2019-03-15 11:36:25 +00:00
Joey
fa9e48a5b3 Take &mut VirtualMachine insteadof &PyContext 2019-03-14 21:43:19 -07:00
Joey
737ec12fa5 Rename PyValue::{required_type => class} 2019-03-14 20:08:41 -07:00
Adam Kelly
5b41cc4b0d Fix subclasses of string. (Fixes #130) 2019-03-14 09:06:29 +00:00
Joey Hain
5971fc3bd4 rename PyObjectPayload2 to PyValue 2019-03-10 13:48:51 -07:00
Joey Hain
45bc8c8f7a Move PyRef to pyobject module 2019-03-10 13:01:46 -07:00
Chylli
e38a82e540 add __doc__ to str 2019-03-10 22:39:22 +08:00
Joey Hain
e1d728e81f slice 2019-03-09 15:10:44 -08:00
Adrian Wielgosik
b81a0a16d8 Convert most remaining string methods to implicit args
Also support out-of-range start/end params for some functions.
2019-03-07 20:39:57 +01:00
Joey
4a000c424c Improvements to OptionalArg extractor 2019-03-06 19:53:03 -08:00
Joey Hain
c68dbcc1ab Improve readability of methods on PyRef<PyString>
- Introduce PyStringRef type alias
- Impl python methods on PyStringRef to allow receiver to just be `self`
2019-03-05 19:56:25 -08:00
Adrian Wielgosik
e4e8b135ef Convert a bunch of string methods to new-args-style.
Mostly skipped the ones dealing with ints.
2019-03-05 20:41:02 +01:00
Joey Hain
3478251d40 Merge remote-tracking branch 'origin/master' into joey/fun-with-functions
Conflicts:
      vm/src/lib.rs
      vm/src/pyobject.rs
      wasm/lib/src/vm_class.rs
2019-03-02 04:04:22 -08:00
coolreader18
f364ea5943 Fix a bunch of clippy lints 2019-03-01 18:41:45 -06:00
Joey Hain
713edc57ee Convert some objstring methods to new style. 2019-02-27 19:53:31 -08:00
Joey Hain
7f75e3ee8a Significant improvements to new function definition style
- PyRef<T> type for accepting references to payloads.
- Args<T> type for consuming remaining positional args
  (mirrors python `*args`).
- KwArgs<T> type for consuming remaining keyword args
  (mirrors python `*kwargs`).
- OptArg<T> type for consuming remaining keyword args
  (no python code equivalent, only possible in native functions like in cpython).
- PyIterable<T> for accepting an iterator over a sequence of Ts.
- Arity checking (but TypeError messages need work)
2019-02-27 19:53:20 -08:00
Joey Hain
f10fa6db44 Remove outer RefCell from PyObjectRef 2019-02-25 21:01:37 -08:00
Joey Hain
2919d7f520 Initial arg type checking 2019-02-23 19:27:22 -08:00
Joey
df76ffe116 Replace most relative imports with 2018-style crate 2019-02-20 08:50:53 -08:00
silmeth
0c626dd595 rename objstr::get_value_as_ref to objstr::borrow_value 2019-02-15 19:29:58 +01:00
janczer
89e947a04f Fix typos 2019-02-14 20:38:18 +01:00
silmeth
7b7aa13295 microoptimize print (lock stdout, borrow strings) 2019-02-12 22:25:46 +01:00
ZapAnton
206ccc55fb Fixed the len_without_is_empty clippy warning 2019-02-12 16:49:34 +03:00
ZapAnton
00cfa47f64 Fixed the should_implement_trait clippy warning 2019-02-12 16:35:28 +03:00
ZapAnton
56e2d4c495 Fixed into_iter_on_ref clippy warning 2019-02-11 15:24:51 +03:00
ZapAnton
c8d619c123 Fixed useless_let_if_seq clippy warnings 2019-02-11 15:24:13 +03:00
janczer
aac1ce4e07 Fix the str.{__lt__, __gt__} and add the methods str.{__le__, __ge__} 2019-02-10 16:40:09 +01:00
klemens
b109ea954a Merge branch 'master' into spelling 2019-02-09 12:03:08 +01:00
klemens
79a7e5e42b spelling fixes 2019-02-09 12:00:46 +01:00
ben
7abf02180a implement slice negative step handling 2019-02-09 15:48:07 +13:00
ben
907dfb6770 Add slice type and use BigInts in slice payload. 2019-02-09 12:07:04 +13:00
Windel Bouwman
3d2d04596c Merge pull request #343 from ZapAnton/fix_various_clippy
Fixed various small clippy warnings
2019-02-07 17:35:29 +01:00
Adam Kelly
fd344ec1e0 Remove unnecessary to_bigint().unwrap() everywhere. 2019-02-06 17:38:01 +00:00
ZapAnton
3464828499 Fixed various small clippy warnings 2019-02-06 13:24:24 +03:00
Homer McMillan
00ef668022 String is* methods return false on empty string #363 2019-02-06 03:15:03 -05:00
Windel Bouwman
aaf0eab530 Merge pull request #342 from ZapAnton/fix_collapsible_if
Fixed the 'collapsible_if' clippy warnings
2019-02-05 23:34:29 +01:00
Windel Bouwman
69e3571d0c Merge pull request #341 from ZapAnton/toplevel_ref_arg
Fixed the 'toplevel_ref_arg' clippy warning
2019-02-05 22:42:31 +01:00