Issue 5664: 2to3 wont convert Cookie.Cookie properly (original) (raw)
Issue5664
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/49914
classification
Title: | 2to3 wont convert Cookie.Cookie properly | ||
---|---|---|---|
Type: | behavior | Stage: | resolved |
Components: | 2to3 (2.x to 3.x conversion tool) | Versions: | Python 3.4 |
process
Status: | closed | Resolution: | wont fix |
---|---|---|---|
Dependencies: | Superseder: | Close 2to3 issues and list them here View:45544 | |
Assigned To: | benjamin.peterson | Nosy List: | aldwinaldwin, benjamin.peterson, meador.inge, orsenthil |
Priority: | normal | Keywords: | patch |
Created on 2009-04-02 03:22 by orsenthil, last changed 2022-04-11 14:56 by admin. This issue is now closed.
Pull Requests | |||
---|---|---|---|
URL | Status | Linked | Edit |
PR 15268 | closed | aldwinaldwin,2019-08-14 07:30 |
Messages (5) | ||
---|---|---|
msg85151 - (view) | Author: Senthil Kumaran (orsenthil) * ![]() |
Date: 2009-04-02 03:22 |
In 2.7 code have: import Cookie c = Cookie.Cookie('abc') 2to3 would do: c = http.cookies.Cookie('abc') This is wrong as there is no class as Cookie in http.cookies. It should translated to be http.cookies.SimpleCookie. | ||
msg85264 - (view) | Author: Benjamin Peterson (benjamin.peterson) * ![]() |
Date: 2009-04-02 20:31 |
2009/4/1 Senthil <report@bugs.python.org>: > > New submission from Senthil <orsenthil@gmail.com>: > > In 2.7 code have: > import Cookie > c = Cookie.Cookie('abc') > > 2to3 would do: > c = http.cookies.Cookie('abc') > > This is wrong as there is no class as Cookie in http.cookies. It should > translated to be http.cookies.SimpleCookie. That's unfortunate. I suppose a new custom fixer will have to be written for Cookie now. | ||
msg98615 - (view) | Author: Meador Inge (meador.inge) * ![]() |
Date: 2010-01-31 14:59 |
There is already a fixer for this in 'Lib/lib2to3/fixes/fix_imports.py'. It was merged to the trunk in r64286. | ||
msg190054 - (view) | Author: Mark Lawrence (BreamoreBoy) * | Date: 2013-05-26 03:36 |
I'm assuming is correct so this can be closed. | ||
msg190175 - (view) | Author: Senthil Kumaran (orsenthil) * ![]() |
Date: 2013-05-28 05:39 |
Not actually, It is still translating to http.cookies.Cookie - which does not exist. $ ./cpythonvenv/bin/2to3-3.4 bug-fixes/test1.py RefactoringTool: Refactored bug-fixes/test1.py --- bug-fixes/test1.py (original) +++ bug-fixes/test1.py (refactored) @@ -1,2 +1,2 @@ -import Cookie -c = Cookie.Cookie('abc') +import http.cookies +c = http.cookies.Cookie('abc') BTW, Cookie.Cookie is a deprecated interface so there is a possibility that only small portion of the real world code which has not updated their Python stdlib idioms since (Python 2.2/Python2.4?) would see this bug manifested. [Note: Long-time users of Cookie.py will remember using Cookie.Cookie() to create an Cookie object. Although deprecated, it is still supported by the code. See the Backward Compatibility notes for more information.] |
History | |||
---|---|---|---|
Date | User | Action | Args |
2022-04-11 14:56:47 | admin | set | github: 49914 |
2021-10-20 22:57:25 | iritkatriel | set | status: open -> closedsuperseder: Close 2to3 issues and list them hereresolution: wont fixstage: patch review -> resolved |
2019-08-14 07:33:17 | aldwinaldwin | set | nosy: + aldwinaldwin |
2019-08-14 07:30:48 | aldwinaldwin | set | keywords: + patchstage: patch reviewpull_requests: + <pull%5Frequest14990> |
2014-02-03 17:09:51 | BreamoreBoy | set | nosy: - BreamoreBoy |
2013-05-28 05:39:54 | orsenthil | set | messages: + versions: + Python 3.4, - Python 3.1 |
2013-05-26 03:36:35 | BreamoreBoy | set | nosy: + BreamoreBoymessages: + |
2010-01-31 14:59:21 | meador.inge | set | nosy: + meador.ingemessages: + |
2009-04-02 20:31:30 | benjamin.peterson | set | messages: + |
2009-04-02 03:22:47 | orsenthil | create |