Issue 1680015: slots tuple modified inplace if it contains unicode name (original) (raw)
Issue1680015
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.
This issue has been migrated to GitHub: https://github.com/python/cpython/issues/44709
classification
Title: | __slots__ tuple modified inplace if it contains unicode name | ||
---|---|---|---|
Type: | Stage: | ||
Components: | Interpreter Core | Versions: | Python 2.5 |
process
Status: | closed | Resolution: | accepted |
---|---|---|---|
Dependencies: | Superseder: | ||
Assigned To: | zseil | Nosy List: | georg.brandl, zseil |
Priority: | normal | Keywords: | patch |
Created on 2007-03-13 16:44 by zseil, last changed 2022-04-11 14:56 by admin. This issue is now closed.
Files | |||
---|---|---|---|
File name | Uploaded | Description | Edit |
unicode_slots.diff | zseil,2007-03-13 16:44 | patch against trunk revision 54335 |
Messages (3) | ||
---|---|---|
msg52191 - (view) | Author: Ziga Seilnacht (zseil) * ![]() |
Date: 2007-03-13 16:44 |
Function _unicode_to_string() in typeobject.c tries to copy the original tuple by asking for a complete slice of the original tuple. This case is special cased in tupleslice() to only incref the original tuple. As a consequence, the user's tuple could be modified (see the test). There are also some reference leaks if an unicode name can't be encoded with the default codec. The patch fixes this and adds tests for both cases. I also moved a comment about possible leaks to the appropriate place. | ||
msg52192 - (view) | Author: Georg Brandl (georg.brandl) * ![]() |
Date: 2007-03-13 17:57 |
Perhaps moving the "leak" comment into the if block isn't such a good idea. Ah, and while you're at it, you could improve the variable names ("o" and "o1" is not very useful :) Otherwise the patch looks fine, I'd say you can apply it then. | ||
msg52193 - (view) | Author: Ziga Seilnacht (zseil) * ![]() |
Date: 2007-03-14 12:38 |
I moved the comment back to its old place and renamed variables to "slot_name" and "new_name". Commited as revision 54378, 54379 (2.5). |
History | |||
---|---|---|---|
Date | User | Action | Args |
2022-04-11 14:56:23 | admin | set | github: 44709 |
2007-03-13 16:44:40 | zseil | create |