Commit Graph

1378 Commits

Author SHA1 Message Date
Noa
e277acc747 Merge pull request #2902 from eldpswp99/dict-remain-order-after-delete
make dict remain order after delete
2021-08-17 15:53:55 -05:00
Jeong YunWon
1d89e633dc Merge pull request #2903 from Snowapril/fix-syntax-test
Add syntax error detection routine for global symbol
2021-08-18 01:27:44 +09:00
Jeong YunWon
77ab21ce8d Merge pull request #2463 from fanninpm/test-base64
Add test_base64 from CPython 3.8.7
2021-08-17 23:30:38 +09:00
eldpswp99
b49a1e9f5e remove test_ordered_dict delitem expected failure to passed test 2021-08-17 22:50:32 +09:00
snowapril
13bbefdd4e compiler: impl syntax error detect for global kind
This commit fixes `test_global_parap_err_first` test in
[test_syntax.py](https://github.com/RustPython/RustPython/blob/master/Lib/test/test_syntax.py#L678) and implement the other syntax errors detection as cpython 3.8 provided for global symbol.

Below syntax error conditions are added.
* name {} is parameter and global
```python
>>>>> def test(a):
.....   global a
.....
SyntaxError: name 'a' is parameter and global at line 2 column 2
        global a
```
* annotated name {} can't be global
```python
>>>>> def test():
.....   a: int
.....   global a
.....
SyntaxError: annotated name 'a' can't be global at line 3 column 2
        global a
```
* name {} is assigned to before global description
```python
>>>>> a = 100
>>>>> def test():
.....   a = 10
.....   global a
.....
SyntaxError: name 'a' is assigned to before global declaration at line 3 column 2
        global a
```
* name {} is used prior to global declaration
```python
>>>>> a = 10
>>>>> def test():
.....   print(a)
.....   global a
.....
SyntaxError: name 'a' is used prior to global declaration at line 3 column 2
        global a
```

Signed-off-by: snowapril <sinjihng@gmail.com>
2021-08-17 21:14:13 +09:00
eldpswp99
ce99057c81 make dict delete remains order 2021-08-17 20:41:37 +09:00
Tetramad
f6fbea3019 Update pprint module to Python3.8
Add `sort_dicts` parameter to several functions and new `pp` function.
2021-08-17 13:59:07 +09:00
Kim Dong In
6fa88ab05a Fix failed test pow in test_math
add two conditions to raise ValueError for input values
case 1: NaN, when both input values are finite, and base is negative and exponent is non-integer
case 2: divde by zero, when base is 0 exponent is negative value
2021-08-16 16:45:45 +09:00
jfh
f7b6730c5d Mark failing tests. 2021-08-16 08:42:56 +03:00
jfh
8723952cce Add test_enumerate from CPython 3.8. 2021-08-16 07:30:38 +03:00
voidSatisfaction
67ede59c32 Add math.prod function and enable its tests 2021-08-15 23:20:28 +09:00
Jim Fasarakis-Hilliard
a4dce8068f Merge pull request #2887 from DimitrisJim/reverse_deque_iterator
Add reverse deque iterator.
2021-08-14 23:06:05 +03:00
jfh
8978e8ccda Add reverse deque iterator. 2021-08-14 22:07:41 +03:00
Snowapril
7cc2a5431f Fix frozenset copy to return self (#2883)
Fix frozenset copy to return zelf if called on frozenset instance
2021-08-14 15:56:22 +03:00
fermian
b1207ab39e Update test_collections.py 2021-08-14 17:27:43 +09:00
Jeong YunWon
9d99ea9376 Merge pull request #2879 from moreal/bugfix/unnecessary-slot-overwrite
Remove unnecessary slot wrapper addition
2021-08-14 16:14:39 +09:00
Moreal
597771d16e Unmark fixed tests 2021-08-14 15:25:39 +09:00
Jeong YunWon
289ddeaa3c Merge pull request #2878 from DimitrisJim/sets_reduce
Add reduce for set, frozenset.
2021-08-14 12:50:07 +09:00
Noa
cc40ae025e Merge pull request #2851 from deantvv/fix-os-sendfile
Fix os sendfile
2021-08-13 20:34:21 -05:00
jfh
ac0d5ff8b0 Add reduce for set, frozenset. 2021-08-14 01:11:13 +03:00
Jeong YunWon
634a6c2435 Merge pull request #2875 from DimitrisJim/retry_set_ops
Retrying contains, remove, discard with a frozenset.
2021-08-14 00:27:20 +09:00
jfh
4a460248b9 Retrying contains, remove, discard with a frozenset. 2021-08-13 17:33:13 +03:00
Jeong YunWon
805abb78e8 Merge pull request #2871 from DimitrisJim/deque_init
Deque.__init__ handles initialization.
2021-08-13 14:43:58 +09:00
jfh
64818913b8 Deque.__init__ handles initialization. 2021-08-12 21:04:41 +03:00
Jim Fasarakis-Hilliard
987516bc1f Merge pull request #2868 from DimitrisJim/reverse_list_it
Fix pickling, length hint, iteration for reverse list iterators.
2021-08-12 21:02:55 +03:00
jfh
0c6375c031 Fix pickling, length hint, iteration for reverse list iterators. Refactor common functionality. 2021-08-12 20:26:59 +03:00
eldpswp99
c29a1d2632 remove improper setter of deque.maxlen
before: maxlen was writable
        d = deque()
        d.maxlen = 10 was allowed
after : make maxlen read-only
	the before code raise attributError
2021-08-12 22:51:00 +09:00
Jeong YunWon
d2a9316344 Merge pull request #2853 from eldpswp99/support-deque.extend-recursive-call
support deque.extend recursive call
2021-08-12 22:20:56 +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
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
Nikita Sobolev
090672800a Adds __rmul__ to collections.deque (#2844)
* Adds `__rmul__` to `collections.deque`, refs #2834
2021-08-11 17:58:46 +03:00
eldpswp99
2528d25fbe support deque.extend recursive call
before: RustPython hangs when
	d = deque('a')
	d.extend(d)
after: it extends to the copy of it
2021-08-11 22:33:21 +09:00
Dean Li
b80db73af6 os: update TestSendfile from cpython 2021-08-11 20:58:13 +08:00
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
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
Padraic Fanning
9f497fb65a Add test_float from CPython 3.9.1
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
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
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
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
James Webber
596dfe1f5a un-annotate now-passing test 2021-08-08 21:45:12 -04:00
Jim Fasarakis-Hilliard
9652c79f1d Merge pull request #2787 from fanninpm/test-yield-from
Add test_yield_from from CPython 3.8
2021-08-08 21:15:28 +03:00
Padraic Fanning
373aff3d69 Mark failing tests due to GitHub Actions 2021-08-08 13:23:37 -04: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