Message153397
One potential problem with the simple approach to fixing this is that up until now, string.Formatter has been thread safe. Because all the formatting state was held in local variables and passed around as method arguments, there was no state on the instance object to protect.
Now, this only applies if you start using the new feature, but it should be noted in the documentation and What's New that you need to limit yourself to accessing each formatter instance from a single thread.
It's also enough for me to say "no, not in a maintenance release".
Adding two attributes also seems unnecessary, and the pre-increment looks strange. Why not:
In __init__:
auto_field_count = 0
Then as the auto numbering checking, something like:
auto_field_count = self.auto_field_count
if field_name:
if auto_field_count > 0:
# Can't switch auto -> manual
auto_field_count = -1
elif auto_field_count < 0:
# Can't switch manual -> auto
else:
field_name = str(auto_field_count)
self.auto_field_count += 1
(Alternatively, I'd ask the question: why do we prevent mixing manual numbering and explicit numbering anyway? It's not like it's ambiguous at all) |
|
Date |
User |
Action |
Args |
2012-02-15 09:01:50 | ncoghlan | set | recipients:
+ ncoghlan, terry.reedy, eric.smith, eric.araujo, meador.inge, Ramchandra Apte |
2012-02-15 09:01:50 | ncoghlan | set | messageid: <1329296510.11.0.246160124729.issue13598@psf.upfronthosting.co.za> |
2012-02-15 09:01:49 | ncoghlan | link | issue13598 messages |
2012-02-15 09:01:48 | ncoghlan | create | |
|