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
3cedf46c
Commit
3cedf46c
authored
Sep 10, 2017
by
Stefan Krah
Committed by
GitHub
Sep 10, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bpo-31406: Fix crash due to lack of type checking in subclassing. (#3477)
parent
30644dee
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
5 deletions
+14
-5
Modules/_decimal/_decimal.c
Modules/_decimal/_decimal.c
+14
-5
No files found.
Modules/_decimal/_decimal.c
View file @
3cedf46c
...
@@ -2082,13 +2082,17 @@ dec_from_long(PyTypeObject *type, const PyObject *v,
...
@@ -2082,13 +2082,17 @@ dec_from_long(PyTypeObject *type, const PyObject *v,
/* Return a new PyDecObject from a PyLongObject. Use the context for
/* Return a new PyDecObject from a PyLongObject. Use the context for
conversion. */
conversion. */
static
PyObject
*
static
PyObject
*
PyDecType_FromLong
(
PyTypeObject
*
type
,
const
PyObject
*
pylong
,
PyDecType_FromLong
(
PyTypeObject
*
type
,
const
PyObject
*
v
,
PyObject
*
context
)
PyObject
*
context
)
{
{
PyObject
*
dec
;
PyObject
*
dec
;
uint32_t
status
=
0
;
uint32_t
status
=
0
;
dec
=
dec_from_long
(
type
,
pylong
,
CTX
(
context
),
&
status
);
if
(
!
PyLong_Check
(
v
))
{
PyErr_SetString
(
PyExc_TypeError
,
"argument must be an integer"
);
return
NULL
;
}
dec
=
dec_from_long
(
type
,
v
,
CTX
(
context
),
&
status
);
if
(
dec
==
NULL
)
{
if
(
dec
==
NULL
)
{
return
NULL
;
return
NULL
;
}
}
...
@@ -2104,15 +2108,20 @@ PyDecType_FromLong(PyTypeObject *type, const PyObject *pylong,
...
@@ -2104,15 +2108,20 @@ PyDecType_FromLong(PyTypeObject *type, const PyObject *pylong,
/* Return a new PyDecObject from a PyLongObject. Use a maximum context
/* Return a new PyDecObject from a PyLongObject. Use a maximum context
for conversion. If the conversion is not exact, set InvalidOperation. */
for conversion. If the conversion is not exact, set InvalidOperation. */
static
PyObject
*
static
PyObject
*
PyDecType_FromLongExact
(
PyTypeObject
*
type
,
const
PyObject
*
pylong
,
PyDecType_FromLongExact
(
PyTypeObject
*
type
,
const
PyObject
*
v
,
PyObject
*
context
)
PyObject
*
context
)
{
{
PyObject
*
dec
;
PyObject
*
dec
;
uint32_t
status
=
0
;
uint32_t
status
=
0
;
mpd_context_t
maxctx
;
mpd_context_t
maxctx
;
if
(
!
PyLong_Check
(
v
))
{
PyErr_SetString
(
PyExc_TypeError
,
"argument must be an integer"
);
return
NULL
;
}
mpd_maxcontext
(
&
maxctx
);
mpd_maxcontext
(
&
maxctx
);
dec
=
dec_from_long
(
type
,
pylong
,
&
maxctx
,
&
status
);
dec
=
dec_from_long
(
type
,
v
,
&
maxctx
,
&
status
);
if
(
dec
==
NULL
)
{
if
(
dec
==
NULL
)
{
return
NULL
;
return
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