Commit Graph

5279 Commits

Author SHA1 Message Date
eldpswp99
564eb2991e resolving deadlock and redundant lookup, grammatic mistakes 2021-08-18 02:28:58 +09:00
eldpswp99
fca7b41744 optimize popitem using nentries which implies next insertion index 2021-08-17 21:24:06 +09:00
eldpswp99
ce99057c81 make dict delete remains order 2021-08-17 20:41:37 +09:00
eldpswp99
4e9f9ff129 change Dict Entries type Vec<DictEntry> to Vec<Option<DictEntry>> 2021-08-16 18:46:49 +09:00
eldpswp99
ab8c6bf97a support deque.insert when idx is gte to len
before: when idx >= len it doesn't insert the element to the end
	it inserted to index len-1
after:  when idx >= len it inserts the element to the end of the deque
2021-08-12 20:03:24 +09:00
Jim Fasarakis-Hilliard
08b758c8eb Merge pull request #2861 from youknowone/pymethod-magic
clean up #[pymethod(magic)]
2021-08-12 01:22:26 +03:00
Jeong YunWon
4e60bcd741 clean up #[pymethod(magic)] 2021-08-12 06:44:52 +09:00
Jim Fasarakis-Hilliard
5982e8c11c Merge pull request #2859 from DimitrisJim/fix_faulty_length_hint
Fix length hint for dictionary iterators.
2021-08-12 00:20:06 +03:00
jfh
0c4d579adc Fix length hint for dictionary iterators. 2021-08-11 23:46:00 +03:00
Jeong YunWon
01c106b76c Merge pull request #2857 from youknowone/richcompare
tp_cmp -> tp_richcompare
2021-08-12 04:41:12 +09:00
Jeong YunWon
1a57ef03aa tp_cmp -> tp_richcompare
this was the last typeslot with mismatching name
2021-08-12 04:01:51 +09:00
sobolevn
37f66dd998 id() for bytes stays the same after * 1, refs #2840 2021-08-11 21:53:52 +03:00
Jeong YunWon
03a9d6058b Refactor Buffer Protocol (mostly namings) (#2849)
* Refactor Buffer protocol into RustPython convention
2021-08-11 20:11:31 +03:00
Nikita Sobolev
090672800a Adds __rmul__ to collections.deque (#2844)
* Adds `__rmul__` to `collections.deque`, refs #2834
2021-08-11 17:58:46 +03:00
Jeong YunWon
6bd69af8f6 Merge pull request #2848 from voidsatisfaction/fix-dict-or-ror-ior-return-notimplemented
Fix make dict.{__or__,__ror__,__ior__} with other types return NotImplemented
2021-08-11 21:36:44 +09:00
voidsatisfaction
3500a58138 fix: make dict.{__or__,__ror__,__ior__} with other types should return NotImplemented 2021-08-11 20:23:51 +09:00
Arnab1181412
49a30b9dab Fixed unwrapping in frame.rs 2021-08-11 16:52:12 +05:30
eldpswp99
571d9c4994 add deque __iadd__ method 2021-08-11 18:43:31 +09:00
Jeong YunWon
9ba674a2a9 Merge pull request #2841 from sobolevn/issue-2840
Fixes that `id()` of `tuple` was changing on `* 1`
2021-08-11 17:30:16 +09:00
Nikita Sobolev
2705fb2320 Update vm/src/builtins/tuple.rs
Co-authored-by: Jim Fasarakis-Hilliard <d.f.hilliard@gmail.com>
2021-08-11 10:38:36 +03:00
Padraic Fanning
95b514b85d Implement __floor__ for float type
Co-authored-by: Tetramad <cbwjd777@gmail.com>
2021-08-11 14:30:10 +09:00
Padraic Fanning
fae7b0e8ed Implement __ceil__ for float type
Co-authored-by: Tetramad <cbwjd777@gmail.com>
2021-08-11 14:30:10 +09:00
sobolevn
7e2efb4de5 Fixes that id() of tuple was changing on * 1, refs #2840 2021-08-11 01:47:16 +03:00
Jeong YunWon
08614bfc95 Merge pull request #2830 from DimitrisJim/bytearray_init_alloc
Add __alloc__ to bytearray and fix its __init__ issues.
2021-08-11 04:10:08 +09:00
jfh
04c9ae0c83 Fix bytearray.__init__. 2021-08-10 21:03:07 +03:00
Nikita Sobolev
a4fd0144ad Fixes repr of functions defined in classes 2021-08-11 02:55:05 +09:00
leesungbin
2c6208a5f8 Add math_perm method
Co-authored-by: Jeong YunWon <youknowone@users.noreply.github.com>
2021-08-11 02:29:44 +09:00
jfh
a136db2917 Add __alloc__ for bytearray, add note to tests. 2021-08-10 19:09:22 +03:00
Dean Li
e01995d07f socket: use libc::hstrerror 2021-08-10 20:31:39 +08:00
Nikita Sobolev
b33f72eb4d Adds __qualname__ to PyBoundMethod 2021-08-10 05:32:02 +09:00
Jeong YunWon
49ff438278 Merge pull request #2820 from sobolevn/issue-2779
Fixes infinite recursion on `raise e from e`
2021-08-10 04:54:52 +09:00
Jeong YunWon
be0e7ce539 Merge pull request #2818 from Snowapril/fix-seq-indexing
Add __index__ operator overriding class support for SequenceIndex
2021-08-10 04:24:34 +09:00
Jeong YunWon
a611ba2e45 handle cause and context with same code block 2021-08-10 04:20:51 +09:00
Jeong YunWon
794d2ce2e4 Refactor SequenceIndex::try_from_object_for 2021-08-10 03:33:48 +09:00
sobolevn
83914a9f54 Fixes infinite recursion on raise e from e, refs #2779 2021-08-09 20:58:36 +03:00
sobolevn
c0f38e2263 Adds __subclasshook__ to type, refs #2794 2021-08-09 16:33:57 +03:00
snowapril
8d507a6fbc seq: add __index__ op overriding class support
This commit fix three test cases in test_index.py
* SeqTestCase.test_index
* SeqTestCase.test_wrappers
* ListTestCase.test_setdelitem

All these three cases' failures were caused by not supporting classes
that override __index__ operator when indexing sequence type.

This commit implement almost same routine with PR(#2807) which also did not
support classes which override __index__ operator in range indexing.

Signed-off-by: snowapril <sinjihng@gmail.com>
2021-08-09 21:33:53 +09:00
Jim Fasarakis-Hilliard
81200b12f4 Merge pull request #2814 from jamestwebber/unhashable-deque
implement Unhashable for collections.deque
2021-08-09 05:24:02 +03:00
James Webber
fee5909609 SlotDesctuctor -> SlotDestructor 2021-08-08 21:05:30 -04:00
James Webber
e003f255d5 implement hashable and unhashable for collections.deque 2021-08-08 20:59:39 -04:00
Jeong YunWon
9ac81a7781 Merge pull request #2808 from sobolevn/issue-2790
Adds `class` field to `PyGetSet` to fix `__qualname__`
2021-08-09 01:40:49 +09:00
sobolevn
e939346850 Adds class field to PyGetSet to fix __qualname__ and (in future) repr, refs #2790 2021-08-08 18:53:57 +03:00
Snowapril
89ca1db86d builtins: add __index__ overriding class support
This commit fix RangeTestCase.test_range test in test_index.py

TryFromObject implementation for RangeIndex enum did not cover classes
that override __index__ operator which cpython implementation is currently providing
(https://docs.python.org/3.8/library/operator.html#operator.__index__)

I add codes that cover upper case using vm.to_index method.

Signed-off-by: snowapril <sinjihng@gmail.com>
2021-08-08 21:27:05 +09:00
voidSatisfaction
3cd1f6b27c Add math.comb function 2021-08-08 20:04:23 +09:00
sobolevn
e5e20a53b2 Makes type.__prepare__ a classmethod, also first arg is any (not str), refs #2762 2021-08-08 12:49:41 +03:00
sobolevn
af63e83e13 Makes args of type.__prepare__ optional, refs #2762 2021-08-08 12:05:31 +03:00
Jeong YunWon
43a43f76f2 Merge pull request #2803 from moreal/bugfix/rethrow-error-in-build-map
Fix incorrect unwrapping
2021-08-07 23:47:06 +09:00
Jim Fasarakis-Hilliard
bf59103d19 Merge pull request #2802 from eldpswp99/iskeyword-none-check
add iskeyword None check
2021-08-07 15:43:02 +03:00
Lee Dogeon
653858e152 Fix unhashable type error message (#2801)
* Fix unhashable type error message
2021-08-07 14:37:01 +03:00
eldpswp99
1c0bd83809 iskeyword: add None check
there was one todo in test_keyword.py

before: s was PyStrRef, it failed to handle None
after: convert s to PyObjectRef and add None check
2021-08-07 20:24:41 +09:00