FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
python-uvloop/uvloop/errors.pyx at python-3.11 · sysfce2/python-uvloop · GitHub
sysfce2
/
python-uvloop
Public
forked from
MagicStack/uvloop
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Security and quality
Insights
Expand file tree
Breadcrumbs
python-uvloop
/
uvloop
/
errors.pyx
Copy path
More file actions
More file actions
Latest commit
History
History
History
113 lines (75 loc) · 2.71 KB
Breadcrumbs
python-uvloop
/
uvloop
/
errors.pyx
Copy path
File metadata and controls
113 lines (75 loc) · 2.71 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
cdef
str
__strerr(
int
errno):
return
strerror(errno).decode()
cdef __convert_python_error(
int
uverr):
#
XXX Won't work for Windows:
#
From libuv docs:
#
Implementation detail: on Unix error codes are the
#
negated errno (or -errno), while on Windows they
#
are defined by libuv to arbitrary negative numbers.
cdef
int
oserr
=
-
uverr
exc
=
OSError
if
uverr
in
(uv.UV_EACCES, uv.UV_EPERM):
exc
=
PermissionError
elif
uverr
in
(uv.UV_EAGAIN, uv.UV_EALREADY):
exc
=
BlockingIOError
elif
uverr
in
(uv.UV_EPIPE, uv.UV_ESHUTDOWN):
exc
=
BrokenPipeError
elif
uverr
==
uv.UV_ECONNABORTED:
exc
=
ConnectionAbortedError
elif
uverr
==
uv.UV_ECONNREFUSED:
exc
=
ConnectionRefusedError
elif
uverr
==
uv.UV_ECONNRESET:
exc
=
ConnectionResetError
elif
uverr
==
uv.UV_EEXIST:
exc
=
FileExistsError
elif
uverr
==
uv.UV_ENOENT:
exc
=
FileNotFoundError
elif
uverr
==
uv.UV_EINTR:
exc
=
InterruptedError
elif
uverr
==
uv.UV_EISDIR:
exc
=
IsADirectoryError
elif
uverr
==
uv.UV_ESRCH:
exc
=
ProcessLookupError
elif
uverr
==
uv.UV_ETIMEDOUT:
exc
=
TimeoutError
return
exc(oserr, __strerr(oserr))
cdef
int
__convert_socket_error(
int
uverr):
cdef
int
sock_err
=
0
if
uverr
==
uv.UV_EAI_ADDRFAMILY:
sock_err
=
socket_EAI_ADDRFAMILY
elif
uverr
==
uv.UV_EAI_AGAIN:
sock_err
=
socket_EAI_AGAIN
elif
uverr
==
uv.UV_EAI_BADFLAGS:
sock_err
=
socket_EAI_BADFLAGS
elif
uverr
==
uv.UV_EAI_BADHINTS:
sock_err
=
socket_EAI_BADHINTS
elif
uverr
==
uv.UV_EAI_CANCELED:
sock_err
=
socket_EAI_CANCELED
elif
uverr
==
uv.UV_EAI_FAIL:
sock_err
=
socket_EAI_FAIL
elif
uverr
==
uv.UV_EAI_FAMILY:
sock_err
=
socket_EAI_FAMILY
elif
uverr
==
uv.UV_EAI_MEMORY:
sock_err
=
socket_EAI_MEMORY
elif
uverr
==
uv.UV_EAI_NODATA:
sock_err
=
socket_EAI_NODATA
elif
uverr
==
uv.UV_EAI_NONAME:
sock_err
=
socket_EAI_NONAME
elif
uverr
==
uv.UV_EAI_OVERFLOW:
sock_err
=
socket_EAI_OVERFLOW
elif
uverr
==
uv.UV_EAI_PROTOCOL:
sock_err
=
socket_EAI_PROTOCOL
elif
uverr
==
uv.UV_EAI_SERVICE:
sock_err
=
socket_EAI_SERVICE
elif
uverr
==
uv.UV_EAI_SOCKTYPE:
sock_err
=
socket_EAI_SOCKTYPE
return
sock_err
cdef convert_error(
int
uverr):
cdef
int
sock_err
if
uverr
==
uv.UV_ECANCELED:
return
aio_CancelledError()
sock_err
=
__convert_socket_error(uverr)
if
sock_err:
msg
=
system.gai_strerror(sock_err).decode(
'
utf-8
'
)
return
socket_gaierror(sock_err, msg)
return
__convert_python_error(uverr)
Back
|
FazBrowse Home
|
New Git URL