[GH-ISSUE #1689] Encoder for imap_utf7 not compatible with PyPy #1327

Closed
opened 2026-02-27 11:16:32 +03:00 by kerem · 0 comments
Owner

Originally created by @PatTheMav on GitHub (Mar 2, 2019).
Original GitHub issue: https://github.com/modoboa/modoboa/issues/1689

Impacted versions

  • Modoboa: 1.13.1
  • installer used: Yes/No ? Yes
  • Webserver: Nginx

Steps to reproduce

  1. Install PyPy
  2. Execute lib/imap_utf7.py with PyPy directly
  3. Observe errors

Alternatively:

  1. Create a new virtual environment inside Modoboa's home folder with PyPy as interpreter
  2. Install uWSGI and associated support files for PyPy compatibility
  3. Run Modoboa
  4. Use Webinterface

Current behavior

The webmail portion of the web interface doesn't work when Modoboa runs under PyPy, giving the following "final" error:

TypeError at /webmail/
encoder() takes exactly 1 argument (2 given)

Investigating the codebase yielded the following observation:

The IMAP UTF-7 codec (defined in lib/imap_utf7.py) accepts only a single parameter in its encoder method, yet for some reason PyPy always (!) sends 2 parameters:

  1. The string to encode
  2. The error handling strategy

While this second parameter exists in CPython's own Codec specification, it doesn't use a second parameter by default).

A simple patch makes Modoboa compatible with PyPy (at least I haven't observed any errors so far):

Changing both signatures to def encoder(s, __): and decoder(s, __): respectively.

Expected behavior

Modoboa webmail works as intended.

Originally created by @PatTheMav on GitHub (Mar 2, 2019). Original GitHub issue: https://github.com/modoboa/modoboa/issues/1689 # Impacted versions * Modoboa: 1.13.1 * installer used: Yes/No ? Yes * Webserver: Nginx # Steps to reproduce 1. Install PyPy 2. Execute `lib/imap_utf7.py` with PyPy directly 3. Observe errors Alternatively: 1. Create a new virtual environment inside Modoboa's home folder with PyPy as interpreter 2. Install uWSGI and associated support files for PyPy compatibility 3. Run Modoboa 4. Use Webinterface # Current behavior The webmail portion of the web interface doesn't work when Modoboa runs under PyPy, giving the following "final" error: TypeError at /webmail/ encoder() takes exactly 1 argument (2 given) Investigating the codebase yielded the following observation: The IMAP UTF-7 codec (defined in `lib/imap_utf7.py`) accepts only a single parameter in its `encoder` method, yet for some reason PyPy always (!) sends 2 parameters: 1. The string to encode 2. The error handling strategy While this second parameter exists in CPython's own `Codec` specification, it doesn't use a second parameter by default). A simple patch makes Modoboa compatible with PyPy (at least I haven't observed any errors so far): Changing both signatures to `def encoder(s, __):` and `decoder(s, __):` respectively. # Expected behavior Modoboa webmail works as intended.
kerem 2026-02-27 11:16:32 +03:00
  • closed this issue
  • added the
    bug
    label
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/modoboa-modoboa#1327
No description provided.