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.

classification
Title: Gettext cache and classes
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 3.1, Python 3.2, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: eric.araujo, lehmannro, lemburg, loewis, pitrou, rhettinger, v_peter
Priority: normal Keywords: patch

Created on 2010-06-21 13:23 by v_peter, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
class_cache.diff v_peter, 2010-06-21 23:17
class_cache2.diff v_peter, 2010-09-02 15:02
Messages (15)
msg108270 - (view) Author: (v_peter) Date: 2010-06-21 13:23
If you pass gettext.translation a class_ but the mo file you are trying to open already exists in the _translations cache the instance that is returned is an instance of whatever was in the cache and not the class that you requested.

I think that if a class is requested it should return that class. If others agree then I'd be happy to work on a patch.
msg108281 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2010-06-21 16:10
Thanks for your report. Unfortunately, 2.6 and 3.1 are stable releases, they only get security and documentation fixes. 2.7 is nearly in the same state, since it’s at the release candidate stage. If your bug still applies to 3.2 (branch named “py3k”), please propose a patch. I have added the maintainer of the gettext module and another developer expert in i18n to the nosy list (they are listed in Misc/maintainers.rst). Thanks again!
msg115317 - (view) Author: (v_peter) Date: 2010-09-01 15:47
Any comments on the patch for 3.2?
msg115338 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2010-09-01 22:01
Relying on str(cls) breaks if two classes have the same name, but I guess this is not a concern outside of the interactive interpreter. Patch looks good to me.
msg115341 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2010-09-01 23:14
The patch looks fine.
msg115373 - (view) Author: Robert Lehmann (lehmannro) * Date: 2010-09-02 13:52
Wouldn't constructing the key as a tuple of (class_, mofile) be much cleaner than making up an artificial key?
msg115374 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2010-09-02 13:54
This would avoid the issue with different classes having the same name, but otherwise would not make that much of a difference.
msg115383 - (view) Author: (v_peter) Date: 2010-09-02 15:02
Here's a second patch with 

key = (class_, os.path.abspath(mofile)))
msg115823 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2010-09-07 23:31
Looks good. Another +1 from a core dev and I commit this.
msg116198 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2010-09-12 14:12
+1
msg116200 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2010-09-12 14:18
> Unfortunately, 2.6 and 3.1 are stable releases, they only get security > and documentation fixes. 2.7 is nearly in the same state

Well, that's false. 2.7 and 3.1 both receive bug fixes (and this looks like a bug to me :-)).
msg117733 - (view) Author: (v_peter) Date: 2010-09-30 13:35
Which branches should i make patches for then? release27-maint and release31-maint?
msg117756 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2010-09-30 18:29
Antoine: Thanks for the correction.  I was mistaken about versions some months ago and wrote such misleading comments in a handful of bugs.  It has been corrected in some of them but not all.

v_peter: You don’t have to do anything, it’s the job of the committer to do the backport.  We use a tool (svnmerge) for that, so additional patches wouldn’t help.  If a backport is difficult, for example because of bytes/characters issues in 2.x, the committer may ask for help or feedback.

Sorry for the delay, I’ve been rather taken by the start of year and other bugs.  Be sure your fix will be in the next releases for all three branches.
msg117757 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2010-09-30 18:31
(I’m not sure my last line is unambiguous.  I meant : Don’t worry, this will get in shortly.)
msg117989 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2010-10-05 00:01
Committed in r85223, r85224, r85225 (resp. 3.2, 3.1, 2.7).  Thanks again!
History
Date User Action Args
2022-04-11 14:57:02adminsetgithub: 53288
2010-10-05 00:01:26eric.araujosetstatus: open -> closed
resolution: accepted -> fixed
messages: + msg117989

stage: patch review -> resolved
2010-09-30 18:31:12eric.araujosetstatus: pending -> open

messages: + msg117757
2010-09-30 18:29:36eric.araujosetstatus: open -> pending

messages: + msg117756
2010-09-30 13:35:08v_petersetmessages: + msg117733
2010-09-12 14:18:48pitrousetnosy: + pitrou

messages: + msg116200
versions: + Python 3.1, Python 2.7
2010-09-12 14:12:07loewissetmessages: + msg116198
2010-09-07 23:31:43eric.araujosetmessages: + msg115823
2010-09-02 15:02:04v_petersetfiles: + class_cache2.diff

messages: + msg115383
2010-09-02 13:54:41eric.araujosetmessages: + msg115374
2010-09-02 13:52:59lehmannrosetnosy: + lehmannro
messages: + msg115373
2010-09-01 23:14:08rhettingersetresolution: accepted

messages: + msg115341
nosy: + rhettinger
2010-09-01 22:01:27eric.araujosetmessages: + msg115338
stage: patch review
2010-09-01 15:47:50v_petersetmessages: + msg115317
2010-06-21 23:17:52v_petersetfiles: + class_cache.diff
keywords: + patch
versions: + Python 3.2, - Python 2.6
2010-06-21 16:10:23eric.araujosetnosy: + loewis, eric.araujo, lemburg
type: behavior
messages: + msg108281
2010-06-21 13:23:38v_petercreate