This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: List/Dict Combination Bug
Type: behavior Stage:
Components: Interpreter Core Versions: Python 3.3, Python 3.4, Python 2.7
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: Robert.w, SilentGhost, r.david.murray, rhettinger
Priority: normal Keywords:

Created on 2014-06-01 17:56 by Robert.w, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
bug.py Robert.w, 2014-06-01 17:56 Bug example
output.txt Robert.w, 2014-06-02 15:54
Messages (8)
msg219514 - (view) Author: Robert w (Robert.w) Date: 2014-06-01 17:56
outer for loop loops more than one time, which should be impossible.
msg219515 - (view) Author: SilentGhost (SilentGhost) * (Python triager) Date: 2014-06-01 18:04
Robert, could you please post a reduced code that generates the bug. Preferably, a interpreter output. Including information about your python version, OS, etc. For example:

Python 2.7.6 (default, Mar 22 2014, 22:59:56)
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> elements = [{'type': 2, 'data': {'elements': ['83H', '0FAH', '9AH', '27H', '81H', '49H', '0CEH', '11H']}}]
>>> for i in elements:
...  print(i)
...
{'data': {'elements': ['83H', '0FAH', '9AH', '27H', '81H', '49H', '0CEH', '11H']}, 'type': 2}

As you see from my example, I wasn't able to reproduce the issue you're reporting.
msg219518 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2014-06-01 19:02
Oh, this is the same code as in issue 21630 that you closed.  Since the loop is only executed once (as confirmed by adding a print), I suspect you have a bug in your expectations of the output :)
msg219532 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2014-06-01 22:55
I've traced through your code and it doing exactly what it is specified to be doing (meaning that Python itself seems to be behaving correctly).  Perhaps you wanted it to do something else, but that would be a bug in your own code.

Please use the Python bug tracker for actual bugs in Python, not as a place to figure-out what your own code is doing.  There are other forums that might be suitable (python-tutor, stackoverflow, etc).  Thank you.
msg219597 - (view) Author: Robert w (Robert.w) Date: 2014-06-02 15:54
banner
C:\Users\r0b3\files\backuped\own_dropbox\programmierung\raymarcher0>C:\Python33\python
Python 3.3.2 (v3.3.2:d047928ae3f6, May 16 2013, 00:06:53) [MSC v.1600 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.


C:\Users\r0b3\files\backuped\own_dropbox\programmierung\raymarcher0>C:\Python33\python bug.py
bug.py:45: SyntaxWarning: assertion is always true, perhaps remove parentheses?
  assert(False, "Should be unreachable!")



{'data': {'elements': ['83H', '0FAH', '9AH', '27H', '81H', '49H', '0CEH', '11H']}, 'type': 2}INSIDE
False
False
True



{'data': {'elements': ['83H', '0FAH', '9AH', '27H', '81H', '49H', '0CEH', '11H']}, 'type': 2}INSIDE
False
False
True
db


{'data': {'elements': ['83H', '0FAH', '9AH', '27H', '81H', '49H', '0CEH', '11H']}, 'type': 2}INSIDE
False
False
True

(and so on, some lines with the expected output, see the attached file)


Either im totaly nuts and do *something* wrong, or it is a very weird bug...
Im _not_ some random noob from the inet who doesn't know what a bugtracker is.

---
Seems to be a weird memory issue.

---

I closed the first version of the issue because i was confused between the words "issue" and "summaries" because issues...are bugs...
msg219600 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2014-06-02 16:06
You may not be a noob, but on the other hand we can't see the bug.  So your best bet would be to post your code to the python-list mailing list and ask for help refining your bug report into something we can take action on.
msg219603 - (view) Author: Robert w (Robert.w) Date: 2014-06-02 16:28
i cutted it down

=====
class EnumSectionContentType(object):
    DATABYTE = 2
    DATADOUBLEWORD = 3
    DATAWORD = 4
#LABEL = 0

def _getStringOfElements(elements):
    objectFileString = ""

    elements = [{'type': 2, 'data': {'elements': ['83H', '0FAH', '9AH', '27H', '81H', '49H', '0CEH', '11H']}}]

    for iterationElement in elements:
        objectFileString += "INSIDE1 "
        
        if iterationElement["type"] == EnumSectionContentType.LABEL:
            objectFileString +=  iterationElement["data"]["labelname"] + ":" + "\n"
        elif iterationElement["type"] == EnumSectionContentType.DATABYTE:
            objectFileString += "INSIDE" + "\n"

            if   iterationElement["type"] == EnumSectionContentType.DATADOUBLEWORD:
                objectFileString += objectFileString + "dd "
            elif iterationElement["type"] == EnumSectionContentType.DATABYTE:
                objectFileString += objectFileString + "db "

    return objectFileString

print(_getStringOfElements(None))
=====

I don't expect any output, I expect a exception (because LABEL is not defined)

but hell no...
i get
-----
C:\Users\r0b3\Downloads>C:\Python34\python bug.py
INSIDE1 INSIDE
INSIDE1 INSIDE
db
-----
C:\Users\r0b3\Downloads>C:\Python34\python
Python 3.4.1 (v3.4.1:c0e311e010fc, May 18 2014, 10:38:22) [MSC v.1600 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
msg219606 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2014-06-02 17:17
I get an exception.  I think you need to be more careful with your testing.  Please take this to python-list for further help.
History
Date User Action Args
2022-04-11 14:58:04adminsetgithub: 65830
2014-06-02 17:17:01r.david.murraysetmessages: + msg219606
2014-06-02 16:28:39Robert.wsetmessages: + msg219603
2014-06-02 16:06:30r.david.murraysetmessages: + msg219600
2014-06-02 16:03:23Robert.wsetversions: + Python 3.4
2014-06-02 15:54:18Robert.wsetfiles: + output.txt

messages: + msg219597
2014-06-01 22:55:44rhettingersetstatus: open -> closed

nosy: + rhettinger
messages: + msg219532

resolution: not a bug
2014-06-01 19:02:31r.david.murraysetnosy: + r.david.murray
messages: + msg219518
2014-06-01 18:04:25SilentGhostsetnosy: + SilentGhost
messages: + msg219515
2014-06-01 17:56:46Robert.wcreate