imaplib Too many arguments for command for select on big inbox
===

I am trying to access to my emails in Gmail from a python script. The code I use is the following:

    import imaplib
    user = "myuser"
    pwd = "mypassword"
    m = imaplib.IMAP4_SSL("imap.gmail.com")
    m.login(user,pwd)
    m.select("[Gmail]/All Mail")

When running this code in python 2, it works fine, get a list of all my emails. In python 3 hoverer it fails with the error

    >>> m.select("[Gmail]/All Mail")
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "/usr/lib/python3.2/imaplib.py", line 674, in select
        typ, dat = self._simple_command(name, mailbox)
      File "/usr/lib/python3.2/imaplib.py", line 1121, in _simple_command
        return self._command_complete(name, self._command(name, *args))
      File "/usr/lib/python3.2/imaplib.py", line 957, in _command_complete
        raise self.error('%s command error: %s %s' % (name, typ, data))
    imaplib.error: SELECT command error: BAD [b'[CLIENTBUG] Too many arguments for command']

I have done a bit of testing. It works fine on other folder such as "Inbox" where I get only 400 emails (vs 6000 in "All Mail").

Is it a problem related to the size of the list ?

Thank you