Skip to content

Commit

Permalink
fix missing null return
Browse files Browse the repository at this point in the history
  • Loading branch information
cleoold committed Mar 1, 2020
1 parent 3733112 commit 732aa14
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lvbdist/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = "1.0.1"
__version__ = "1.0.2"

from ._lvbdist import cmax_times as _cmax_times
from ._lvbdist import chave_success_given_no_successes_before as _chave_success_given_no_successes_before
Expand Down
10 changes: 8 additions & 2 deletions lvbdist/lvbdist_back.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,19 @@ LVBDIST_PROVIDE(have_m_successes_within_n_attempts_E) {

LVBDIST_PROVIDE(have_special_success_within_n_attempts) {
LVBDIST_SCAN_ARG_AND_DECLARE("id", int n;probability p, &n, &p);
if (p <= 0 || p >= 1) PyErr_SetString(PyExc_ValueError, "Invalid probability");
if (p <= 0 || p >= 1) {
PyErr_SetString(PyExc_ValueError, "Invalid probability");
return NULL;
}
LVBDIST_RETURN(have_special_success_within_n_attempts, n, p);
}

LVBDIST_PROVIDE(have_special_success_within_n_attempts_E) {
LVBDIST_SCAN_ARG_AND_DECLARE("d", probability p, &p);
if (p <= 0 || p >= 1) PyErr_SetString(PyExc_ValueError, "Invalid probability");
if (p <= 0 || p >= 1) {
PyErr_SetString(PyExc_ValueError, "Invalid probability");
return NULL;
}
LVBDIST_RETURN(have_special_success_within_n_attempts_E, p);
}

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def main():
)

setup(name="linearly-varying-binomial-distribution",
version="1.0.1",
version="1.0.2",
description="computes ununiform step-increasing probability problems",
long_description=long_description,
long_description_content_type="text/markdown",
Expand Down

0 comments on commit 732aa14

Please sign in to comment.