Skip to content

Commit e2e792d

Browse files
committed
merge 3.5 (python#28184)
2 parents 1daf6da + 918aa89 commit e2e792d

File tree

7 files changed

+31
-31
lines changed

7 files changed

+31
-31
lines changed

Include/pyfpe.h

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,10 @@ extern "C" {
4545
* Define macros for handling SIGFPE.
4646
* Lee Busby, LLNL, November, 1996
4747
* busby1@llnl.gov
48-
*
48+
*
4949
*********************************************
5050
* Overview of the system for handling SIGFPE:
51-
*
51+
*
5252
* This file (Include/pyfpe.h) defines a couple of "wrapper" macros for
5353
* insertion into your Python C code of choice. Their proper use is
5454
* discussed below. The file Python/pyfpe.c defines a pair of global
@@ -59,33 +59,33 @@ extern "C" {
5959
* named fpectl. This module is standard in every respect. It can be loaded
6060
* either statically or dynamically as you choose, and like any other
6161
* Python module, has no effect until you import it.
62-
*
62+
*
6363
* In the general case, there are three steps toward handling SIGFPE in any
6464
* Python code:
65-
*
65+
*
6666
* 1) Add the *_PROTECT macros to your C code as required to protect
6767
* dangerous floating point sections.
68-
*
68+
*
6969
* 2) Turn on the inclusion of the code by adding the ``--with-fpectl''
7070
* flag at the time you run configure. If the fpectl or other modules
7171
* which use the *_PROTECT macros are to be dynamically loaded, be
7272
* sure they are compiled with WANT_SIGFPE_HANDLER defined.
73-
*
73+
*
7474
* 3) When python is built and running, import fpectl, and execute
7575
* fpectl.turnon_sigfpe(). This sets up the signal handler and enables
7676
* generation of SIGFPE whenever an exception occurs. From this point
7777
* on, any properly trapped SIGFPE should result in the Python
7878
* FloatingPointError exception.
79-
*
79+
*
8080
* Step 1 has been done already for the Python kernel code, and should be
8181
* done soon for the NumPy array package. Step 2 is usually done once at
8282
* python install time. Python's behavior with respect to SIGFPE is not
8383
* changed unless you also do step 3. Thus you can control this new
8484
* facility at compile time, or run time, or both.
85-
*
86-
********************************
85+
*
86+
********************************
8787
* Using the macros in your code:
88-
*
88+
*
8989
* static PyObject *foobar(PyObject *self,PyObject *args)
9090
* {
9191
* ....
@@ -94,35 +94,35 @@ extern "C" {
9494
* PyFPE_END_PROTECT(result)
9595
* ....
9696
* }
97-
*
97+
*
9898
* If a floating point error occurs in dangerous_op, foobar returns 0 (NULL),
9999
* after setting the associated value of the FloatingPointError exception to
100100
* "Error in foobar". ``Dangerous_op'' can be a single operation, or a block
101101
* of code, function calls, or any combination, so long as no alternate
102102
* return is possible before the PyFPE_END_PROTECT macro is reached.
103-
*
103+
*
104104
* The macros can only be used in a function context where an error return
105105
* can be recognized as signaling a Python exception. (Generally, most
106106
* functions that return a PyObject * will qualify.)
107-
*
107+
*
108108
* Guido's original design suggestion for PyFPE_START_PROTECT and
109109
* PyFPE_END_PROTECT had them open and close a local block, with a locally
110110
* defined jmp_buf and jmp_buf pointer. This would allow recursive nesting
111111
* of the macros. The Ansi C standard makes it clear that such local
112112
* variables need to be declared with the "volatile" type qualifier to keep
113113
* setjmp from corrupting their values. Some current implementations seem
114114
* to be more restrictive. For example, the HPUX man page for setjmp says
115-
*
115+
*
116116
* Upon the return from a setjmp() call caused by a longjmp(), the
117117
* values of any non-static local variables belonging to the routine
118118
* from which setjmp() was called are undefined. Code which depends on
119119
* such values is not guaranteed to be portable.
120-
*
120+
*
121121
* I therefore decided on a more limited form of nesting, using a counter
122122
* variable (PyFPE_counter) to keep track of any recursion. If an exception
123123
* occurs in an ``inner'' pair of macros, the return will apparently
124124
* come from the outermost level.
125-
*
125+
*
126126
*/
127127

128128
#ifdef WANT_SIGFPE_HANDLER
@@ -146,14 +146,14 @@ if (!PyFPE_counter++ && setjmp(PyFPE_jbuf)) { \
146146
* this statement so that it gets executed *before* the unsafe expression
147147
* which we're trying to protect. That pretty well messes things up,
148148
* of course.
149-
*
149+
*
150150
* If the expression(s) you're trying to protect don't happen to return a
151151
* value, you will need to manufacture a dummy result just to preserve the
152152
* correct ordering of statements. Note that the macro passes the address
153153
* of its argument (so you need to give it something which is addressable).
154154
* If your expression returns multiple results, pass the last such result
155155
* to PyFPE_END_PROTECT.
156-
*
156+
*
157157
* Note that PyFPE_dummy returns a double, which is cast to int.
158158
* This seeming insanity is to tickle the Floating Point Unit (FPU).
159159
* If an exception has occurred in a preceding floating point operation,

Include/pyport.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -747,7 +747,7 @@ extern pid_t forkpty(int *, char *, struct termios *, struct winsize *);
747747
#define PY_LITTLE_ENDIAN 1
748748
#endif
749749

750-
#ifdef Py_BUILD_CORE
750+
#ifdef Py_BUILD_CORE
751751
/*
752752
* Macros to protect CRT calls against instant termination when passed an
753753
* invalid parameter (issue23524).

Misc/coverity_model.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ static PyObject *
139139
build_struct_time(int y, int m, int d, int hh, int mm, int ss, int dstflag)
140140
{
141141
PyObject *result;
142-
142+
143143
__coverity_tainted_data_sanitize__(y);
144144
__coverity_tainted_data_sanitize__(m);
145145
__coverity_tainted_data_sanitize__(d);

Modules/_io/winconsoleio.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ char _get_console_type(HANDLE handle) {
4444

4545
if (handle == INVALID_HANDLE_VALUE)
4646
return '\0';
47-
47+
4848
if (!GetConsoleMode(handle, &mode))
4949
return '\0';
5050

@@ -803,7 +803,7 @@ _io__WindowsConsoleIO_readall_impl(winconsoleio *self)
803803
bytes_size = WideCharToMultiByte(CP_UTF8, 0, buf, len,
804804
NULL, 0, NULL, NULL);
805805
Py_END_ALLOW_THREADS
806-
806+
807807
if (!bytes_size) {
808808
DWORD err = GetLastError();
809809
PyMem_Free(buf);
@@ -854,7 +854,7 @@ _io__WindowsConsoleIO_read_impl(winconsoleio *self, Py_ssize_t size)
854854
{
855855
PyObject *bytes;
856856
Py_ssize_t bytes_size;
857-
857+
858858
if (self->handle == INVALID_HANDLE_VALUE)
859859
return err_closed();
860860
if (!self->readable)
@@ -929,7 +929,7 @@ _io__WindowsConsoleIO_write_impl(winconsoleio *self, Py_buffer *b)
929929
wlen = MultiByteToWideChar(CP_UTF8, 0, b->buf, len, NULL, 0);
930930
}
931931
Py_END_ALLOW_THREADS
932-
932+
933933
if (!wlen)
934934
return PyErr_SetFromWindowsErr(0);
935935

@@ -956,7 +956,7 @@ _io__WindowsConsoleIO_write_impl(winconsoleio *self, Py_buffer *b)
956956
} else
957957
res = 0;
958958
Py_END_ALLOW_THREADS
959-
959+
960960
if (!res) {
961961
DWORD err = GetLastError();
962962
PyMem_Free(wbuf);
@@ -996,7 +996,7 @@ _io__WindowsConsoleIO_isatty_impl(winconsoleio *self)
996996
{
997997
if (self->handle == INVALID_HANDLE_VALUE)
998998
return err_closed();
999-
999+
10001000
Py_RETURN_TRUE;
10011001
}
10021002

Modules/_struct.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,7 @@ nu_halffloat(const char *p, const formatdef *f)
486486
return unpack_halffloat(p, 1);
487487
#else
488488
return unpack_halffloat(p, 0);
489-
#endif
489+
#endif
490490
}
491491

492492
static PyObject *

Modules/expat/pyexpatns.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
* http://lxr.mozilla.org/seamonkey/source/modules/libimg/png/mozpngconf.h#115
2727
*
2828
* The list of relevant exported symbols can be had with this command:
29-
*
29+
*
3030
nm pyexpat.so \
3131
| grep -v " [a-zBUA] " \
3232
| grep -v "_fini\|_init\|initpyexpat"

Parser/myreadline.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ _PyOS_WindowsConsoleReadline(HANDLE hStdIn)
172172
buf = PyMem_RawMalloc(u8len + 1);
173173
u8len = WideCharToMultiByte(CP_UTF8, 0, wbuf, total_read, buf, u8len, NULL, NULL);
174174
buf[u8len] = '\0';
175-
175+
176176
exit:
177177
if (wbuf != wbuf_local)
178178
PyMem_RawFree(wbuf);
@@ -204,11 +204,11 @@ PyOS_StdioReadline(FILE *sys_stdin, FILE *sys_stdout, const char *prompt)
204204
#ifdef MS_WINDOWS
205205
if (!Py_LegacyWindowsStdioFlag && sys_stdin == stdin) {
206206
HANDLE hStdIn;
207-
207+
208208
_Py_BEGIN_SUPPRESS_IPH
209209
hStdIn = (HANDLE)_get_osfhandle(fileno(sys_stdin));
210210
_Py_END_SUPPRESS_IPH
211-
211+
212212
if (_get_console_type(hStdIn) == 'r') {
213213
fflush(sys_stdout);
214214
if (prompt)

0 commit comments

Comments
 (0)