Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 29b884d

Browse filesBrowse files
author
kylev
committed
Defer adding references until after all our C calls so we can avoid having
to decrement them if we bail out early. Fixes bug 2811033.
1 parent fcbf7c9 commit 29b884d
Copy full SHA for 29b884d

File tree

Expand file treeCollapse file tree

1 file changed

+12
-11
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+12
-11
lines changed

‎MySQLdb/_mysql.c

Copy file name to clipboardExpand all lines: MySQLdb/_mysql.c
+12-11Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -514,20 +514,10 @@ _mysql_ConnectionObject_Initialize(
514514
))
515515
return -1;
516516

517-
if (!conv)
518-
conv = PyDict_New();
519-
#if PY_VERSION_HEX > 0x02000100
520-
else
521-
Py_INCREF(conv);
522-
#endif
523-
if (!conv)
524-
return -1;
525-
self->converter = conv;
526-
527517
#define _stringsuck(d,t,s) {t=PyMapping_GetItemString(s,#d);\
528518
if(t){d=PyString_AsString(t);Py_DECREF(t);}\
529519
PyErr_Clear();}
530-
520+
531521
if (ssl) {
532522
#if HAVE_OPENSSL
533523
PyObject *value = NULL;
@@ -581,6 +571,17 @@ _mysql_ConnectionObject_Initialize(
581571
_mysql_Exception(self);
582572
return -1;
583573
}
574+
575+
/* Internal references to python-land objects */
576+
if (!conv)
577+
conv = PyDict_New();
578+
else
579+
Py_INCREF(conv);
580+
581+
if (!conv)
582+
return -1;
583+
self->converter = conv;
584+
584585
/*
585586
PyType_GenericAlloc() automatically sets up GC allocation and
586587
tracking for GC objects, at least in 2.2.1, so it does not need to

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.