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
59540dcc
Commit
59540dcc
authored
Jan 28, 2017
by
Paul Sokolovsky
Browse files
Options
Downloads
Patches
Plain Diff
docs/usocket: Clarify exceptions used.
parent
0aa83142
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
docs/library/usocket.rst
+18
-7
18 additions, 7 deletions
docs/library/usocket.rst
with
18 additions
and
7 deletions
docs/library/usocket.rst
+
18
−
7
View file @
59540dcc
...
@@ -10,6 +10,12 @@ This module provides access to the BSD socket interface.
...
@@ -10,6 +10,12 @@ This module provides access to the BSD socket interface.
See corresponding `CPython module <https://docs.python.org/3/library/socket.html>`_ for
See corresponding `CPython module <https://docs.python.org/3/library/socket.html>`_ for
comparison.
comparison.
.. admonition:: Difference to CPython
:class: attention
CPython used to have a ``socket.error`` exception which is now deprecated,
and is an alias of OSError. In MicroPython, use OSError directly.
Socket address format(s)
Socket address format(s)
------------------------
------------------------
...
@@ -51,13 +57,18 @@ Functions
...
@@ -51,13 +57,18 @@ Functions
s = socket.socket()
s = socket.socket()
s.connect(socket.getaddrinfo('www.micropython.org', 80)[0][-1])
s.connect(socket.getaddrinfo('www.micropython.org', 80)[0][-1])
.. only:: port_wipy
.. admonition:: Difference to CPython
:class: attention
Exceptions
----------
.. data:: socket.error
CPython raises a ``socket.gaierror`` exception (OSError subclass) in case
.. data:: socket.timeout
of error in this function. MicroPython doesn't have ``socket.gaierror``
and raises OSError directly. Note that error numbers of ``getaddrinfo()``
form a separate namespace and may not match error numbers from
``uerrno`` module. To distinguish ``getaddrinfo()`` errors, they are
represented by negative numbers, whereas standard system errors are
positive numbers (error numbers are accessible using ``e.args[0]`` property
from an exception object). The use of negative values is a provisional
detail which may change in the future.
Constants
Constants
---------
---------
...
...
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