Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
2122cf71
Commit
2122cf71
authored
Dec 10, 2011
by
Benjamin Peterson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
alias resource.error to OSError
parent
ce2af335
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
14 deletions
+12
-14
Doc/library/resource.rst
Doc/library/resource.rst
+5
-3
Misc/NEWS
Misc/NEWS
+2
-0
Modules/resource.c
Modules/resource.c
+5
-11
No files found.
Doc/library/resource.rst
View file @
2122cf71
...
@@ -14,13 +14,15 @@ resources utilized by a program.
...
@@ -14,13 +14,15 @@ resources utilized by a program.
Symbolic constants are used to specify particular system resources and to
Symbolic constants are used to specify particular system resources and to
request usage information about either the current process or its children.
request usage information about either the current process or its children.
A
single exception is defined for errors:
A
n :exc:`OSError` is raised on syscall failure.
.. exception:: error
.. exception:: error
The functions described below may raise this error if the underlying system call
A deprecated alias of :exc:`OSError`.
failures unexpectedly.
.. versionchanged:: 3.3
Following :pep:`3151`, this class was made an alias of :exc:`OSError`.
Resource Limits
Resource Limits
...
...
Misc/NEWS
View file @
2122cf71
...
@@ -406,6 +406,8 @@ Core and Builtins
...
@@ -406,6 +406,8 @@ Core and Builtins
Library
Library
-------
-------
-
Alias
resource
.
error
to
OSError
ala
PEP
3151.
-
Issue
#
13248
:
Turn
3.2
's PendingDeprecationWarning into 3.3'
s
-
Issue
#
13248
:
Turn
3.2
's PendingDeprecationWarning into 3.3'
s
DeprecationWarning
.
It
covers
'cgi.escape'
,
'importlib.abc.PyLoader'
,
DeprecationWarning
.
It
covers
'cgi.escape'
,
'importlib.abc.PyLoader'
,
'importlib.abc.PyPycLoader'
,
'nntplib.NNTP.xgtitle'
,
'nntplib.NNTP.xpath'
,
'importlib.abc.PyPycLoader'
,
'nntplib.NNTP.xgtitle'
,
'nntplib.NNTP.xpath'
,
...
...
Modules/resource.c
View file @
2122cf71
...
@@ -18,8 +18,6 @@
...
@@ -18,8 +18,6 @@
#define doubletime(TV) ((double)(TV).tv_sec + (TV).tv_usec * 0.000001)
#define doubletime(TV) ((double)(TV).tv_sec + (TV).tv_usec * 0.000001)
static
PyObject
*
ResourceError
;
PyDoc_STRVAR
(
struct_rusage__doc__
,
PyDoc_STRVAR
(
struct_rusage__doc__
,
"struct_rusage: Result from getrusage.
\n\n
"
"struct_rusage: Result from getrusage.
\n\n
"
"This object may be accessed either as a tuple of
\n
"
"This object may be accessed either as a tuple of
\n
"
...
@@ -73,7 +71,7 @@ resource_getrusage(PyObject *self, PyObject *args)
...
@@ -73,7 +71,7 @@ resource_getrusage(PyObject *self, PyObject *args)
"invalid who parameter"
);
"invalid who parameter"
);
return
NULL
;
return
NULL
;
}
}
PyErr_SetFromErrno
(
Resource
Error
);
PyErr_SetFromErrno
(
PyExc_OS
Error
);
return
NULL
;
return
NULL
;
}
}
...
@@ -125,7 +123,7 @@ resource_getrlimit(PyObject *self, PyObject *args)
...
@@ -125,7 +123,7 @@ resource_getrlimit(PyObject *self, PyObject *args)
}
}
if
(
getrlimit
(
resource
,
&
rl
)
==
-
1
)
{
if
(
getrlimit
(
resource
,
&
rl
)
==
-
1
)
{
PyErr_SetFromErrno
(
Resource
Error
);
PyErr_SetFromErrno
(
PyExc_OS
Error
);
return
NULL
;
return
NULL
;
}
}
...
@@ -183,7 +181,7 @@ resource_setrlimit(PyObject *self, PyObject *args)
...
@@ -183,7 +181,7 @@ resource_setrlimit(PyObject *self, PyObject *args)
PyErr_SetString
(
PyExc_ValueError
,
PyErr_SetString
(
PyExc_ValueError
,
"not allowed to raise maximum limit"
);
"not allowed to raise maximum limit"
);
else
else
PyErr_SetFromErrno
(
Resource
Error
);
PyErr_SetFromErrno
(
PyExc_OS
Error
);
return
NULL
;
return
NULL
;
}
}
Py_INCREF
(
Py_None
);
Py_INCREF
(
Py_None
);
...
@@ -246,12 +244,8 @@ PyInit_resource(void)
...
@@ -246,12 +244,8 @@ PyInit_resource(void)
return
NULL
;
return
NULL
;
/* Add some symbolic constants to the module */
/* Add some symbolic constants to the module */
if
(
ResourceError
==
NULL
)
{
Py_INCREF
(
PyExc_OSError
);
ResourceError
=
PyErr_NewException
(
"resource.error"
,
PyModule_AddObject
(
m
,
"error"
,
PyExc_OSError
);
NULL
,
NULL
);
}
Py_INCREF
(
ResourceError
);
PyModule_AddObject
(
m
,
"error"
,
ResourceError
);
if
(
!
initialized
)
if
(
!
initialized
)
PyStructSequence_InitType
(
&
StructRUsageType
,
PyStructSequence_InitType
(
&
StructRUsageType
,
&
struct_rusage_desc
);
&
struct_rusage_desc
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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