question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

BUG: Loadtxt should pass `checkref=False` to resize to avoid problems when tracing

See original GitHub issue

numpy version: 1.14.3 python version: 3.6.5

This was originally reported in https://github.com/Microsoft/ptvsd/issues/465 (error was on numpy.loadtxt, but the real issue lies in resize itself).

A sample to reproduce is:

import sys

def trace_dispatch(frame, event, arg):
    return trace_dispatch

sys.settrace(trace_dispatch)

def method():
    import numpy
    Y = numpy.array([1] * 10, numpy.float32)
    Y.resize([20, 20])

method()

When Y.resize() is reached, the following error is thrown:

ValueError: cannot resize an array that references or is referenced
by another array in this way.  Use the resize function.

So, it seems it’s that way by design, but this also means that by design, any function which calls array.resize is not traceable (which I don’t think is expected).

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
fabiozcommented, Jul 9, 2018

Seems a reasonable tradeoff to me (although if it’s really important, I’d say that it should be True when running numpy tests to make sure that some future contributor won’t add a new reference to the array by mistake inside numpy.loadtxt).

0reactions
mattipcommented, Jul 9, 2018

Fixed in #10737, which is part of the 1.15 release

refcheck=True in tests must be inside a if HAS_REFCOUNT block since refcheck=True will raise an exception on PyPy, it has no refcount semantics.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ValueError when debugging numpy app · Issue #465 - GitHub
As a note, any debugger which had tracing always on would fail consistently ... BUG: Loadtxt should pass checkref=False to resize to avoid...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found