Dangerous singleton in translation importers

Bug #264346 reported by Jeroen T. Vermeulen
10
Affects Status Importance Assigned to Milestone
Launchpad itself
Triaged
High
Unassigned

Bug Description

The translation importer in c.l.translationformat.translation_import defines which translation importers there are for which translation formats. This is done as a dict mapping each format to a singleton importer. Then, when an import process needs a format importer, it calls getTranslationFormatImporter() which returns the singleton importer for the given format.

AFAICS that means that a single TranslationFormatImporter can be used again and again for different files in the same process. That could lead to obscure bugs as information from one import may inadvertently be carried across to another.

A way around this is to turn the Singleton into a Prototype: instead of looking up the singleton and returning it, getTranslationFormatImporter() could look it up and create a new object of the same type. It would break if code relied on subsequent calls to getTranslationFormatImporter() returning the same object, but that would be a stranger thing to rely on than getting a fresh one every time.

Changed in rosetta:
importance: Undecided → Medium
status: New → Triaged
visibility: private → public
Changed in launchpad:
importance: Medium → High
Curtis Hovey (sinzui)
tags: added: tech-debt
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.