Issues

Issue #1849 resolved

Py2: 'a, b, c'.split(u', ') returns wrong/different stringtype

Markus Unterwaditzer
created an issue

Given the following snippet:

'a, b, c'.split(u', ')

Result in CPython:

$ python2
Python 2.7.8 (default, Jul  1 2014, 17:30:21) 
[GCC 4.9.0 20140604 (prerelease)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> 'a, b, c'.split(u', ')
[u'a', u'b', u'c']

Result in PyPy:

$ pypy
Python 2.7.6 (3cf384e86ef7, Jul 09 2014, 04:28:24)
[PyPy 2.4.0-alpha0 with GCC 4.9.0 20140604 (prerelease)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
And now for something completely different: ``samuele says that we lost a
razor. so we can't shave yaks''
>>>> 'a, b, c'.split(u', ')                                                                   
['a', 'b', 'c']
>>>> 

I hope the version information given in the shell session is sufficient.

Comments (5)

  1. Philip Jenvey

    This is a regression between PyPy 2.2.x and PyPy 2.3, likely due to the refactor-str-types branch. Surprisingly enough none of the stdlib nor PyPy's own tests noticed it

    Other methods like rsplit, partition and others likely have the same issue

  2. Log in to comment