[QUESTION] Return class instance, but the class function get the wrong data
Open
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 18k
- Forks
- 2.3k
- Avg merge
- 5d 17h
- Merged PRs (30d)
- 10
Description
def atest():
my_BTD = py_cc.BTD(Nd, Np, sizebw, type) # construct a c++ class
a = my_BTD.get_array() # this function get right data
b = btest(my_BTD) # this will get the right data
# a is same with b
print(a)
print(b)
return my_BTD
a = atest()
c = a.get_array() #this functtion get wrong data, sometimes get wrong data, sometime get right data
print(c)
def btest(BTD):
b = BTD.get_array() # this function get right data
who can tell me why??? thanks a lot!
EDIT (@YannickJadoul): surround code with ```
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the atest and btest examples in the issue and reproduce the differing get_array() results after returning BTD. Inspect the BTD binding and get_array entry points, which are not included here; done requires a minimal reproducible case and an identified explanation or regression test for the inconsistent returned data.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, python
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 18/100