Skip to content

Commit 56fce5b

Browse files
committed
Merge branch 'master' of https://github.com/rk700/PyMuPDF
2 parents b0ef72f + 0fd17d6 commit 56fce5b

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

fitz/fitz.i

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -893,29 +893,29 @@ struct Document
893893
%pythoncode%{@property%}
894894
PyObject *pageCount()
895895
{
896-
int pc = 0;
896+
PyObject *ret;
897897
fz_try(gctx) {
898-
pc = fz_count_pages(gctx, (fz_document *) $self);
898+
ret = Py_BuildValue("i", fz_count_pages(gctx, (fz_document *) $self));
899899
}
900900
fz_catch(gctx) {
901901
return NULL;
902902
}
903-
return Py_BuildValue("i", pc);
903+
return ret;
904904
}
905905
906906
FITZEXCEPTION(chapterCount, !result)
907907
CLOSECHECK0(chapterCount, """Number of chapters.""")
908908
%pythoncode%{@property%}
909909
PyObject *chapterCount()
910910
{
911-
int pc=0;
911+
PyObject *ret;
912912
fz_try(gctx) {
913-
pc = fz_count_chapters(gctx, (fz_document *) $self);
913+
ret = Py_BuildValue("i", fz_count_chapters(gctx, (fz_document *) $self));
914914
}
915915
fz_catch(gctx) {
916916
return NULL;
917917
}
918-
return Py_BuildValue("i", pc);
918+
return ret;
919919
}
920920
921921
FITZEXCEPTION(lastLocation, !result)
@@ -939,9 +939,9 @@ struct Document
939939
CLOSECHECK0(chapterPageCount, """Page count of chapter.""")
940940
PyObject *chapterPageCount(int chapter)
941941
{
942-
int chapters = fz_count_chapters(gctx, (fz_document *) $self);
943942
int pages = 0;
944943
fz_try(gctx) {
944+
int chapters = fz_count_chapters(gctx, (fz_document *) $self);
945945
if (chapter < 0 || chapter >= chapters)
946946
THROWMSG("bad chapter number");
947947
pages = fz_count_chapter_pages(gctx, (fz_document *) $self, chapter);

0 commit comments

Comments
 (0)