[Python-checkins] r54074 - sandbox/trunk/pep3101/test_simpleformat.py sandbox/trunk/pep3101/unicodeformat.c
patrick.maupin
python-checkins at python.org
Fri Mar 2 03:03:19 CET 2007
Author: patrick.maupin
Date: Fri Mar 2 03:03:11 2007
New Revision: 54074
Modified:
sandbox/trunk/pep3101/test_simpleformat.py
sandbox/trunk/pep3101/unicodeformat.c
Log:
Disallow leading underscores by default, fix _flags and tests
Modified: sandbox/trunk/pep3101/test_simpleformat.py
==============================================================================
--- sandbox/trunk/pep3101/test_simpleformat.py (original)
+++ sandbox/trunk/pep3101/test_simpleformat.py Fri Mar 2 03:03:11 2007
@@ -57,10 +57,17 @@
if name == "five": return 5
raise TypeError("Never do this")
self.formatEquals(
- "Count with me; 1 2 4",
+ "Count with me; 1 4",
+ "Count with me; {0.one} {1.four4}",
+ Container, Container, item=Container)
+ self.formatRaises(ValueError,
"Count with me; {0.one} {item._two} {1.four4}",
Container, Container, item=Container)
self.formatEquals(
+ "Count with me; 1 2 4",
+ "Count with me; {0.one} {item._two} {1.four4}",
+ Container, Container, item=Container, _flags=dict(allow_leading_under=1))
+ self.formatEquals(
"Five is 5", "Five is {c.five}", c=Container())
self.formatRaises(AttributeError,
"Missing {0.rabbit} lookup", Container)
Modified: sandbox/trunk/pep3101/unicodeformat.c
==============================================================================
--- sandbox/trunk/pep3101/unicodeformat.c (original)
+++ sandbox/trunk/pep3101/unicodeformat.c Fri Mar 2 03:03:11 2007
@@ -1097,7 +1097,7 @@
PyObject *flags, *myobj;
fs->max_recursion = 4;
- fs->allow_leading_under = 1; /* XXX- SHould set to 0, but breaks */
+ fs->allow_leading_under = 0;
fs->positional_arg_set = 0;
fs->keyword_arg_set = NULL;
fs->keywords_is_tuple = 0;
@@ -1107,7 +1107,7 @@
if (keywords == NULL)
return 1;
- flags = PyDict_GetItemString(keywords, "_dict");
+ flags = PyDict_GetItemString(keywords, "_flags");
if (flags == NULL)
return 1;
More information about the Python-checkins
mailing list