Issue145

Title Classes with Python3 prepared dictionaries are not immediately written to
Priority bug Status deferred
Superseder Nosy List kayhayen
Assigned To kayhayen Keywords wrong_execution

Created on 2014-08-16.10:03:12 by kayhayen, last changed by kayhayen.

Messages
msg759 (view) Author: kayhayen Date: 2014-08-16.10:03:12
In Python3, a metaclass can provide a "dict" type that behaves differently, e.g. an ordered 
dict.

However, current Nuitka writes to that class dictionary only at the end, loosing order or 
duplicate writes to that dictionary. It therefore fails to recognize this:

from enum import Enum
class Color(Enum):
    red = 1
    green = 2
    blue = 3
    red = 4

The solution would be to have less efficient writing to the class dictionary, immediate and 
each time. Also for reading, which the dictionary may also observe.

This is different from "exec" style locals dictionaries of Python2, with which classes in 
Python2 and Python3 currently share code.

The really correct thing, will be a re-formulation of class bodies to writes to dictionary 
elements, i.e.

def make_Color_dict(prepared_dict):
    prepared_dict["red"] = 1
    prepared_dict["green"] = 2
    prepared_dict["blue"] = 3
    prepared_dict["red"] = 4

This re-forumation would then potentially be subject to optimizations.

Practically this issue is not yet fully relevant, and there is no optimization applied
to dictionary buildings, so this would drop speed a lot.

But for full Python3 support, this will be needed.
History
Date User Action Args
2014-08-16 10:03:12kayhayencreate