Skip to content

Conversation

@maflcko
Copy link
Member

@maflcko maflcko commented Sep 19, 2019

Bug introduced by me (:man_facepalming:) in fa25668

For reference:

>>> a = [[]]*2
>>> a[0] += ['ONE']
>>> a
[['ONE'], ['ONE']]


>>> a = [[] for _ in range(2)]
>>> a[0] += ['ONE']
>>> a
[['ONE'], []]

@fanquake fanquake added the Tests label Sep 19, 2019
@theStack
Copy link
Contributor

utACK fa2e038

Another way to show what's going on here, the first variant obviously creates two list elements pointing to the same object:

>>> a = [[]]*2
>>> id(a[0]) == id(a[1])
True
>>> a = [[] for _ in range(2)]
>>> id(a[0]) == id(a[1])
False

maflcko pushed a commit that referenced this pull request Sep 20, 2019
fa2e038 test: Fix extra_args in wallet_import_rescan.py (MarcoFalke)

Pull request description:

  Bug introduced by me (:man_facepalming:) in fa25668

  For reference:

  ```
  >>> a = [[]]*2
  >>> a[0] += ['ONE']
  >>> a
  [['ONE'], ['ONE']]

  >>> a = [[] for _ in range(2)]
  >>> a[0] += ['ONE']
  >>> a
  [['ONE'], []]

ACKs for top commit:
  theStack:
    utACK fa2e038

Tree-SHA512: 7d75a0d06233d013d62198ea95793612242254d5d90f393d01b2beef5abc78d6e85c796532311638f16cfed3b66a7ae41a108c0fe6f0f5d7f6616b042c670df7
@maflcko maflcko merged commit fa2e038 into bitcoin:master Sep 20, 2019
@maflcko maflcko deleted the 1909-testUseCorrectPythonSyntax branch September 20, 2019 12:24
jasonbcox pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request Oct 22, 2020
Summary:
The initial commit added tests that are not relevant for us,
but also did some minor refactoring that could add more robustness
if the tests evolve in the future (remember `extra_args` in
`setup_network` in nodes are restarted).

The initial commit introduced a bug later fixed in [[bitcoin/bitcoin#16920 | PR16920]].
This fix taken into accound here.

This concludes backport of Core [[bitcoin/bitcoin#16465 | PR16465]] - part 3 of 3
Commit bitcoin/bitcoin@fa25668
Depends on D8055

Test Plan: `ninja && test/functional/test_runner.py wallet_import_rescan.py`

Reviewers: O1 Bitcoin ABC, #bitcoin_abc, deadalnix

Reviewed By: O1 Bitcoin ABC, #bitcoin_abc, deadalnix

Differential Revision: https://reviews.bitcoinabc.org/D8056
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Dec 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants