mirror of
https://github.com/python/cpython.git
synced 2025-07-23 11:15:24 +00:00
Merged revisions 70980,71059,71225,71234,71241,71243,71249,71251,71255,71266,71299,71329,71397-71398,71486 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r70980 | jack.diederich | 2009-04-01 15:26:13 -0500 (Wed, 01 Apr 2009) | 3 lines bounds check arguments to mmap.move(). All of them. Really. fixes crasher on OS X 10.5 ........ r71059 | mark.dickinson | 2009-04-02 13:39:37 -0500 (Thu, 02 Apr 2009) | 2 lines sys.long_info attributes should be ints, not longs ........ r71225 | georg.brandl | 2009-04-05 06:54:07 -0500 (Sun, 05 Apr 2009) | 1 line #5580: no need to use parentheses when converterr() argument is actually a type description. ........ r71234 | georg.brandl | 2009-04-05 08:16:35 -0500 (Sun, 05 Apr 2009) | 1 line Whitespace normalization. ........ r71241 | georg.brandl | 2009-04-05 09:48:49 -0500 (Sun, 05 Apr 2009) | 1 line #5471: fix expanduser() for $HOME set to "/". ........ r71243 | georg.brandl | 2009-04-05 10:14:29 -0500 (Sun, 05 Apr 2009) | 1 line #5432: make plistlib docstring a raw string, since it contains examples with backslash escapes. ........ r71249 | georg.brandl | 2009-04-05 11:30:43 -0500 (Sun, 05 Apr 2009) | 1 line #5444: adapt make.bat to new htmlhelp output file name. ........ r71251 | georg.brandl | 2009-04-05 12:17:42 -0500 (Sun, 05 Apr 2009) | 1 line #5298: clarify docs about GIL by using more consistent wording. ........ r71255 | georg.brandl | 2009-04-05 13:34:58 -0500 (Sun, 05 Apr 2009) | 1 line #602893: add indicator for current line in cgitb that doesnt rely on styling alone. ........ r71266 | georg.brandl | 2009-04-05 15:23:13 -0500 (Sun, 05 Apr 2009) | 1 line Normalize issue referencing style. ........ r71299 | gregory.p.smith | 2009-04-05 18:43:58 -0500 (Sun, 05 Apr 2009) | 3 lines Fixes issue5705: os.setuid() and friends did not accept the same range of values that pwd.getpwnam() returns. ........ r71329 | benjamin.peterson | 2009-04-06 16:53:33 -0500 (Mon, 06 Apr 2009) | 1 line add create_connection to __all__ #5711 ........ r71397 | georg.brandl | 2009-04-08 11:36:39 -0500 (Wed, 08 Apr 2009) | 1 line Remove redundant backtick. ........ r71398 | georg.brandl | 2009-04-08 11:39:04 -0500 (Wed, 08 Apr 2009) | 1 line Update ignore file for suspicious builder. ........ r71486 | andrew.kuchling | 2009-04-11 11:18:14 -0500 (Sat, 11 Apr 2009) | 1 line Re-word ........
This commit is contained in:
parent
da2ba336da
commit
ef3e4c2b4d
17 changed files with 235 additions and 132 deletions
|
@ -239,7 +239,7 @@ Buffer related functions
|
||||||
| :cmacro:`PyBUF_FULL` | This is equivalent to ``(PyBUF_INDIRECT | |
|
| :cmacro:`PyBUF_FULL` | This is equivalent to ``(PyBUF_INDIRECT | |
|
||||||
| | PyBUF_FORMAT | PyBUF_WRITABLE)``. |
|
| | PyBUF_FORMAT | PyBUF_WRITABLE)``. |
|
||||||
+------------------------------+---------------------------------------------------+
|
+------------------------------+---------------------------------------------------+
|
||||||
| :cmacro:`PyBUF_FULL_RO`` | This is equivalent to ``(PyBUF_INDIRECT | |
|
| :cmacro:`PyBUF_FULL_RO` | This is equivalent to ``(PyBUF_INDIRECT | |
|
||||||
| | PyBUF_FORMAT)``. |
|
| | PyBUF_FORMAT)``. |
|
||||||
+------------------------------+---------------------------------------------------+
|
+------------------------------+---------------------------------------------------+
|
||||||
| :cmacro:`PyBUF_CONTIG` | This is equivalent to ``(PyBUF_ND | |
|
| :cmacro:`PyBUF_CONTIG` | This is equivalent to ``(PyBUF_ND | |
|
||||||
|
|
|
@ -391,12 +391,12 @@ Thread State and the Global Interpreter Lock
|
||||||
single: lock, interpreter
|
single: lock, interpreter
|
||||||
|
|
||||||
The Python interpreter is not fully thread safe. In order to support
|
The Python interpreter is not fully thread safe. In order to support
|
||||||
multi-threaded Python programs, there's a global lock that must be held by the
|
multi-threaded Python programs, there's a global lock, called the :dfn:`global
|
||||||
current thread before it can safely access Python objects. Without the lock,
|
interpreter lock` or :dfn:`GIL`, that must be held by the current thread before
|
||||||
even the simplest operations could cause problems in a multi-threaded program:
|
it can safely access Python objects. Without the lock, even the simplest
|
||||||
for example, when two threads simultaneously increment the reference count of
|
operations could cause problems in a multi-threaded program: for example, when
|
||||||
the same object, the reference count could end up being incremented only once
|
two threads simultaneously increment the reference count of the same object, the
|
||||||
instead of twice.
|
reference count could end up being incremented only once instead of twice.
|
||||||
|
|
||||||
.. index:: single: setcheckinterval() (in module sys)
|
.. index:: single: setcheckinterval() (in module sys)
|
||||||
|
|
||||||
|
@ -425,9 +425,9 @@ This is easy enough in most cases. Most code manipulating the global
|
||||||
interpreter lock has the following simple structure::
|
interpreter lock has the following simple structure::
|
||||||
|
|
||||||
Save the thread state in a local variable.
|
Save the thread state in a local variable.
|
||||||
Release the interpreter lock.
|
Release the global interpreter lock.
|
||||||
...Do some blocking I/O operation...
|
...Do some blocking I/O operation...
|
||||||
Reacquire the interpreter lock.
|
Reacquire the global interpreter lock.
|
||||||
Restore the thread state from the local variable.
|
Restore the thread state from the local variable.
|
||||||
|
|
||||||
This is so common that a pair of macros exists to simplify it::
|
This is so common that a pair of macros exists to simplify it::
|
||||||
|
@ -444,7 +444,7 @@ The :cmacro:`Py_BEGIN_ALLOW_THREADS` macro opens a new block and declares a
|
||||||
hidden local variable; the :cmacro:`Py_END_ALLOW_THREADS` macro closes the
|
hidden local variable; the :cmacro:`Py_END_ALLOW_THREADS` macro closes the
|
||||||
block. Another advantage of using these two macros is that when Python is
|
block. Another advantage of using these two macros is that when Python is
|
||||||
compiled without thread support, they are defined empty, thus saving the thread
|
compiled without thread support, they are defined empty, thus saving the thread
|
||||||
state and lock manipulations.
|
state and GIL manipulations.
|
||||||
|
|
||||||
When thread support is enabled, the block above expands to the following code::
|
When thread support is enabled, the block above expands to the following code::
|
||||||
|
|
||||||
|
@ -476,7 +476,7 @@ There are some subtle differences; in particular, :cfunc:`PyEval_RestoreThread`
|
||||||
saves and restores the value of the global variable :cdata:`errno`, since the
|
saves and restores the value of the global variable :cdata:`errno`, since the
|
||||||
lock manipulation does not guarantee that :cdata:`errno` is left alone. Also,
|
lock manipulation does not guarantee that :cdata:`errno` is left alone. Also,
|
||||||
when thread support is disabled, :cfunc:`PyEval_SaveThread` and
|
when thread support is disabled, :cfunc:`PyEval_SaveThread` and
|
||||||
:cfunc:`PyEval_RestoreThread` don't manipulate the lock; in this case,
|
:cfunc:`PyEval_RestoreThread` don't manipulate the GIL; in this case,
|
||||||
:cfunc:`PyEval_ReleaseLock` and :cfunc:`PyEval_AcquireLock` are not available.
|
:cfunc:`PyEval_ReleaseLock` and :cfunc:`PyEval_AcquireLock` are not available.
|
||||||
This is done so that dynamically loaded extensions compiled with thread support
|
This is done so that dynamically loaded extensions compiled with thread support
|
||||||
enabled can be loaded by an interpreter that was compiled with disabled thread
|
enabled can be loaded by an interpreter that was compiled with disabled thread
|
||||||
|
@ -559,16 +559,16 @@ supports the creation of additional interpreters (using
|
||||||
|
|
||||||
.. index:: module: _thread
|
.. index:: module: _thread
|
||||||
|
|
||||||
When only the main thread exists, no lock operations are needed. This is a
|
When only the main thread exists, no GIL operations are needed. This is a
|
||||||
common situation (most Python programs do not use threads), and the lock
|
common situation (most Python programs do not use threads), and the lock
|
||||||
operations slow the interpreter down a bit. Therefore, the lock is not created
|
operations slow the interpreter down a bit. Therefore, the lock is not
|
||||||
initially. This situation is equivalent to having acquired the lock: when
|
created initially. This situation is equivalent to having acquired the lock:
|
||||||
there is only a single thread, all object accesses are safe. Therefore, when
|
when there is only a single thread, all object accesses are safe. Therefore,
|
||||||
this function initializes the lock, it also acquires it. Before the Python
|
when this function initializes the global interpreter lock, it also acquires
|
||||||
:mod:`_thread` module creates a new thread, knowing that either it has the lock
|
it. Before the Python :mod:`_thread` module creates a new thread, knowing
|
||||||
or the lock hasn't been created yet, it calls :cfunc:`PyEval_InitThreads`. When
|
that either it has the lock or the lock hasn't been created yet, it calls
|
||||||
this call returns, it is guaranteed that the lock has been created and that the
|
:cfunc:`PyEval_InitThreads`. When this call returns, it is guaranteed that
|
||||||
calling thread has acquired it.
|
the lock has been created and that the calling thread has acquired it.
|
||||||
|
|
||||||
It is **not** safe to call this function when it is unknown which thread (if
|
It is **not** safe to call this function when it is unknown which thread (if
|
||||||
any) currently has the global interpreter lock.
|
any) currently has the global interpreter lock.
|
||||||
|
@ -579,7 +579,7 @@ supports the creation of additional interpreters (using
|
||||||
.. cfunction:: int PyEval_ThreadsInitialized()
|
.. cfunction:: int PyEval_ThreadsInitialized()
|
||||||
|
|
||||||
Returns a non-zero value if :cfunc:`PyEval_InitThreads` has been called. This
|
Returns a non-zero value if :cfunc:`PyEval_InitThreads` has been called. This
|
||||||
function can be called without holding the lock, and therefore can be used to
|
function can be called without holding the GIL, and therefore can be used to
|
||||||
avoid calls to the locking API when running single-threaded. This function is
|
avoid calls to the locking API when running single-threaded. This function is
|
||||||
not available when thread support is disabled at compile time.
|
not available when thread support is disabled at compile time.
|
||||||
|
|
||||||
|
@ -617,20 +617,20 @@ supports the creation of additional interpreters (using
|
||||||
|
|
||||||
.. cfunction:: PyThreadState* PyEval_SaveThread()
|
.. cfunction:: PyThreadState* PyEval_SaveThread()
|
||||||
|
|
||||||
Release the interpreter lock (if it has been created and thread support is
|
Release the global interpreter lock (if it has been created and thread
|
||||||
enabled) and reset the thread state to *NULL*, returning the previous thread
|
support is enabled) and reset the thread state to *NULL*, returning the
|
||||||
state (which is not *NULL*). If the lock has been created, the current thread
|
previous thread state (which is not *NULL*). If the lock has been created,
|
||||||
must have acquired it. (This function is available even when thread support is
|
the current thread must have acquired it. (This function is available even
|
||||||
disabled at compile time.)
|
when thread support is disabled at compile time.)
|
||||||
|
|
||||||
|
|
||||||
.. cfunction:: void PyEval_RestoreThread(PyThreadState *tstate)
|
.. cfunction:: void PyEval_RestoreThread(PyThreadState *tstate)
|
||||||
|
|
||||||
Acquire the interpreter lock (if it has been created and thread support is
|
Acquire the global interpreter lock (if it has been created and thread
|
||||||
enabled) and set the thread state to *tstate*, which must not be *NULL*. If the
|
support is enabled) and set the thread state to *tstate*, which must not be
|
||||||
lock has been created, the current thread must not have acquired it, otherwise
|
*NULL*. If the lock has been created, the current thread must not have
|
||||||
deadlock ensues. (This function is available even when thread support is
|
acquired it, otherwise deadlock ensues. (This function is available even
|
||||||
disabled at compile time.)
|
when thread support is disabled at compile time.)
|
||||||
|
|
||||||
|
|
||||||
.. cfunction:: void PyEval_ReInitThreads()
|
.. cfunction:: void PyEval_ReInitThreads()
|
||||||
|
@ -674,60 +674,61 @@ example usage in the Python source distribution.
|
||||||
declaration. It is a no-op when thread support is disabled at compile time.
|
declaration. It is a no-op when thread support is disabled at compile time.
|
||||||
|
|
||||||
All of the following functions are only available when thread support is enabled
|
All of the following functions are only available when thread support is enabled
|
||||||
at compile time, and must be called only when the interpreter lock has been
|
at compile time, and must be called only when the global interpreter lock has
|
||||||
created.
|
been created.
|
||||||
|
|
||||||
|
|
||||||
.. cfunction:: PyInterpreterState* PyInterpreterState_New()
|
.. cfunction:: PyInterpreterState* PyInterpreterState_New()
|
||||||
|
|
||||||
Create a new interpreter state object. The interpreter lock need not be held,
|
Create a new interpreter state object. The global interpreter lock need not
|
||||||
but may be held if it is necessary to serialize calls to this function.
|
be held, but may be held if it is necessary to serialize calls to this
|
||||||
|
function.
|
||||||
|
|
||||||
|
|
||||||
.. cfunction:: void PyInterpreterState_Clear(PyInterpreterState *interp)
|
.. cfunction:: void PyInterpreterState_Clear(PyInterpreterState *interp)
|
||||||
|
|
||||||
Reset all information in an interpreter state object. The interpreter lock must
|
Reset all information in an interpreter state object. The global interpreter
|
||||||
be held.
|
lock must be held.
|
||||||
|
|
||||||
|
|
||||||
.. cfunction:: void PyInterpreterState_Delete(PyInterpreterState *interp)
|
.. cfunction:: void PyInterpreterState_Delete(PyInterpreterState *interp)
|
||||||
|
|
||||||
Destroy an interpreter state object. The interpreter lock need not be held.
|
Destroy an interpreter state object. The global interpreter lock need not be
|
||||||
The interpreter state must have been reset with a previous call to
|
held. The interpreter state must have been reset with a previous call to
|
||||||
:cfunc:`PyInterpreterState_Clear`.
|
:cfunc:`PyInterpreterState_Clear`.
|
||||||
|
|
||||||
|
|
||||||
.. cfunction:: PyThreadState* PyThreadState_New(PyInterpreterState *interp)
|
.. cfunction:: PyThreadState* PyThreadState_New(PyInterpreterState *interp)
|
||||||
|
|
||||||
Create a new thread state object belonging to the given interpreter object. The
|
Create a new thread state object belonging to the given interpreter object.
|
||||||
interpreter lock need not be held, but may be held if it is necessary to
|
The global interpreter lock need not be held, but may be held if it is
|
||||||
serialize calls to this function.
|
necessary to serialize calls to this function.
|
||||||
|
|
||||||
|
|
||||||
.. cfunction:: void PyThreadState_Clear(PyThreadState *tstate)
|
.. cfunction:: void PyThreadState_Clear(PyThreadState *tstate)
|
||||||
|
|
||||||
Reset all information in a thread state object. The interpreter lock must be
|
Reset all information in a thread state object. The global interpreter lock
|
||||||
held.
|
must be held.
|
||||||
|
|
||||||
|
|
||||||
.. cfunction:: void PyThreadState_Delete(PyThreadState *tstate)
|
.. cfunction:: void PyThreadState_Delete(PyThreadState *tstate)
|
||||||
|
|
||||||
Destroy a thread state object. The interpreter lock need not be held. The
|
Destroy a thread state object. The global interpreter lock need not be held.
|
||||||
thread state must have been reset with a previous call to
|
The thread state must have been reset with a previous call to
|
||||||
:cfunc:`PyThreadState_Clear`.
|
:cfunc:`PyThreadState_Clear`.
|
||||||
|
|
||||||
|
|
||||||
.. cfunction:: PyThreadState* PyThreadState_Get()
|
.. cfunction:: PyThreadState* PyThreadState_Get()
|
||||||
|
|
||||||
Return the current thread state. The interpreter lock must be held. When the
|
Return the current thread state. The global interpreter lock must be held.
|
||||||
current thread state is *NULL*, this issues a fatal error (so that the caller
|
When the current thread state is *NULL*, this issues a fatal error (so that
|
||||||
needn't check for *NULL*).
|
the caller needn't check for *NULL*).
|
||||||
|
|
||||||
|
|
||||||
.. cfunction:: PyThreadState* PyThreadState_Swap(PyThreadState *tstate)
|
.. cfunction:: PyThreadState* PyThreadState_Swap(PyThreadState *tstate)
|
||||||
|
|
||||||
Swap the current thread state with the thread state given by the argument
|
Swap the current thread state with the thread state given by the argument
|
||||||
*tstate*, which may be *NULL*. The interpreter lock must be held.
|
*tstate*, which may be *NULL*. The global interpreter lock must be held.
|
||||||
|
|
||||||
|
|
||||||
.. cfunction:: PyObject* PyThreadState_GetDict()
|
.. cfunction:: PyObject* PyThreadState_GetDict()
|
||||||
|
@ -752,14 +753,15 @@ created.
|
||||||
|
|
||||||
.. cfunction:: PyGILState_STATE PyGILState_Ensure()
|
.. cfunction:: PyGILState_STATE PyGILState_Ensure()
|
||||||
|
|
||||||
Ensure that the current thread is ready to call the Python C API regardless of
|
Ensure that the current thread is ready to call the Python C API regardless
|
||||||
the current state of Python, or of its thread lock. This may be called as many
|
of the current state of Python, or of the global interpreter lock. This may
|
||||||
times as desired by a thread as long as each call is matched with a call to
|
be called as many times as desired by a thread as long as each call is
|
||||||
:cfunc:`PyGILState_Release`. In general, other thread-related APIs may be used
|
matched with a call to :cfunc:`PyGILState_Release`. In general, other
|
||||||
between :cfunc:`PyGILState_Ensure` and :cfunc:`PyGILState_Release` calls as long
|
thread-related APIs may be used between :cfunc:`PyGILState_Ensure` and
|
||||||
as the thread state is restored to its previous state before the Release(). For
|
:cfunc:`PyGILState_Release` calls as long as the thread state is restored to
|
||||||
example, normal usage of the :cmacro:`Py_BEGIN_ALLOW_THREADS` and
|
its previous state before the Release(). For example, normal usage of the
|
||||||
:cmacro:`Py_END_ALLOW_THREADS` macros is acceptable.
|
:cmacro:`Py_BEGIN_ALLOW_THREADS` and :cmacro:`Py_END_ALLOW_THREADS` macros is
|
||||||
|
acceptable.
|
||||||
|
|
||||||
The return value is an opaque "handle" to the thread state when
|
The return value is an opaque "handle" to the thread state when
|
||||||
:cfunc:`PyGILState_Ensure` was called, and must be passed to
|
:cfunc:`PyGILState_Ensure` was called, and must be passed to
|
||||||
|
@ -793,35 +795,34 @@ pointer and a void argument.
|
||||||
|
|
||||||
.. index:: single: setcheckinterval() (in module sys)
|
.. index:: single: setcheckinterval() (in module sys)
|
||||||
|
|
||||||
Every check interval, when the interpreter lock is released and reacquired,
|
Every check interval, when the global interpreter lock is released and
|
||||||
python will also call any such provided functions. This can be used for
|
reacquired, python will also call any such provided functions. This can be used
|
||||||
example by asynchronous IO handlers. The notification can be scheduled
|
for example by asynchronous IO handlers. The notification can be scheduled from
|
||||||
from a worker thread and the actual call than made at the earliest
|
a worker thread and the actual call than made at the earliest convenience by the
|
||||||
convenience by the main thread where it has possession of the global
|
main thread where it has possession of the global interpreter lock and can
|
||||||
interpreter lock and can perform any Python API calls.
|
perform any Python API calls.
|
||||||
|
|
||||||
.. cfunction:: void Py_AddPendingCall( int (*func)(void *, void *arg) )
|
.. cfunction:: void Py_AddPendingCall( int (*func)(void *, void *arg) )
|
||||||
|
|
||||||
.. index:: single: Py_AddPendingCall()
|
.. index:: single: Py_AddPendingCall()
|
||||||
|
|
||||||
Post a notification to the Python main thread. If successful,
|
Post a notification to the Python main thread. If successful, *func* will be
|
||||||
*func* will be called with the argument *arg* at the earliest
|
called with the argument *arg* at the earliest convenience. *func* will be
|
||||||
convenience. *func* will be called having the global interpreter
|
called having the global interpreter lock held and can thus use the full
|
||||||
lock held and can thus use the full Python API and can take any
|
Python API and can take any action such as setting object attributes to
|
||||||
action such as setting object attributes to signal IO completion.
|
signal IO completion. It must return 0 on success, or -1 signalling an
|
||||||
It must return 0 on success, or -1 signalling an exception.
|
exception. The notification function won't be interrupted to perform another
|
||||||
The notification function won't be interrupted to perform another
|
asynchronous notification recursively, but it can still be interrupted to
|
||||||
asynchronous notification recursively,
|
switch threads if the global interpreter lock is released, for example, if it
|
||||||
but it can still be interrupted to switch threads if the interpreter
|
calls back into python code.
|
||||||
lock is released, for example, if it calls back into python code.
|
|
||||||
|
|
||||||
This function returns 0 on success in which case the notification has been
|
This function returns 0 on success in which case the notification has been
|
||||||
scheduled. Otherwise, for example if the notification buffer is full,
|
scheduled. Otherwise, for example if the notification buffer is full, it
|
||||||
it returns -1 without setting any exception.
|
returns -1 without setting any exception.
|
||||||
|
|
||||||
This function can be called on any thread, be it a Python thread or
|
This function can be called on any thread, be it a Python thread or some
|
||||||
some other system thread. If it is a Python thread, it doesn't matter if
|
other system thread. If it is a Python thread, it doesn't matter if it holds
|
||||||
it holds the global interpreter lock or not.
|
the global interpreter lock or not.
|
||||||
|
|
||||||
.. versionadded:: 2.7
|
.. versionadded:: 2.7
|
||||||
|
|
||||||
|
|
|
@ -334,9 +334,9 @@ Other options
|
||||||
|
|
||||||
There are still some other options which can be used to handle special cases.
|
There are still some other options which can be used to handle special cases.
|
||||||
|
|
||||||
The :option:`optional` option is a boolean; if it is true, that specifies that
|
The :option:`optional` option is a boolean; if it is true,
|
||||||
a build failure in the extension should not abort the build process, but simply
|
a build failure in the extension will not abort the build process, but
|
||||||
not install the failing extension.
|
instead simply not install the failing extension.
|
||||||
|
|
||||||
The :option:`extra_objects` option is a list of object files to be passed to the
|
The :option:`extra_objects` option is a list of object files to be passed to the
|
||||||
linker. These files must not have extensions, as the default extension for the
|
linker. These files must not have extensions, as the default extension for the
|
||||||
|
|
|
@ -4,6 +4,7 @@ setlocal
|
||||||
set SVNROOT=http://svn.python.org/projects
|
set SVNROOT=http://svn.python.org/projects
|
||||||
if "%PYTHON%" EQU "" set PYTHON=..\pcbuild\python
|
if "%PYTHON%" EQU "" set PYTHON=..\pcbuild\python
|
||||||
if "%HTMLHELP%" EQU "" set HTMLHELP=%ProgramFiles%\HTML Help Workshop\hhc.exe
|
if "%HTMLHELP%" EQU "" set HTMLHELP=%ProgramFiles%\HTML Help Workshop\hhc.exe
|
||||||
|
if "%DISTVERSION%" EQU "" for /f "usebackq" %%v in (`%PYTHON% tools/sphinxext/patchlevel.py`) do set DISTVERSION=%%v
|
||||||
|
|
||||||
if "%1" EQU "" goto help
|
if "%1" EQU "" goto help
|
||||||
if "%1" EQU "html" goto build
|
if "%1" EQU "html" goto build
|
||||||
|
@ -52,7 +53,7 @@ if not exist build\%1 mkdir build\%1
|
||||||
if not exist build\doctrees mkdir build\doctrees
|
if not exist build\doctrees mkdir build\doctrees
|
||||||
cmd /C %PYTHON% --version
|
cmd /C %PYTHON% --version
|
||||||
cmd /C %PYTHON% tools\sphinx-build.py -b%1 -dbuild\doctrees . build\%*
|
cmd /C %PYTHON% tools\sphinx-build.py -b%1 -dbuild\doctrees . build\%*
|
||||||
if "%1" EQU "htmlhelp" "%HTMLHELP%" build\htmlhelp\pydoc.hhp
|
if "%1" EQU "htmlhelp" "%HTMLHELP%" build\htmlhelp\python%DISTVERSION:.=%.hhp
|
||||||
goto end
|
goto end
|
||||||
|
|
||||||
:end
|
:end
|
||||||
|
|
|
@ -48,6 +48,8 @@ library/hotshot,,:lineno,"ncalls tottime percall cumtime percall filename:li
|
||||||
library/httplib,,:port,host:port
|
library/httplib,,:port,host:port
|
||||||
library/imaplib,,:MM,"""DD-Mmm-YYYY HH:MM:SS +HHMM"""
|
library/imaplib,,:MM,"""DD-Mmm-YYYY HH:MM:SS +HHMM"""
|
||||||
library/imaplib,,:SS,"""DD-Mmm-YYYY HH:MM:SS +HHMM"""
|
library/imaplib,,:SS,"""DD-Mmm-YYYY HH:MM:SS +HHMM"""
|
||||||
|
library/itertools,,:stop,elements from seq[start:stop:step]
|
||||||
|
library/itertools,,:step,elements from seq[start:stop:step]
|
||||||
library/linecache,,:sys,"sys:x:3:3:sys:/dev:/bin/sh"
|
library/linecache,,:sys,"sys:x:3:3:sys:/dev:/bin/sh"
|
||||||
library/logging,,:And,
|
library/logging,,:And,
|
||||||
library/logging,,:package1,
|
library/logging,,:package1,
|
||||||
|
|
|
|
@ -142,10 +142,11 @@ function calls leading up to the error, in the order they occurred.</p>'''
|
||||||
i = lnum - index
|
i = lnum - index
|
||||||
for line in lines:
|
for line in lines:
|
||||||
num = small(' ' * (5-len(str(i))) + str(i)) + ' '
|
num = small(' ' * (5-len(str(i))) + str(i)) + ' '
|
||||||
line = '<tt>%s%s</tt>' % (num, pydoc.html.preformat(line))
|
|
||||||
if i in highlight:
|
if i in highlight:
|
||||||
|
line = '<tt>=>%s%s</tt>' % (num, pydoc.html.preformat(line))
|
||||||
rows.append('<tr><td bgcolor="#ffccee">%s</td></tr>' % line)
|
rows.append('<tr><td bgcolor="#ffccee">%s</td></tr>' % line)
|
||||||
else:
|
else:
|
||||||
|
line = '<tt> %s%s</tt>' % (num, pydoc.html.preformat(line))
|
||||||
rows.append('<tr><td>%s</td></tr>' % grey(line))
|
rows.append('<tr><td>%s</td></tr>' % grey(line))
|
||||||
i += 1
|
i += 1
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
"""plistlib.py -- a tool to generate and parse MacOSX .plist files.
|
r"""plistlib.py -- a tool to generate and parse MacOSX .plist files.
|
||||||
|
|
||||||
The PropertList (.plist) file format is a simple XML pickle supporting
|
The PropertList (.plist) file format is a simple XML pickle supporting
|
||||||
basic object types, like dictionaries, lists, numbers and strings.
|
basic object types, like dictionaries, lists, numbers and strings.
|
||||||
|
|
|
@ -257,7 +257,10 @@ def expanduser(path):
|
||||||
userhome = pwent.pw_dir
|
userhome = pwent.pw_dir
|
||||||
if isinstance(path, bytes):
|
if isinstance(path, bytes):
|
||||||
userhome = userhome.encode(sys.getfilesystemencoding())
|
userhome = userhome.encode(sys.getfilesystemencoding())
|
||||||
userhome = userhome.rstrip(sep)
|
root = b'/'
|
||||||
|
else:
|
||||||
|
root = '/'
|
||||||
|
userhome = userhome.rstrip(root) or userhome
|
||||||
return userhome + path[i:]
|
return userhome + path[i:]
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -52,7 +52,7 @@ try:
|
||||||
except ImportError:
|
except ImportError:
|
||||||
EBADF = 9
|
EBADF = 9
|
||||||
|
|
||||||
__all__ = ["getfqdn"]
|
__all__ = ["getfqdn", "create_connection"]
|
||||||
__all__.extend(os._get_exports_list(_socket))
|
__all__.extend(os._get_exports_list(_socket))
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -357,15 +357,22 @@ class MmapTests(unittest.TestCase):
|
||||||
m.move(source, dest, size)
|
m.move(source, dest, size)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
pass
|
pass
|
||||||
self.assertRaises(ValueError, m.move, -1, -1, -1)
|
|
||||||
self.assertRaises(ValueError, m.move, -1, -1, 0)
|
offsets = [(-1, -1, -1), (-1, -1, 0), (-1, 0, -1), (0, -1, -1),
|
||||||
self.assertRaises(ValueError, m.move, -1, 0, -1)
|
(-1, 0, 0), (0, -1, 0), (0, 0, -1)]
|
||||||
self.assertRaises(ValueError, m.move, 0, -1, -1)
|
for source, dest, size in offsets:
|
||||||
self.assertRaises(ValueError, m.move, -1, 0, 0)
|
self.assertRaises(ValueError, m.move, source, dest, size)
|
||||||
self.assertRaises(ValueError, m.move, 0, -1, 0)
|
|
||||||
self.assertRaises(ValueError, m.move, 0, 0, -1)
|
|
||||||
m.close()
|
m.close()
|
||||||
|
|
||||||
|
m = mmap.mmap(-1, 1) # single byte
|
||||||
|
self.assertRaises(ValueError, m.move, 0, 0, 2)
|
||||||
|
self.assertRaises(ValueError, m.move, 1, 0, 1)
|
||||||
|
self.assertRaises(ValueError, m.move, 0, 1, 1)
|
||||||
|
m.move(0, 0, 1)
|
||||||
|
m.move(0, 0, 0)
|
||||||
|
|
||||||
|
|
||||||
def test_anonymous(self):
|
def test_anonymous(self):
|
||||||
# anonymous mmap.mmap(-1, PAGE)
|
# anonymous mmap.mmap(-1, PAGE)
|
||||||
m = mmap.mmap(-1, PAGESIZE)
|
m = mmap.mmap(-1, PAGESIZE)
|
||||||
|
|
|
@ -660,6 +660,48 @@ if sys.platform != 'win32':
|
||||||
class Win32ErrorTests(unittest.TestCase):
|
class Win32ErrorTests(unittest.TestCase):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
class PosixUidGidTests(unittest.TestCase):
|
||||||
|
if hasattr(os, 'setuid'):
|
||||||
|
def test_setuid(self):
|
||||||
|
if os.getuid() != 0:
|
||||||
|
self.assertRaises(os.error, os.setuid, 0)
|
||||||
|
self.assertRaises(OverflowError, os.setuid, 1<<32)
|
||||||
|
|
||||||
|
if hasattr(os, 'setgid'):
|
||||||
|
def test_setgid(self):
|
||||||
|
if os.getuid() != 0:
|
||||||
|
self.assertRaises(os.error, os.setgid, 0)
|
||||||
|
self.assertRaises(OverflowError, os.setgid, 1<<32)
|
||||||
|
|
||||||
|
if hasattr(os, 'seteuid'):
|
||||||
|
def test_seteuid(self):
|
||||||
|
if os.getuid() != 0:
|
||||||
|
self.assertRaises(os.error, os.seteuid, 0)
|
||||||
|
self.assertRaises(OverflowError, os.seteuid, 1<<32)
|
||||||
|
|
||||||
|
if hasattr(os, 'setegid'):
|
||||||
|
def test_setegid(self):
|
||||||
|
if os.getuid() != 0:
|
||||||
|
self.assertRaises(os.error, os.setegid, 0)
|
||||||
|
self.assertRaises(OverflowError, os.setegid, 1<<32)
|
||||||
|
|
||||||
|
if hasattr(os, 'setreuid'):
|
||||||
|
def test_setreuid(self):
|
||||||
|
if os.getuid() != 0:
|
||||||
|
self.assertRaises(os.error, os.setreuid, 0, 0)
|
||||||
|
self.assertRaises(OverflowError, os.setreuid, 1<<32, 0)
|
||||||
|
self.assertRaises(OverflowError, os.setreuid, 0, 1<<32)
|
||||||
|
|
||||||
|
if hasattr(os, 'setregid'):
|
||||||
|
def test_setregid(self):
|
||||||
|
if os.getuid() != 0:
|
||||||
|
self.assertRaises(os.error, os.setregid, 0, 0)
|
||||||
|
self.assertRaises(OverflowError, os.setregid, 1<<32, 0)
|
||||||
|
self.assertRaises(OverflowError, os.setregid, 0, 1<<32)
|
||||||
|
else:
|
||||||
|
class PosixUidGidTests(unittest.TestCase):
|
||||||
|
pass
|
||||||
|
|
||||||
def test_main():
|
def test_main():
|
||||||
support.run_unittest(
|
support.run_unittest(
|
||||||
FileTests,
|
FileTests,
|
||||||
|
@ -671,7 +713,8 @@ def test_main():
|
||||||
URandomTests,
|
URandomTests,
|
||||||
ExecTests,
|
ExecTests,
|
||||||
Win32ErrorTests,
|
Win32ErrorTests,
|
||||||
TestInvalidFD
|
TestInvalidFD,
|
||||||
|
PosixUidGidTests
|
||||||
)
|
)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
|
@ -419,6 +419,11 @@ class PosixPathTest(unittest.TestCase):
|
||||||
self.assert_(isinstance(posixpath.expanduser(b"~root/"), bytes))
|
self.assert_(isinstance(posixpath.expanduser(b"~root/"), bytes))
|
||||||
self.assert_(isinstance(posixpath.expanduser(b"~foo/"), bytes))
|
self.assert_(isinstance(posixpath.expanduser(b"~foo/"), bytes))
|
||||||
|
|
||||||
|
orig_home = os.environ['HOME']
|
||||||
|
os.environ['HOME'] = '/'
|
||||||
|
self.assertEqual(posixpath.expanduser("~"), "/")
|
||||||
|
os.environ['HOME'] = orig_home
|
||||||
|
|
||||||
self.assertRaises(TypeError, posixpath.expanduser)
|
self.assertRaises(TypeError, posixpath.expanduser)
|
||||||
|
|
||||||
def test_expandvars(self):
|
def test_expandvars(self):
|
||||||
|
|
|
@ -344,6 +344,8 @@ class SysModuleTest(unittest.TestCase):
|
||||||
self.assertEqual(len(sys.int_info), 2)
|
self.assertEqual(len(sys.int_info), 2)
|
||||||
self.assert_(sys.int_info.bits_per_digit % 5 == 0)
|
self.assert_(sys.int_info.bits_per_digit % 5 == 0)
|
||||||
self.assert_(sys.int_info.sizeof_digit >= 1)
|
self.assert_(sys.int_info.sizeof_digit >= 1)
|
||||||
|
self.assertEqual(type(sys.int_info.bits_per_digit), int)
|
||||||
|
self.assertEqual(type(sys.int_info.sizeof_digit), int)
|
||||||
self.assert_(isinstance(sys.hexversion, int))
|
self.assert_(isinstance(sys.hexversion, int))
|
||||||
self.assert_(isinstance(sys.maxsize, int))
|
self.assert_(isinstance(sys.maxsize, int))
|
||||||
self.assert_(isinstance(sys.maxunicode, int))
|
self.assert_(isinstance(sys.maxunicode, int))
|
||||||
|
@ -622,9 +624,9 @@ class SizeofTest(unittest.TestCase):
|
||||||
check(1, size(vh) + self.longdigit)
|
check(1, size(vh) + self.longdigit)
|
||||||
check(-1, size(vh) + self.longdigit)
|
check(-1, size(vh) + self.longdigit)
|
||||||
PyLong_BASE = 2**sys.int_info.bits_per_digit
|
PyLong_BASE = 2**sys.int_info.bits_per_digit
|
||||||
check(PyLong_BASE, size(vh) + 2*self.longdigit)
|
check(int(PyLong_BASE), size(vh) + 2*self.longdigit)
|
||||||
check(PyLong_BASE**2-1, size(vh) + 2*self.longdigit)
|
check(int(PyLong_BASE**2-1), size(vh) + 2*self.longdigit)
|
||||||
check(PyLong_BASE**2, size(vh) + 3*self.longdigit)
|
check(int(PyLong_BASE**2), size(vh) + 3*self.longdigit)
|
||||||
# memory
|
# memory
|
||||||
check(memoryview(b''), size(h + 'P PP2P2i7P'))
|
check(memoryview(b''), size(h + 'P PP2P2i7P'))
|
||||||
# module
|
# module
|
||||||
|
|
|
@ -620,23 +620,23 @@ mmap_seek_method(mmap_object *self, PyObject *args)
|
||||||
static PyObject *
|
static PyObject *
|
||||||
mmap_move_method(mmap_object *self, PyObject *args)
|
mmap_move_method(mmap_object *self, PyObject *args)
|
||||||
{
|
{
|
||||||
unsigned long dest, src, count;
|
unsigned long dest, src, cnt;
|
||||||
CHECK_VALID(NULL);
|
CHECK_VALID(NULL);
|
||||||
if (!PyArg_ParseTuple(args, "kkk:move", &dest, &src, &count) ||
|
if (!PyArg_ParseTuple(args, "kkk:move", &dest, &src, &cnt) ||
|
||||||
!is_writable(self)) {
|
!is_writable(self)) {
|
||||||
return NULL;
|
return NULL;
|
||||||
} else {
|
} else {
|
||||||
/* bounds check the values */
|
/* bounds check the values */
|
||||||
unsigned long pos = src > dest ? src : dest;
|
if (cnt < 0 || (cnt + dest) < cnt || (cnt + src) < cnt ||
|
||||||
if (self->size < pos || count > self->size - pos) {
|
src < 0 || src > self->size || (src + cnt) > self->size ||
|
||||||
|
dest < 0 || dest > self->size || (dest + cnt) > self->size) {
|
||||||
PyErr_SetString(PyExc_ValueError,
|
PyErr_SetString(PyExc_ValueError,
|
||||||
"source or destination out of range");
|
"source, destination, or count out of range");
|
||||||
return NULL;
|
return NULL;
|
||||||
} else {
|
|
||||||
memmove(self->data+dest, self->data+src, count);
|
|
||||||
Py_INCREF(Py_None);
|
|
||||||
return Py_None;
|
|
||||||
}
|
}
|
||||||
|
memmove(self->data+dest, self->data+src, cnt);
|
||||||
|
Py_INCREF(Py_None);
|
||||||
|
return Py_None;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4168,9 +4168,15 @@ Set the current process's user id.");
|
||||||
static PyObject *
|
static PyObject *
|
||||||
posix_setuid(PyObject *self, PyObject *args)
|
posix_setuid(PyObject *self, PyObject *args)
|
||||||
{
|
{
|
||||||
int uid;
|
long uid_arg;
|
||||||
if (!PyArg_ParseTuple(args, "i:setuid", &uid))
|
uid_t uid;
|
||||||
|
if (!PyArg_ParseTuple(args, "l:setuid", &uid_arg))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
uid = uid_arg;
|
||||||
|
if (uid != uid_arg) {
|
||||||
|
PyErr_SetString(PyExc_OverflowError, "user id too big");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
if (setuid(uid) < 0)
|
if (setuid(uid) < 0)
|
||||||
return posix_error();
|
return posix_error();
|
||||||
Py_INCREF(Py_None);
|
Py_INCREF(Py_None);
|
||||||
|
@ -4187,10 +4193,16 @@ Set the current process's effective user id.");
|
||||||
static PyObject *
|
static PyObject *
|
||||||
posix_seteuid (PyObject *self, PyObject *args)
|
posix_seteuid (PyObject *self, PyObject *args)
|
||||||
{
|
{
|
||||||
int euid;
|
long euid_arg;
|
||||||
if (!PyArg_ParseTuple(args, "i", &euid)) {
|
uid_t euid;
|
||||||
|
if (!PyArg_ParseTuple(args, "l", &euid_arg))
|
||||||
return NULL;
|
return NULL;
|
||||||
} else if (seteuid(euid) < 0) {
|
euid = euid_arg;
|
||||||
|
if (euid != euid_arg) {
|
||||||
|
PyErr_SetString(PyExc_OverflowError, "user id too big");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
if (seteuid(euid) < 0) {
|
||||||
return posix_error();
|
return posix_error();
|
||||||
} else {
|
} else {
|
||||||
Py_INCREF(Py_None);
|
Py_INCREF(Py_None);
|
||||||
|
@ -4207,10 +4219,16 @@ Set the current process's effective group id.");
|
||||||
static PyObject *
|
static PyObject *
|
||||||
posix_setegid (PyObject *self, PyObject *args)
|
posix_setegid (PyObject *self, PyObject *args)
|
||||||
{
|
{
|
||||||
int egid;
|
long egid_arg;
|
||||||
if (!PyArg_ParseTuple(args, "i", &egid)) {
|
gid_t egid;
|
||||||
|
if (!PyArg_ParseTuple(args, "l", &egid_arg))
|
||||||
return NULL;
|
return NULL;
|
||||||
} else if (setegid(egid) < 0) {
|
egid = egid_arg;
|
||||||
|
if (egid != egid_arg) {
|
||||||
|
PyErr_SetString(PyExc_OverflowError, "group id too big");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
if (setegid(egid) < 0) {
|
||||||
return posix_error();
|
return posix_error();
|
||||||
} else {
|
} else {
|
||||||
Py_INCREF(Py_None);
|
Py_INCREF(Py_None);
|
||||||
|
@ -4227,10 +4245,17 @@ Set the current process's real and effective user ids.");
|
||||||
static PyObject *
|
static PyObject *
|
||||||
posix_setreuid (PyObject *self, PyObject *args)
|
posix_setreuid (PyObject *self, PyObject *args)
|
||||||
{
|
{
|
||||||
int ruid, euid;
|
long ruid_arg, euid_arg;
|
||||||
if (!PyArg_ParseTuple(args, "ii", &ruid, &euid)) {
|
uid_t ruid, euid;
|
||||||
|
if (!PyArg_ParseTuple(args, "ll", &ruid_arg, &euid_arg))
|
||||||
return NULL;
|
return NULL;
|
||||||
} else if (setreuid(ruid, euid) < 0) {
|
ruid = ruid_arg;
|
||||||
|
euid = euid_arg;
|
||||||
|
if (euid != euid_arg || ruid != ruid_arg) {
|
||||||
|
PyErr_SetString(PyExc_OverflowError, "user id too big");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
if (setreuid(ruid, euid) < 0) {
|
||||||
return posix_error();
|
return posix_error();
|
||||||
} else {
|
} else {
|
||||||
Py_INCREF(Py_None);
|
Py_INCREF(Py_None);
|
||||||
|
@ -4247,10 +4272,17 @@ Set the current process's real and effective group ids.");
|
||||||
static PyObject *
|
static PyObject *
|
||||||
posix_setregid (PyObject *self, PyObject *args)
|
posix_setregid (PyObject *self, PyObject *args)
|
||||||
{
|
{
|
||||||
int rgid, egid;
|
long rgid_arg, egid_arg;
|
||||||
if (!PyArg_ParseTuple(args, "ii", &rgid, &egid)) {
|
gid_t rgid, egid;
|
||||||
|
if (!PyArg_ParseTuple(args, "ll", &rgid_arg, &egid_arg))
|
||||||
return NULL;
|
return NULL;
|
||||||
} else if (setregid(rgid, egid) < 0) {
|
rgid = rgid_arg;
|
||||||
|
egid = egid_arg;
|
||||||
|
if (egid != egid_arg || rgid != rgid_arg) {
|
||||||
|
PyErr_SetString(PyExc_OverflowError, "group id too big");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
if (setregid(rgid, egid) < 0) {
|
||||||
return posix_error();
|
return posix_error();
|
||||||
} else {
|
} else {
|
||||||
Py_INCREF(Py_None);
|
Py_INCREF(Py_None);
|
||||||
|
@ -4267,9 +4299,15 @@ Set the current process's group id.");
|
||||||
static PyObject *
|
static PyObject *
|
||||||
posix_setgid(PyObject *self, PyObject *args)
|
posix_setgid(PyObject *self, PyObject *args)
|
||||||
{
|
{
|
||||||
int gid;
|
long gid_arg;
|
||||||
if (!PyArg_ParseTuple(args, "i:setgid", &gid))
|
gid_t gid;
|
||||||
|
if (!PyArg_ParseTuple(args, "l:setgid", &gid_arg))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
gid = gid_arg;
|
||||||
|
if (gid != gid_arg) {
|
||||||
|
PyErr_SetString(PyExc_OverflowError, "group id too big");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
if (setgid(gid) < 0)
|
if (setgid(gid) < 0)
|
||||||
return posix_error();
|
return posix_error();
|
||||||
Py_INCREF(Py_None);
|
Py_INCREF(Py_None);
|
||||||
|
|
|
@ -1021,7 +1021,7 @@ bytes_dealloc(PyByteArrayObject *self)
|
||||||
{
|
{
|
||||||
if (self->ob_exports > 0) {
|
if (self->ob_exports > 0) {
|
||||||
PyErr_SetString(PyExc_SystemError,
|
PyErr_SetString(PyExc_SystemError,
|
||||||
"deallocated bytearray object has exported buffers");
|
"deallocated bytearray object has exported buffers");
|
||||||
PyErr_Print();
|
PyErr_Print();
|
||||||
}
|
}
|
||||||
if (self->ob_bytes != 0) {
|
if (self->ob_bytes != 0) {
|
||||||
|
@ -2616,10 +2616,10 @@ bytes_extend(PyByteArrayObject *self, PyObject *arg)
|
||||||
|
|
||||||
/* Try to determine the length of the argument. 32 is abitrary. */
|
/* Try to determine the length of the argument. 32 is abitrary. */
|
||||||
buf_size = _PyObject_LengthHint(arg, 32);
|
buf_size = _PyObject_LengthHint(arg, 32);
|
||||||
if (buf_size == -1) {
|
if (buf_size == -1) {
|
||||||
Py_DECREF(it);
|
Py_DECREF(it);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
bytes_obj = PyByteArray_FromStringAndSize(NULL, buf_size);
|
bytes_obj = PyByteArray_FromStringAndSize(NULL, buf_size);
|
||||||
if (bytes_obj == NULL)
|
if (bytes_obj == NULL)
|
||||||
|
@ -3063,10 +3063,10 @@ Returns the size of B in memory, in bytes");
|
||||||
static PyObject *
|
static PyObject *
|
||||||
bytes_sizeof(PyByteArrayObject *self)
|
bytes_sizeof(PyByteArrayObject *self)
|
||||||
{
|
{
|
||||||
Py_ssize_t res;
|
Py_ssize_t res;
|
||||||
|
|
||||||
res = sizeof(PyByteArrayObject) + self->ob_alloc * sizeof(char);
|
res = sizeof(PyByteArrayObject) + self->ob_alloc * sizeof(char);
|
||||||
return PyLong_FromSsize_t(res);
|
return PyLong_FromSsize_t(res);
|
||||||
}
|
}
|
||||||
|
|
||||||
static PySequenceMethods bytes_as_sequence = {
|
static PySequenceMethods bytes_as_sequence = {
|
||||||
|
|
|
@ -1147,7 +1147,7 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags,
|
||||||
if ((Py_ssize_t)strlen(ptr) != size) {
|
if ((Py_ssize_t)strlen(ptr) != size) {
|
||||||
Py_DECREF(s);
|
Py_DECREF(s);
|
||||||
return converterr(
|
return converterr(
|
||||||
"(encoded string without NULL bytes)",
|
"encoded string without NULL bytes",
|
||||||
arg, msgbuf, bufsize);
|
arg, msgbuf, bufsize);
|
||||||
}
|
}
|
||||||
*buffer = PyMem_NEW(char, size + 1);
|
*buffer = PyMem_NEW(char, size + 1);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue