Commit Graph

107 Commits

Author SHA1 Message Date
Joey
2aee2981e3 Remove FromPyObjectRef, replace with downcast 2019-03-23 09:38:03 -07: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
7bfd2e6e84 Move function items out of pyobject module 2019-03-15 21:27:11 -07: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
Adrian Wielgosik
6b1598dbb4 Change some methods to return BigInt directly 2019-03-13 20:21:07 +01:00
Adrian Wielgosik
f647f346f2 Use Into<BigInt> instead of ToBigInt to avoid copies 2019-03-13 20:20:42 +01:00
Adrian Wielgosik
e3a5ac1378 Make objint::get_value return a reference 2019-03-11 23:07:56 +01:00
Adrian Wielgosik
4cbb1a38f1 Convert most objint functions to new args style 2019-03-11 19:20:22 +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
45bc8c8f7a Move PyRef to pyobject module 2019-03-10 13:01:46 -07:00
Joey
f9ab27296a Add conversions for all primitive ints 2019-03-06 20:38:52 -08:00
Joey
ecc92ffe33 Convert int to Any payload 2019-03-06 19:25:54 -08:00
Joey Hain
4558dbf210 Fix build (rustfmt) 2019-03-02 13:25:42 -08:00
Windel Bouwman
b98926a0fb Merge pull request #572 from RustPython/joey/fun-with-functions
Derive types, arity, conversions and more from rust fns
2019-03-02 20:56:52 +01:00
Windel Bouwman
30ddb48037 Use PyResult at more places. 2019-03-02 14:10:46 +01:00
Joey
990c29469a Merge remote-tracking branch 'origin/master' into joey/fun-with-functions
Conflicts:
      vm/src/pyobject.rs
2019-02-28 10:44:46 -08:00
Windel Bouwman
b0ee1947c7 Merge pull request #565 from alexpantyukhin/add_kwarg_handling_to_int
add kwarg handling for int
2019-02-28 07:36:08 +01: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
apantykhin
7e2c702c5e fix fmt 2019-02-27 21:22:24 +00:00
alexpantyukhin
d806a19c23 add kwarg handling for int 2019-02-27 19:58:32 +00:00
alexpantyukhin
70ad78eb21 fix error messages. 2019-02-27 13:22:27 +04:00
alexpantyukhin
15e6187583 add overflow errors for int shifts. 2019-02-27 11:11:38 +04:00
Joey Hain
f10fa6db44 Remove outer RefCell from PyObjectRef 2019-02-25 21:01:37 -08:00
Windel Bouwman
027a6847e5 Merge pull request #525 from RustPython/joey/extractor-pattern
Use "extractor" pattern for native functions
2019-02-25 07:22:00 +01:00
Joey Hain
2919d7f520 Initial arg type checking 2019-02-23 19:27:22 -08:00
Joey Hain
c14a8302e8 Initial prototype of "extractor pattern" for native funcs 2019-02-23 18:16:02 -08:00
Adam Kelly
2ab90b234a Fix unused variable warning in objint. 2019-02-21 21:05:46 +00:00
Windel Bouwman
565023f55b Merge pull request #518 from AdamGS/add_int_attributes
Added real/imag attributes to int type.
2019-02-21 20:52:06 +01:00
Adam Gutglick
0c1057f079 Added real/imag attributes to int type. 2019-02-21 13:46:18 -05:00
Joey
df76ffe116 Replace most relative imports with 2018-style crate 2019-02-20 08:50:53 -08:00
silmeth
4a67bb9797 stop dividing the divisor if the remainder already disappeared 2019-02-15 20:08:28 +01:00
silmeth
4cfd3a1cd0 get rid of unnecessary muts in objint::div_ints 2019-02-15 19:50:25 +01:00
silmeth
8ed82a089f make big ints dividable if the result fits in a float 2019-02-15 19:43:00 +01:00
Joey Hain
c6ac393f84 Add {int,float}.{__radd__,__rsub__,__rmul__,__rtruediv__} 2019-02-14 21:21:30 -08:00
Joey Hain
5fd912b13a Remove float comparisons from int.__eq__, add int.__ne__ 2019-02-12 21:56:25 -08:00
Joey Hain
2041b7cef6 Fix int to float comparison 2019-02-12 18:44:03 -08:00
Joey Hain
dab4f7385f Use NotImplemented in binary operations 2019-02-10 09:19:06 -08:00
Windel Bouwman
05cd60bebc Merge pull request #415 from silmeth/fix-int-eq-float
fix int – float equality for big ints, inf and nan
2019-02-10 13:55:50 +01:00
silmeth
6c56c22f0f fix floordiv and divmod by zero for ints and floats 2019-02-09 15:15:54 +01:00
silmeth
d960ca3d5b fix int – float equality for big ints, inf and nan 2019-02-09 14:02:43 +01:00
Adam
a6d6f0fcaa Merge pull request #413 from ka7/spelling
Spelling fixes
2019-02-09 12:18:09 +00:00
Adam
8ad95c4a57 Merge pull request #326 from lausek/master
int type: rounding, index, trunc, int (#304)
2019-02-09 11:23:14 +00: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
Benedykt Jaworski
f823eb9403 Merge branch 'master' into master 2019-02-07 17:20:54 +01:00