This commit removes `PyStrReverseIterator` and its traits for using
general `PyReverseSequenceIterator` for `PyStr` type.
In previous rustpython, `PyStrReverseIterator` type registered in
`TypeZoo`, even it had no methods(e.g. `length_hint`, `reduce`, `setstate`)
Therefore, by removing `PyStrReverseIterator`, `PyStr` enable to use
`PySequenceReverseIterator`.
Signed-off-by: snowapril <sinjihng@gmail.com>
This commit implements `length_hint`, `reduce`, `setstate`, `next` for
`PyReverseSequenceIterator`.
In previous rustpython, it did not conduct methods well for
general object.
Signed-off-by: snowapril <sinjihng@gmail.com>
add `!symbol.is_global()` condition check before entrying global symbol
errors
This change will decrease hot path cost.
Signed-off-by: snowapril <sinjihng@gmail.com>
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