Commit Graph

48 Commits

Author SHA1 Message Date
Adrian Wielgosik
e3a5ac1378 Make objint::get_value return a reference 2019-03-11 23:07:56 +01:00
Joey Hain
053ceb1a30 Move payload boxing into PyObject::new 2019-03-10 20:19:28 -07:00
Joey Hain
5971fc3bd4 rename PyObjectPayload2 to PyValue 2019-03-10 13:48:51 -07:00
Joey Hain
e2e13af7ea Remove PyObjectPayload 2019-03-10 13:45:38 -07:00
Joey Hain
f6765cf16e less explicit returns 2019-03-10 00:34:21 -08:00
Joey Hain
e1d728e81f slice 2019-03-09 15:10:44 -08:00
Joey
157d18d7a1 Convert iterator 2019-03-09 14:45:55 -08:00
Joey
ecc92ffe33 Convert int to Any payload 2019-03-06 19:25:54 -08:00
Joey Hain
e7fb116210 Convert more objects to Any payload 2019-03-02 13:27:00 -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
e959908a49 Fix iterator 2019-02-25 21:26:15 -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 Hain
fb0384d24d Some prerequisite data types for arg checking 2019-02-23 18:16:24 -08:00
Joey Hain
c14a8302e8 Initial prototype of "extractor pattern" for native funcs 2019-02-23 18:16:02 -08:00
Joey
df76ffe116 Replace most relative imports with 2018-style crate 2019-02-20 08:50:53 -08:00
ZapAnton
38930984ec Fixed the redundant_pattern_matching clippy warning 2019-02-12 16:45:44 +03:00
ZapAnton
291dba6bb6 Fixed the toplevel_ref_arg clippy warning 2019-02-12 16:44:47 +03:00
ZapAnton
5fe373555f Fixed the match_bool clippy warning 2019-02-12 16:43:59 +03:00
ZapAnton
45b9ef9719 Fixed the op_ref clippy warnings 2019-02-12 16:42:53 +03:00
Homer McMillan
389fc3acd9 cargo fmt 2019-02-10 12:04:42 -05:00
Homer McMillan
9de733be19 Add range start/stop/step 2019-02-10 12:03:22 -05:00
Windel Bouwman
fc38d55b59 Merge pull request #381 from nficca/implement-range-count
Implement range.count
2019-02-10 11:46:10 +01:00
Nic Ficca
0cb661f3a2 Dry up objrange
- Use get_value in all appropriate spots
2019-02-09 16:54:14 -05:00
Nic Ficca
2e9892029a Add objrange::get_value
- Refactor range_count to use get_value and isinstance for pulling out the range and argument respectively
2019-02-09 16:49:44 -05:00
Nic Ficca
b7a4248837 Add range.count 2019-02-09 16:27:12 -05:00
Homer McMillan
ba9226219b cargo fmt 2019-02-09 15:54:17 -05:00
Homer McMillan
a4d13f9f50 Fix typo 2019-02-09 15:53:13 -05:00
Homer McMillan
4e02962289 Fix range reversed #421 2019-02-09 15:49:51 -05:00
Joey Hain
969ddf2ea0 Merge remote-tracking branch 'upstream/master' into reversed 2019-02-09 08:13:03 -08:00
Adam
2ae9d88de4 Merge pull request #398 from ZapAnton/range_doc
range type: Added __doc__
2019-02-09 11:11:13 +00:00
ben
907dfb6770 Add slice type and use BigInts in slice payload. 2019-02-09 12:07:04 +13:00
Windel Bouwman
85475e4e30 Merge pull request #347 from silmeth/master
Fix Range’s len() + division and mod by 0
2019-02-08 21:04:31 +01:00
Benedykt Jaworski
b9245309d5 Merge branch 'master' into master 2019-02-08 18:45:00 +01:00
ZapAnton
0e6fca0106 Fix the 'if_same_then_else' clippy warnings
Relevant clippy warning: https://rust-lang.github.io/rust-clippy/master/index.html#if_same_then_else
2019-02-08 20:04:30 +03:00
ZapAnton
a6d6f7721b range type: Added __doc__ 2019-02-08 19:17:08 +03:00
Joey Hain
1ebacafb00 Add reversed builtin and range.__reversed__ 2019-02-08 00:19:14 -08:00
Joey Hain
54bcb08518 Add range.{__bool__, __contains__}
- Also fix range.index for negative steps
2019-02-07 20:31:32 -08:00
Benedykt Jaworski
f823eb9403 Merge branch 'master' into master 2019-02-07 17:20:54 +01:00
Adam Kelly
fd344ec1e0 Remove unnecessary to_bigint().unwrap() everywhere. 2019-02-06 17:38:01 +00:00
Benedykt Jaworski
ff244df3eb Merge branch 'master' into master 2019-02-06 10:24:59 +01:00
Joey Hain
49a23a8483 remove misleading contains method 2019-02-05 16:26:12 -08:00
Joey Hain
b0a2f6f87d Add range.index 2019-02-05 13:34:54 -08:00
silmeth
30c8e477e4 style: rustfmt 2019-02-05 21:54:03 +01:00
silmeth
0a1eb4b91b make len(range) throw OverflowError on too big ints + impl __repr__ 2019-02-05 21:27:49 +01:00
silmeth
b43c511542 fix range len() for negative and non-divisible steps 2019-02-05 19:49:14 +01:00
Joey Hain
9ac8e55695 Represent range with BigInts 2019-02-04 17:38:23 -08:00
Homer McMillan
64bd33e787 Add built in range type (addresses #294) 2019-02-04 15:08:13 -05:00