mirror of
https://github.com/samba-team/samba.git
synced 2025-02-01 05:47:28 +03:00
pytdbpack_pack_data: Allow first argument to be any kind of Number,
not just an Integer. Coerce appropriately. (This used to be commit 248067931a2a8eeee86ea343bddf96d2bd727dbf)
This commit is contained in:
parent
17356de921
commit
d7eac6c356
@ -661,14 +661,20 @@ pytdbpack_pack_data(const char *format_str,
|
||||
long size;
|
||||
char *sval;
|
||||
|
||||
if (!PyInt_Check(val_obj)) {
|
||||
pytdbpack_bad_type(ch, "Integer", val_obj);
|
||||
if (!PyNumber_Check(val_obj)) {
|
||||
pytdbpack_bad_type(ch, "Number", val_obj);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
size = PyInt_AsLong(val_obj);
|
||||
if (!(val_obj = PyNumber_Long(val_obj)))
|
||||
return NULL;
|
||||
|
||||
size = PyLong_AsLong(val_obj);
|
||||
pack_uint32(size, &packed);
|
||||
|
||||
/* Release the new reference created by the cast */
|
||||
Py_DECREF(val_obj);
|
||||
|
||||
val_obj = PySequence_GetItem(val_seq, val_i++);
|
||||
if (!val_obj)
|
||||
return NULL;
|
||||
|
Loading…
x
Reference in New Issue
Block a user