Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
M
micropython
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
card10
micropython
Commits
acb13886
Commit
acb13886
authored
Apr 21, 2014
by
Paul Sokolovsky
Browse files
Options
Downloads
Patches
Plain Diff
unix: OSError's args[0] should be errno numeric value.
Well, Python3 also defines an attribute for that, but that's bloat.
parent
dec31bb8
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
unix/file.c
+1
-1
1 addition, 1 deletion
unix/file.c
unix/modffi.c
+3
-3
3 additions, 3 deletions
unix/modffi.c
unix/modsocket.c
+1
-1
1 addition, 1 deletion
unix/modsocket.c
with
5 additions
and
5 deletions
unix/file.c
+
1
−
1
View file @
acb13886
...
@@ -106,7 +106,7 @@ STATIC mp_obj_t fdfile_make_new(mp_obj_t type_in, uint n_args, uint n_kw, const
...
@@ -106,7 +106,7 @@ STATIC mp_obj_t fdfile_make_new(mp_obj_t type_in, uint n_args, uint n_kw, const
int
fd
=
open
(
fname
,
mode
,
0644
);
int
fd
=
open
(
fname
,
mode
,
0644
);
if
(
fd
==
-
1
)
{
if
(
fd
==
-
1
)
{
nlr_raise
(
mp_obj_new_exception_
msg_v
arg
(
&
mp_type_OSError
,
"[Errno %d]"
,
errno
));
nlr_raise
(
mp_obj_new_exception_arg
1
(
&
mp_type_OSError
,
MP_OBJ_NEW_SMALL_INT
(
errno
))
)
;
}
}
return
fdfile_new
(
fd
);
return
fdfile_new
(
fd
);
}
}
...
...
This diff is collapsed.
Click to expand it.
unix/modffi.c
+
3
−
3
View file @
acb13886
...
@@ -145,7 +145,7 @@ STATIC mp_obj_t ffimod_func(uint n_args, const mp_obj_t *args) {
...
@@ -145,7 +145,7 @@ STATIC mp_obj_t ffimod_func(uint n_args, const mp_obj_t *args) {
void
*
sym
=
dlsym
(
self
->
handle
,
symname
);
void
*
sym
=
dlsym
(
self
->
handle
,
symname
);
if
(
sym
==
NULL
)
{
if
(
sym
==
NULL
)
{
nlr_raise
(
mp_obj_new_exception_
msg_v
arg
(
&
mp_type_OSError
,
"[Errno %d]"
,
errno
));
nlr_raise
(
mp_obj_new_exception_arg
1
(
&
mp_type_OSError
,
MP_OBJ_NEW_SMALL_INT
(
errno
))
)
;
}
}
int
nparams
=
MP_OBJ_SMALL_INT_VALUE
(
mp_obj_len_maybe
(
args
[
3
]));
int
nparams
=
MP_OBJ_SMALL_INT_VALUE
(
mp_obj_len_maybe
(
args
[
3
]));
mp_obj_ffifunc_t
*
o
=
m_new_obj_var
(
mp_obj_ffifunc_t
,
ffi_type
*
,
nparams
);
mp_obj_ffifunc_t
*
o
=
m_new_obj_var
(
mp_obj_ffifunc_t
,
ffi_type
*
,
nparams
);
...
@@ -219,7 +219,7 @@ STATIC mp_obj_t ffimod_var(mp_obj_t self_in, mp_obj_t vartype_in, mp_obj_t symna
...
@@ -219,7 +219,7 @@ STATIC mp_obj_t ffimod_var(mp_obj_t self_in, mp_obj_t vartype_in, mp_obj_t symna
void
*
sym
=
dlsym
(
self
->
handle
,
symname
);
void
*
sym
=
dlsym
(
self
->
handle
,
symname
);
if
(
sym
==
NULL
)
{
if
(
sym
==
NULL
)
{
nlr_raise
(
mp_obj_new_exception_
msg_v
arg
(
&
mp_type_OSError
,
"[Errno %d]"
,
errno
));
nlr_raise
(
mp_obj_new_exception_arg
1
(
&
mp_type_OSError
,
MP_OBJ_NEW_SMALL_INT
(
errno
))
)
;
}
}
mp_obj_ffivar_t
*
o
=
m_new_obj
(
mp_obj_ffivar_t
);
mp_obj_ffivar_t
*
o
=
m_new_obj
(
mp_obj_ffivar_t
);
o
->
base
.
type
=
&
ffivar_type
;
o
->
base
.
type
=
&
ffivar_type
;
...
@@ -235,7 +235,7 @@ STATIC mp_obj_t ffimod_make_new(mp_obj_t type_in, uint n_args, uint n_kw, const
...
@@ -235,7 +235,7 @@ STATIC mp_obj_t ffimod_make_new(mp_obj_t type_in, uint n_args, uint n_kw, const
void
*
mod
=
dlopen
(
fname
,
RTLD_NOW
|
RTLD_LOCAL
);
void
*
mod
=
dlopen
(
fname
,
RTLD_NOW
|
RTLD_LOCAL
);
if
(
mod
==
NULL
)
{
if
(
mod
==
NULL
)
{
nlr_raise
(
mp_obj_new_exception_
msg_v
arg
(
&
mp_type_OSError
,
"[Errno %d]"
,
errno
));
nlr_raise
(
mp_obj_new_exception_arg
1
(
&
mp_type_OSError
,
MP_OBJ_NEW_SMALL_INT
(
errno
))
)
;
}
}
mp_obj_ffimod_t
*
o
=
m_new_obj
(
mp_obj_ffimod_t
);
mp_obj_ffimod_t
*
o
=
m_new_obj
(
mp_obj_ffimod_t
);
o
->
base
.
type
=
type_in
;
o
->
base
.
type
=
type_in
;
...
...
This diff is collapsed.
Click to expand it.
unix/modsocket.c
+
1
−
1
View file @
acb13886
...
@@ -33,7 +33,7 @@ STATIC const mp_obj_type_t microsocket_type;
...
@@ -33,7 +33,7 @@ STATIC const mp_obj_type_t microsocket_type;
// Helper functions
// Helper functions
#define RAISE_ERRNO(err_flag, error_val) \
#define RAISE_ERRNO(err_flag, error_val) \
{ if (err_flag == -1) \
{ if (err_flag == -1) \
{ nlr_raise(mp_obj_new_exception_
msg_v
arg(&mp_type_OSError,
"[Errno %d]",
error_val)); } }
{ nlr_raise(mp_obj_new_exception_arg
1
(&mp_type_OSError,
MP_OBJ_NEW_SMALL_INT(
error_val))
)
; } }
STATIC
mp_obj_socket_t
*
socket_new
(
int
fd
)
{
STATIC
mp_obj_socket_t
*
socket_new
(
int
fd
)
{
mp_obj_socket_t
*
o
=
m_new_obj
(
mp_obj_socket_t
);
mp_obj_socket_t
*
o
=
m_new_obj
(
mp_obj_socket_t
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment