Closed 8e121080-cc2d-4f2f-9b30-7e4536124e42 closed 23 years ago
This patch adds a new module, quoted, and code in quopri to use this module if it exists. This module implements quoted printable encoding and decoding based on strings in C. This was required by a recent project of mine because 1MB quoted printable mail attachments (sometimes chosen to send PDF and PS data) would take 40+ minutes to encode and decode using the standard quopri python module.
Logged In: YES user_id=6380
It would make more sense to add this as another pair of encodings to the binascii module, which provides similar support for binhex, base64, and uuencode.
Logged In: YES user_id=325633
Ok, this new patch adds the code to binascii, b2a_qp and a2b_qp.
Logged In: YES user_id=21627
The patch looks good to me. A couple of comments that may be worth consideration:
Logged In: YES user_id=325633
Ok, this version handles invalid escape sequences the same way, ie by leaving them as they were in the input stream.
My original reason for writing this was performance, and the size of the input was already restricted to 1MB, hence the chosen in memory encode/decode. No one is likely to be using the current version for anything even approaching that size given the abysmal performance of the current version. Given that 2.2 adds the decodestring and encodestring versions, maybe we should have both, I'm not sure. The new mimelib module handles mail in memory, instead of using the file like operations of the rfc822 module. *shrug*
Using PyString in that fashion I don't think will save anything... as the only external interfaces for that would do a copy on create with PyString_FromStringAndSize(), and then a realloc with the PyString_Resize() (though I could be missing something in there).
Logged In: YES user_id=21627
I get numerous failures when running test_quopri. Do you see the same problems? Can you correct them?
Logged In: YES user_id=21627
Please have a look at the patch in
http://sourceforge.net/tracker/index.php?func=detail&aid=464070&group_id=5470&atid=305470
and the bug 463966. Would you be interested in fixing those bugs as well, and integrating the fixes into your C code?
Logged In: YES user_id=325633
Ok, this version (4) of the patch fixes the bugs introduced in version (2), and also incorporates the patch from 464070, which fixes bug 463966 in both C and the quopri code. This version also includes an optional argument that will cause header encoding in the encoding functions, as well as documentation of the new functions in the binascii module.
Logged In: YES user_id=21627
Thanks again for the patch. It was committed as libbinascii.tex 1.21, libquopri.tex 1.14, quopri.py 1.16, test_quopri.py 1.6, NEWS 1.261, binascii.c 2.30.
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields: ```python assignee = 'https://github.com/loewis' closed_at =
created_at =
labels = ['extension-modules']
title = 'New C module for quopri assist'
updated_at =
user = 'https://bugs.python.org/blong42'
```
bugs.python.org fields:
```python
activity =
actor = 'loewis'
assignee = 'loewis'
closed = True
closed_date = None
closer = None
components = ['Extension Modules']
creation =
creator = 'blong42'
dependencies = []
files = ['3614', '3615', '3616', '3617']
hgrepos = []
issue_num = 462190
keywords = ['patch']
message_count = 9.0
messages = ['37605', '37606', '37607', '37608', '37609', '37610', '37611', '37612', '37613']
nosy_count = 3.0
nosy_names = ['gvanrossum', 'loewis', 'blong42']
pr_nums = []
priority = 'normal'
resolution = 'accepted'
stage = None
status = 'closed'
superseder = None
type = None
url = 'https://bugs.python.org/issue462190'
versions = []
```