Commit Graph

105 Commits

Author SHA1 Message Date
Adam Kelly
c8eda3733d Eliminate ctx.set_attr. 2019-04-05 09:50:31 +01:00
Adam Kelly
bce4f1e483 Simplify/shrink the dict interface. 2019-04-05 09:39:59 +01:00
Joey
1c958c93b1 Merge pull request #774 from RustPython/joey/match-class
Add match_class! macro
2019-04-04 07:13:31 -07:00
Joey Hain
8549ea22a3 Use match_class! in objint::to_int 2019-04-01 20:22:11 -07:00
coolreader18
53b46a7b32 Split some of #[pyclass] off into #[pyimpl] 2019-03-31 17:23:33 -05:00
coolreader18
15cffc4d2b Clean up a bit 2019-03-30 22:30:14 -05:00
coolreader18
d9efe4ea37 Require a #[pymethod] for a method to be recognized 2019-03-29 16:16:31 -05:00
coolreader18
8376ec2d98 Use doc comments for python __doc__ 2019-03-29 15:17:58 -05:00
coolreader18
ab6031871c impl PyStringRef using py_class 2019-03-29 14:51:42 -05:00
coolreader18
ff85838556 Add #[py_class] attribute proc macro 2019-03-29 00:16:34 -05:00
Joey Hain
cc4f3fdb40 Clean up TypeProtocol 2019-03-25 19:18:01 -07:00
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