@@ -169,9 +169,13 @@ static int cxoSessionPool_init(cxoSessionPool *pool, PyObject *args,
169
169
NULL };
170
170
171
171
// parse arguments and keywords
172
- externalAuthObj = editionObj = NULL ;
172
+ usernameObj = passwordObj = dsnObj = editionObj = Py_None ;
173
+ externalAuthObj = NULL ;
173
174
threadedObj = eventsObj = homogeneousObj = passwordObj = NULL ;
174
175
connectionType = & cxoPyTypeConnection ;
176
+ minSessions = 1 ;
177
+ maxSessions = 2 ;
178
+ sessionIncrement = 1 ;
175
179
if (cxoUtils_initializeDPI () < 0 )
176
180
return -1 ;
177
181
if (dpiContext_initCommonCreateParams (cxoDpiContext , & dpiCommonParams ) < 0 )
@@ -181,11 +185,11 @@ static int cxoSessionPool_init(cxoSessionPool *pool, PyObject *args,
181
185
(uint32_t ) strlen (dpiCommonParams .driverName );
182
186
if (dpiContext_initPoolCreateParams (cxoDpiContext , & dpiCreateParams ) < 0 )
183
187
return cxoError_raiseAndReturnInt ();
184
- if (!PyArg_ParseTupleAndKeywords (args , keywordArgs , "OOOiii|OObOOOssO " ,
185
- keywordList , & usernameObj , & passwordObj , & dsnObj ,
186
- & minSessions , & maxSessions , & sessionIncrement , & connectionType ,
187
- & threadedObj , & dpiCreateParams .getMode , & eventsObj ,
188
- & homogeneousObj , & externalAuthObj , & dpiCommonParams .encoding ,
188
+ if (!PyArg_ParseTupleAndKeywords (args , keywordArgs , "|OOOiiiOObOOOssO " ,
189
+ keywordList , & usernameObj , & passwordObj , & dsnObj , & minSessions ,
190
+ & maxSessions , & sessionIncrement , & connectionType , & threadedObj ,
191
+ & dpiCreateParams .getMode , & eventsObj , & homogeneousObj ,
192
+ & externalAuthObj , & dpiCommonParams .encoding ,
189
193
& dpiCommonParams .nencoding , & editionObj ))
190
194
return -1 ;
191
195
if (!PyType_Check (connectionType )) {
@@ -228,18 +232,14 @@ static int cxoSessionPool_init(cxoSessionPool *pool, PyObject *args,
228
232
229
233
// populate parameters
230
234
encoding = cxoUtils_getAdjustedEncoding (dpiCommonParams .encoding );
231
- if (cxoBuffer_fromObject (& userNameBuffer , pool -> username , encoding ) < 0 )
232
- return -1 ;
233
- if (cxoBuffer_fromObject (& passwordBuffer , passwordObj , encoding ) < 0 ) {
234
- cxoBuffer_clear (& userNameBuffer );
235
- return -1 ;
236
- }
237
- if (cxoBuffer_fromObject (& dsnBuffer , pool -> dsn , encoding ) < 0 ) {
238
- cxoBuffer_clear (& userNameBuffer );
239
- cxoBuffer_clear (& passwordBuffer );
240
- return -1 ;
241
- }
242
- if (cxoBuffer_fromObject (& editionBuffer , editionObj , encoding ) < 0 ) {
235
+ cxoBuffer_init (& userNameBuffer );
236
+ cxoBuffer_init (& passwordBuffer );
237
+ cxoBuffer_init (& dsnBuffer );
238
+ cxoBuffer_init (& editionBuffer );
239
+ if (cxoBuffer_fromObject (& userNameBuffer , usernameObj , encoding ) < 0 ||
240
+ cxoBuffer_fromObject (& passwordBuffer , passwordObj , encoding ) < 0 ||
241
+ cxoBuffer_fromObject (& dsnBuffer , dsnObj , encoding ) < 0 ||
242
+ cxoBuffer_fromObject (& editionBuffer , editionObj , encoding ) < 0 ) {
243
243
cxoBuffer_clear (& userNameBuffer );
244
244
cxoBuffer_clear (& passwordBuffer );
245
245
cxoBuffer_clear (& dsnBuffer );
0 commit comments