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
f751bc9c
Commit
f751bc9c
authored
Jul 02, 2010
by
Benjamin Peterson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix lookup of __ceil__
parent
b0125892
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
11 deletions
+12
-11
Lib/test/test_descr.py
Lib/test/test_descr.py
+1
-0
Misc/NEWS
Misc/NEWS
+2
-2
Modules/mathmodule.c
Modules/mathmodule.c
+9
-9
No files found.
Lib/test/test_descr.py
View file @
f751bc9c
...
...
@@ -1581,6 +1581,7 @@ order (MRO) for bases """
(
"__format__"
,
format
,
format_impl
,
set
(),
{}),
(
"__floor__"
,
math
.
floor
,
zero
,
set
(),
{}),
(
"__trunc__"
,
math
.
trunc
,
zero
,
set
(),
{}),
(
"__ceil__"
,
math
.
ceil
,
zero
,
set
(),
{}),
]
class
Checker
(
object
):
...
...
Misc/NEWS
View file @
f751bc9c
...
...
@@ -1374,8 +1374,8 @@ Library
Extension Modules
-----------------
- In the math module, correctly lookup __trunc__
and __floor__ as special
methods.
- In the math module, correctly lookup __trunc__
, __ceil__, and __floor__ as
special
methods.
- Issue #9005: Prevent utctimetuple() from producing year 0 or year
10,000. Prior to this change, timezone adjustment in utctimetuple()
...
...
Modules/mathmodule.c
View file @
f751bc9c
...
...
@@ -843,17 +843,17 @@ static PyObject * math_ceil(PyObject *self, PyObject *number) {
static
PyObject
*
ceil_str
=
NULL
;
PyObject
*
method
;
if
(
ceil_str
==
NULL
)
{
ceil_str
=
PyUnicode_InternFromString
(
"__ceil__"
);
if
(
ceil_str
==
NULL
)
method
=
_PyObject_LookupSpecial
(
number
,
"__ceil__"
,
&
ceil_str
);
if
(
method
==
NULL
)
{
if
(
PyErr_Occurred
()
)
return
NULL
;
}
method
=
_PyType_Lookup
(
Py_TYPE
(
number
),
ceil_str
);
if
(
method
==
NULL
)
return
math_1_to_int
(
number
,
ceil
,
0
);
else
return
PyObject_CallFunction
(
method
,
"O"
,
number
);
}
else
{
PyObject
*
result
=
PyObject_CallFunctionObjArgs
(
method
,
NULL
);
Py_DECREF
(
method
);
return
result
;
}
}
PyDoc_STRVAR
(
math_ceil_doc
,
...
...
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