Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
9bfe533c
Commit
9bfe533c
authored
Aug 27, 2003
by
Raymond Hettinger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SF bug #795506: Wrong handling of string format code for float values.
Adding missing support for '%F'. Will backport to 2.3.1.
parent
063606a0
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
10 additions
and
0 deletions
+10
-0
Lib/test/string_tests.py
Lib/test/string_tests.py
+1
-0
Misc/NEWS
Misc/NEWS
+3
-0
Objects/stringobject.c
Objects/stringobject.c
+3
-0
Objects/unicodeobject.c
Objects/unicodeobject.c
+3
-0
No files found.
Lib/test/string_tests.py
View file @
9bfe533c
...
...
@@ -550,6 +550,7 @@ class MixinStrUnicodeUserStringTest:
self
.
checkequal
(
' 42'
,
'%3ld'
,
'__mod__'
,
42
)
self
.
checkequal
(
'0042.00'
,
'%07.2f'
,
'__mod__'
,
42
)
self
.
checkequal
(
'0042.00'
,
'%07.2F'
,
'__mod__'
,
42
)
self
.
checkraises
(
TypeError
,
'abc'
,
'__mod__'
)
self
.
checkraises
(
TypeError
,
'%(foo)s'
,
'__mod__'
,
42
)
...
...
Misc/NEWS
View file @
9bfe533c
...
...
@@ -12,6 +12,9 @@ What's New in Python 2.4 alpha 1?
Core and builtins
-----------------
- The % formatting operator now supports '
%
F
' which is equivalent to
'
%
f
'. This has always been documented but never implemented.
- complex(obj) could leak a little memory if obj wasn'
t
a
string
or
number
.
...
...
Objects/stringobject.c
View file @
9bfe533c
...
...
@@ -3921,8 +3921,11 @@ PyString_Format(PyObject *format, PyObject *args)
case
'e'
:
case
'E'
:
case
'f'
:
case
'F'
:
case
'g'
:
case
'G'
:
if
(
c
==
'F'
)
c
=
'f'
;
pbuf
=
formatbuf
;
len
=
formatfloat
(
pbuf
,
sizeof
(
formatbuf
),
flags
,
prec
,
c
,
v
);
...
...
Objects/unicodeobject.c
View file @
9bfe533c
...
...
@@ -6540,8 +6540,11 @@ PyObject *PyUnicode_Format(PyObject *format,
case
'e'
:
case
'E'
:
case
'f'
:
case
'F'
:
case
'g'
:
case
'G'
:
if
(
c
==
'F'
)
c
=
'f'
;
pbuf
=
formatbuf
;
len
=
formatfloat
(
pbuf
,
sizeof
(
formatbuf
)
/
sizeof
(
Py_UNICODE
),
flags
,
prec
,
c
,
v
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment