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>
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
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
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>
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>