summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Pool <mbp@samba.org>2002-11-04 20:22:03 +0000
committerMartin Pool <mbp@samba.org>2002-11-04 20:22:03 +0000
commitc56f478ded33e58f2f5733d56e8ed27d7eb15e4b (patch)
tree001ba11fc3b1451a36d84d1f83888b02101e9cf2
parentdc847082f3d045e6d0352d2bb9b67002e60dcf4a (diff)
downloadsamba-c56f478ded33e58f2f5733d56e8ed27d7eb15e4b.tar.gz
samba-c56f478ded33e58f2f5733d56e8ed27d7eb15e4b.tar.bz2
samba-c56f478ded33e58f2f5733d56e8ed27d7eb15e4b.zip
pytdbpack_calc_reqd_len: Make exception be thrown correctly when a
non-string is used with a string format code. (It was being generated but not thrown.) Also call checked versions of some functions rather than FAST_* versions. (This used to be commit 1b681bd524764deaef657ef41c39d037ac7dcc7b)
-rw-r--r--source3/python/py_tdbpack.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/source3/python/py_tdbpack.c b/source3/python/py_tdbpack.c
index 06aebe61eb..95a74b00c6 100644
--- a/source3/python/py_tdbpack.c
+++ b/source3/python/py_tdbpack.c
@@ -293,7 +293,9 @@ pytdbpack_calc_reqd_len(char *format_str,
int val_i;
int val_len;
- val_len = PySequence_Fast_GET_SIZE(val_seq);
+ val_len = PySequence_Length(val_seq);
+ if (val_len == -1)
+ return -1;
for (p = format_str, val_i = 0; *p; p++, val_i++) {
char ch = *p;
@@ -307,7 +309,7 @@ pytdbpack_calc_reqd_len(char *format_str,
}
/* borrow a reference to the item */
- val_obj = PySequence_Fast_GET_ITEM(val_seq, val_i);
+ val_obj = PySequence_GetItem(val_seq, val_i);
if (!val_obj)
return -1;
@@ -371,6 +373,7 @@ pytdbpack_calc_item_len(char ch,
/* nul-terminated 8-bit string */
if (!PyString_Check(val_obj)) {
pytdbpack_bad_type(ch, "String", val_obj);
+ return -1;
}
if (ch == 'B') {