Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

max_iter = float('inf') looks wrong #36

Closed
kmike opened this issue Mar 6, 2013 · 1 comment
Closed

max_iter = float('inf') looks wrong #36

kmike opened this issue Mar 6, 2013 · 1 comment

Comments

@kmike
Copy link
Contributor

kmike commented Mar 6, 2013

it is used in memory_usage function like this:

    if timeout is not None:
        max_iter = int(timeout / interval)
    elif isinstance(proc, int):
        # external process and no timeout
        max_iter = 1
    else:
        # for a Python function wait until it finishes
        max_iter = float('inf') # <--------------------------

    if isinstance(proc, (list, tuple)):
        # ... (snip)
    else:
        # external process
        if proc == -1:
            proc = os.getpid()
        if max_iter == -1:
            max_iter = 1
        for _ in range(max_iter):   # <----------------
            ret.append(_get_memory(proc))
            time.sleep(interval)
    return ret

range(float('inf')) is an error, and max_iter is not used for anything else here.

@fabianp fabianp closed this as completed in 727a015 Mar 7, 2013
@fabianp
Copy link
Collaborator

fabianp commented Mar 7, 2013

Thanks Mikhail, should be fixed now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants