Jeroen Demeyer schrieb am 05.09.2015 um 12:17: > I noticed that now unsigned constants like > > DEF foo = 1 > > become 1U in the C source code. > > This change (i.e. commit ea6414cd293ba2134c3df5b37b158d8e3db79083) broke > Sage. I haven't managed yet to actually isolate why this change broke > something. > > Was this change of 1 to 1U intentional? Why was it done?
Pretty much intentional, yes. I changed it in response to this bug report: http://thread.gmane.org/gmane.comp.python.cython.devel/15774 The problem with DEF constants is that they are Python values that use Python semantics in expressions before they eventually get converted back into literals and inserted into the AST. Specifically, they loose any literals semantics that they initially had in the source code, including any information about literal C integer types that contributed to their value, as in this case. Thus, there isn't really a 'correct' way to write them out as literals and C might be happy with what we output, or not. I guess it might be better to undo this part of the change. Unsigned literals are usually not the right way to do it in C, definitely not for everything. We could then maybe apply the usual 32/64 bits heuristic to add at least L/LL suffixes at need. Stefan _______________________________________________ cython-devel mailing list cython-devel@python.org https://mail.python.org/mailman/listinfo/cython-devel