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
891ca9e0
Commit
891ca9e0
authored
May 29, 2013
by
Stefan Krah
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Backport bff16086f03b and bcaaaa00425b.
parent
6edda14b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
5 deletions
+18
-5
Lib/test/test_decimal.py
Lib/test/test_decimal.py
+13
-0
Modules/_decimal/_decimal.c
Modules/_decimal/_decimal.c
+5
-5
No files found.
Lib/test/test_decimal.py
View file @
891ca9e0
...
...
@@ -5373,6 +5373,19 @@ class CWhitebox(unittest.TestCase):
x
=
(
1
,
(
0
,
1
),
"N"
)
self
.
assertEqual
(
str
(
Decimal
(
x
)),
'-sNaN1'
)
def
test_sizeof
(
self
):
Decimal
=
C
.
Decimal
HAVE_CONFIG_64
=
(
C
.
MAX_PREC
>
425000000
)
self
.
assertGreater
(
Decimal
(
0
).
__sizeof__
(),
0
)
if
HAVE_CONFIG_64
:
x
=
Decimal
(
10
**
(
19
*
24
)).
__sizeof__
()
y
=
Decimal
(
10
**
(
19
*
25
)).
__sizeof__
()
self
.
assertEqual
(
y
,
x
+
8
)
else
:
x
=
Decimal
(
10
**
(
9
*
24
)).
__sizeof__
()
y
=
Decimal
(
10
**
(
9
*
25
)).
__sizeof__
()
self
.
assertEqual
(
y
,
x
+
4
)
all_tests
=
[
CExplicitConstructionTest
,
PyExplicitConstructionTest
,
...
...
Modules/_decimal/_decimal.c
View file @
891ca9e0
...
...
@@ -4469,10 +4469,10 @@ _dec_hash(PyDecObject *v)
goto
malloc_error
;
}
else
{
PyErr_SetString
(
PyExc_RuntimeError
,
"dec_hash: internal error: please report"
);
PyErr_SetString
(
PyExc_RuntimeError
,
/* GCOV_NOT_REACHED */
"dec_hash: internal error: please report"
);
/* GCOV_NOT_REACHED */
}
result
=
-
1
;
result
=
-
1
;
/* GCOV_NOT_REACHED */
}
...
...
@@ -5623,7 +5623,7 @@ PyInit__decimal(void)
}
if
(
base
==
NULL
)
{
goto
error
;
goto
error
;
/* GCOV_NOT_REACHED */
}
ASSIGN_PTR
(
cm
->
ex
,
PyErr_NewException
((
char
*
)
cm
->
fqname
,
base
,
NULL
));
...
...
@@ -5655,7 +5655,7 @@ PyInit__decimal(void)
base
=
PyTuple_Pack
(
1
,
signal_map
[
0
].
ex
);
}
if
(
base
==
NULL
)
{
goto
error
;
goto
error
;
/* GCOV_NOT_REACHED */
}
ASSIGN_PTR
(
cm
->
ex
,
PyErr_NewException
((
char
*
)
cm
->
fqname
,
base
,
NULL
));
...
...
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