Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
uPython-mirror
Commits
17520224
Commit
17520224
authored
Apr 05, 2014
by
Damien George
Browse files
py: Make all objects and instances derive from object.
This makes isinstance(X, object) and issubclass(X, object) true for all X.
parent
7efc5b3f
Changes
2
Hide whitespace changes
Inline
Side-by-side
py/objobject.c
View file @
17520224
...
...
@@ -11,8 +11,6 @@ typedef struct _mp_obj_object_t {
mp_obj_base_t
base
;
}
mp_obj_object_t
;
const
mp_obj_type_t
mp_type_object
;
STATIC
mp_obj_t
object_make_new
(
mp_obj_t
type_in
,
uint
n_args
,
uint
n_kw
,
const
mp_obj_t
*
args
)
{
if
(
n_args
!=
0
||
n_kw
!=
0
)
{
nlr_raise
(
mp_obj_new_exception_msg
(
&
mp_type_TypeError
,
"object takes no arguments"
));
...
...
py/objtype.c
View file @
17520224
...
...
@@ -532,7 +532,8 @@ STATIC mp_obj_t mp_obj_is_subclass(mp_obj_t object, mp_obj_t classinfo) {
}
for
(
uint
i
=
0
;
i
<
len
;
i
++
)
{
if
(
mp_obj_is_subclass_fast
(
object
,
items
[
i
]))
{
// We explicitly check for 'object' here since no-one explicitly derives from it
if
(
items
[
i
]
==
&
mp_type_object
||
mp_obj_is_subclass_fast
(
object
,
items
[
i
]))
{
return
mp_const_true
;
}
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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