brython-dev/brython — pull request #72 by jsbueno (2014-11-26 13:03:10+00:00)
Title: Fixes behavior of str.split with maxsplit parameter, fixes str.rsplit

The str.split method is not working properly when a maxsplit argument is passed in. The current behavior is:
```python
>>> "http://slashdot.org/path/path2".split("/", 3)
['http:', '', 'slashdot.org']
```

While the correct python3 behavior is:
```python
>>> "http://slashdot.org/path/path2".split("/", 3)
['http:', '', 'slashdot.org', 'path/path2']
```

The str.rsplit method is simply not working at all - it fails on call due to an outdated parameter extraction code. When that is fixed, the algorithm for it is simply incorrect (with unreachable code in a loop).
```python
>>> "http://slashdot.org/path/path2".rsplit("/", 1)

TypeError: undefined is not a function
module 'exec-cepannpy' line 1
"http://slashdot.org/path/path2".rsplit("/", 1)
module 'exec-cepannpy' line 1
"http://slashdot.org/path/path2".rsplit("/", 1)
```

This patch fixes both issues.