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
f5fcd33b
Commit
f5fcd33b
authored
May 23, 2011
by
Benjamin Peterson
Browse files
Options
Browse Files
Download
Plain Diff
merge 3.1
parents
4b244ef2
7963a35b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
5 deletions
+10
-5
Lib/test/test_descr.py
Lib/test/test_descr.py
+1
-0
Misc/NEWS
Misc/NEWS
+3
-0
Objects/object.c
Objects/object.c
+6
-5
No files found.
Lib/test/test_descr.py
View file @
f5fcd33b
...
...
@@ -1587,6 +1587,7 @@ order (MRO) for bases """
(
"__floor__"
,
math
.
floor
,
zero
,
set
(),
{}),
(
"__trunc__"
,
math
.
trunc
,
zero
,
set
(),
{}),
(
"__ceil__"
,
math
.
ceil
,
zero
,
set
(),
{}),
(
"__dir__"
,
dir
,
empty_seq
,
set
(),
{}),
]
class
Checker
(
object
):
...
...
Misc/NEWS
View file @
f5fcd33b
...
...
@@ -13,6 +13,9 @@ Core and Builtins
Library
-------
- Correct lookup of __dir__ on objects. Among other things, this causes errors
besides AttributeError found on lookup to be propagated.
- Issue #12124: zipimport doesn't keep a reference to zlib.decompress() anymore
to be able to unload the module.
...
...
Objects/object.c
View file @
f5fcd33b
...
...
@@ -1366,14 +1366,15 @@ error:
static
PyObject
*
_dir_object
(
PyObject
*
obj
)
{
PyObject
*
result
=
NULL
;
PyObject
*
dirfunc
=
PyObject_GetAttrString
((
PyObject
*
)
obj
->
ob_type
,
"__dir__"
);
PyObject
*
result
=
NULL
;
static
PyObject
*
dir_str
=
NULL
;
PyObject
*
dirfunc
=
_PyObject_LookupSpecial
(
obj
,
"__dir__"
,
&
dir_str
);
assert
(
obj
);
if
(
dirfunc
==
NULL
)
{
if
(
PyErr_Occurred
())
return
NULL
;
/* use default implementation */
PyErr_Clear
();
if
(
PyModule_Check
(
obj
))
result
=
_specialized_dir_module
(
obj
);
else
if
(
PyType_Check
(
obj
))
...
...
@@ -1383,7 +1384,7 @@ _dir_object(PyObject *obj)
}
else
{
/* use __dir__ */
result
=
PyObject_CallFunctionObjArgs
(
dirfunc
,
obj
,
NULL
);
result
=
PyObject_CallFunctionObjArgs
(
dirfunc
,
NULL
);
Py_DECREF
(
dirfunc
);
if
(
result
==
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