This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2013年06月28日 19:16 by r.david.murray, last changed 2022年04月11日 14:57 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| set_qp_payload_test.patch | r.david.murray, 2013年06月28日 19:16 | review | ||
| set_payload_handles_binary_correctly.txt | vajrasky, 2013年07月10日 15:58 | Makes the set_payload handles binary correctly | review | |
| set_payload_binary.txt | vajrasky, 2013年07月21日 14:55 | review | ||
| set_payload_binary_v2.txt | vajrasky, 2013年07月22日 03:13 | review | ||
| set_payload_binary_v3.txt | vajrasky, 2013年07月27日 05:09 | review | ||
| Messages (13) | |||
|---|---|---|---|
| msg192012 - (view) | Author: R. David Murray (r.david.murray) * (Python committer) | Date: 2013年06月28日 19:16 | |
In order to maintain model consistency without exposing the need for 'surrogateescape' to library users, it should be possible to pass binary data to set_payload and have it do the correct conversion to the expected storage format for the model. Currently, this does not work. The attached patch provides one example test out of a class of tests that should be written and made to pass. |
|||
| msg192823 - (view) | Author: Vajrasky Kok (vajrasky) * | Date: 2013年07月10日 15:58 | |
Here is the preliminary patch for email module to pass the test. |
|||
| msg192826 - (view) | Author: R. David Murray (r.david.murray) * (Python committer) | Date: 2013年07月10日 16:07 | |
Thanks, but the patch is incorrect. The model consistently stores its data as surrogateescaped strings, and this assumption is baked in to other parts of the code. So the correct fix is to do the surrogateescape encoding at the time the payload is set. It might in fact be better to store a binary payload as binary, but making that kind of change to the model requires much more extensive review and testing. |
|||
| msg192828 - (view) | Author: Vajrasky Kok (vajrasky) * | Date: 2013年07月10日 16:31 | |
I see. Thanks for the explanation. I'll do this patch if nobody is interested. |
|||
| msg192829 - (view) | Author: R. David Murray (r.david.murray) * (Python committer) | Date: 2013年07月10日 16:42 | |
If you want to work on it that would be great. Note that one of the things that is needed is a bunch more tests of setting various *kinds* of binary payload, including ones containing non-ascii data, and making sure the right thing happens when the payload is later fetched/serialized. |
|||
| msg193454 - (view) | Author: Vajrasky Kok (vajrasky) * | Date: 2013年07月21日 14:52 | |
Here is the patch for this ticket. David Murray, am I on the right path? If yes, I'll put more robust tests, such as the ones with Asian encodings and unusual encodings. |
|||
| msg193455 - (view) | Author: Vajrasky Kok (vajrasky) * | Date: 2013年07月21日 14:55 | |
Sorry, got typo for the last patch. |
|||
| msg193456 - (view) | Author: R. David Murray (r.david.murray) * (Python committer) | Date: 2013年07月21日 15:38 | |
It looks like you are still patching get_payload. This should be a really simple patch against set_payload. It occurs to me that there could be a backward compatibility concern if passing binary to set_payload currently actually works in some cases, so we definitely needs a bunch of test that do that to make sure they all fail before we fix the bug :) |
|||
| msg193490 - (view) | Author: Vajrasky Kok (vajrasky) * | Date: 2013年07月22日 03:13 | |
"It looks like you are still patching get_payload. This should be a really simple patch against set_payload." Okay, do I get it right at this time? About your second point, I need more time to think about it. |
|||
| msg193493 - (view) | Author: R. David Murray (r.david.murray) * (Python committer) | Date: 2013年07月22日 03:48 | |
Yes, that's what I had in mind. |
|||
| msg193771 - (view) | Author: Vajrasky Kok (vajrasky) * | Date: 2013年07月27日 05:09 | |
Here is the third version of the patch. I am not sure what to do with the invalid data for base64 and uuencode. I decided to raise exception instead of converting it to None silently. |
|||
| msg195850 - (view) | Author: Roundup Robot (python-dev) (Python triager) | Date: 2013年08月22日 01:14 | |
New changeset 64e004737837 by R David Murray in branch '3.3': #18324: set_payload now correctly handles binary input. http://hg.python.org/cpython/rev/64e004737837 New changeset a4afcf93ef7b by R David Murray in branch 'default': Merge #18324: set_payload now correctly handles binary input. http://hg.python.org/cpython/rev/a4afcf93ef7b |
|||
| msg195853 - (view) | Author: R. David Murray (r.david.murray) * (Python committer) | Date: 2013年08月22日 01:18 | |
Thanks, Vajrasky. The v2 patch was almost correct. What you couldn't know without being as deeply enmeshed in this code as I am is that the test failures from the encoders module were actually invalid. We'd previously "fixed" them, but the fixes were incorrectly compensating for this bug in set_payload. Once this bug was fixed, those "fixes" just needed to be backed out, a 'decode=True' added to their get_payload calls, and all the tests pass. I *think* this is the last inconsistency in the model. I hope. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:57:47 | admin | set | github: 62524 |
| 2013年08月22日 01:18:56 | r.david.murray | set | status: open -> closed resolution: fixed messages: + msg195853 stage: test needed -> resolved |
| 2013年08月22日 01:14:28 | python-dev | set | nosy:
+ python-dev messages: + msg195850 |
| 2013年07月27日 05:09:09 | vajrasky | set | files:
+ set_payload_binary_v3.txt messages: + msg193771 |
| 2013年07月22日 03:48:19 | r.david.murray | set | messages: + msg193493 |
| 2013年07月22日 03:13:27 | vajrasky | set | files:
+ set_payload_binary_v2.txt messages: + msg193490 |
| 2013年07月21日 15:38:47 | r.david.murray | set | messages: + msg193456 |
| 2013年07月21日 14:55:27 | vajrasky | set | files:
+ set_payload_binary.txt messages: + msg193455 |
| 2013年07月21日 14:54:27 | vajrasky | set | files: - set_payload_binary.txt |
| 2013年07月21日 14:52:43 | vajrasky | set | files:
+ set_payload_binary.txt messages: + msg193454 |
| 2013年07月10日 16:42:01 | r.david.murray | set | messages: + msg192829 |
| 2013年07月10日 16:31:16 | vajrasky | set | messages: + msg192828 |
| 2013年07月10日 16:07:05 | r.david.murray | set | messages: + msg192826 |
| 2013年07月10日 15:58:19 | vajrasky | set | files:
+ set_payload_handles_binary_correctly.txt nosy: + vajrasky messages: + msg192823 |
| 2013年06月28日 19:16:22 | r.david.murray | create | |