socket: Add socket.error

Older CPython versions raised socker.error (or classes derived from it)
as exceptions on errors. Various software still uses it to be compatible
with older Python versions. As it's one-line fix, allow MicroPython to
run such code too.

try:
  socket...
except socker.error as e:
  ...
pull/63/head
Michael Buesch 2015-12-05 21:01:08 +01:00 zatwierdzone przez Paul Sokolovsky
rodzic 17d96d35b5
commit ff27e3c8ba
3 zmienionych plików z 4 dodań i 2 usunięć

Wyświetl plik

@ -1,4 +1,4 @@
srctype = micropython-lib
type = module
version = 0.3.2
version = 0.3.3
author = Paul Sokolovsky

Wyświetl plik

@ -6,7 +6,7 @@ from setuptools import setup
setup(name='micropython-socket',
version='0.3.2',
version='0.3.3',
description='socket module for MicroPython',
long_description="This is a module reimplemented specifically for MicroPython standard library,\nwith efficient and lean design in mind. Note that this module is likely work\nin progress and likely supports just a subset of CPython's corresponding\nmodule. Please help with the development if you are interested in this\nmodule.",
url='https://github.com/micropython/micropython/issues/405',

Wyświetl plik

@ -7,6 +7,8 @@ IPPROTO_IP = 0
IP_ADD_MEMBERSHIP = 35
IP_DROP_MEMBERSHIP = 36
error = OSError
def _resolve_addr(addr):
if isinstance(addr, (bytes, bytearray)):
return addr