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 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) * (Python committer) | 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) * (Python committer) | 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) * (Python committer) | 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 msg98615 is correct so this can be closed. |
|||
| msg190175 - (view) | Author: Senthil Kumaran (orsenthil) * (Python committer) | 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 -> closed superseder: Close 2to3 issues and list them here resolution: wont fix stage: patch review -> resolved |
| 2019年08月14日 07:33:17 | aldwinaldwin | set | nosy:
+ aldwinaldwin |
| 2019年08月14日 07:30:48 | aldwinaldwin | set | keywords:
+ patch stage: patch review pull_requests: + pull_request14990 |
| 2014年02月03日 17:09:51 | BreamoreBoy | set | nosy:
- BreamoreBoy |
| 2013年05月28日 05:39:54 | orsenthil | set | messages:
+ msg190175 versions: + Python 3.4, - Python 3.1 |
| 2013年05月26日 03:36:35 | BreamoreBoy | set | nosy:
+ BreamoreBoy messages: + msg190054 |
| 2010年01月31日 14:59:21 | meador.inge | set | nosy:
+ meador.inge messages: + msg98615 |
| 2009年04月02日 20:31:30 | benjamin.peterson | set | messages: + msg85264 |
| 2009年04月02日 03:22:47 | orsenthil | create | |