Menu

#25 Copy converters when connection created

MySQLdb
closed
MySQLdb (53)
5
2012-09-19
2005-04-22
No

When the internal converters dictionary in MySQLdb is
used a copy of the dictionary is used. When an
external dictionary is passed upon connection creation,
a copy is not made.

This patch makes a copy of an the external dictionary
when the connection is created. This prevents
premature garbage collection of objects that are weakly
referenced in the MySQLdb code.

Patch was created with:

diff -ur MySQL-python-1.2.0 MySQL-python-1.2.0_hacked/ > \ copy_incoming_converters.patch

Should be able to apply it with patch -p1 <
copy_incoming_converters.patch

Hopefully this patch will help others not encounter the
same problem that we did - we made a copy of the
MySQLdb converters dictionary, modified it and then
passed it into every new connection - with intermittent
problems that has taken us about 6 months to track down.

Hope this helps,

Jerry Seutter
jseutter@gmail.com

Discussion

  • Jerry Seutter

    Jerry Seutter - 2005-04-22

    Patch to make a copy of the converter dictionary passed into connection constructor.

     
  • Andy Dustman

    Andy Dustman - 2005-04-30

    Logged In: YES
    user_id=71372

    Your patch, or a variation, has been applied to the current CVS tree.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.