Skip to content

Commit d678ee7

Browse files
authored
[3.11] Trim trailing whitespace and test on CI (GH-104275) (#108215)
1 parent 8e83737 commit d678ee7

24 files changed

+150
-120
lines changed

.github/CODEOWNERS

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@
55
# https://git-scm.com/docs/gitignore#_pattern_format
66

77
# GitHub
8-
.github/** @ezio-melotti
8+
.github/** @ezio-melotti @hugovk
9+
10+
# pre-commit
11+
.pre-commit-config.yaml @hugovk @AlexWaygood
912

1013
# asyncio
1114
**/*asyncio* @1st1 @asvetlov

.github/workflows/lint.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Lint
2+
3+
on: [push, pull_request, workflow_dispatch]
4+
5+
permissions:
6+
contents: read
7+
8+
concurrency:
9+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
10+
cancel-in-progress: true
11+
12+
jobs:
13+
lint:
14+
runs-on: ubuntu-latest
15+
timeout-minutes: 10
16+
17+
steps:
18+
- uses: actions/checkout@v3
19+
- uses: actions/setup-python@v4
20+
with:
21+
python-version: "3.x"
22+
- uses: pre-commit/[email protected]

.pre-commit-config.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v4.4.0
4+
hooks:
5+
- id: check-yaml
6+
- id: trailing-whitespace
7+
types_or: [c, python, rst]

Lib/test/test_asyncio/test_runners.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,7 @@ async def coro():
441441
with asyncio.Runner() as runner:
442442
with self.assertRaises(asyncio.CancelledError):
443443
runner.run(coro())
444-
444+
445445
def test_signal_install_not_supported_ok(self):
446446
# signal.signal() can throw if the "main thread" doensn't have signals enabled
447447
assert threading.current_thread() is threading.main_thread()

Lib/test/test_isinstance.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
from test import support
99

1010

11-
1211
class TestIsInstanceExceptions(unittest.TestCase):
1312
# Test to make sure that an AttributeError when accessing the instance's
1413
# class's bases is masked. This was actually a bug in Python 2.2 and
@@ -97,7 +96,7 @@ def getclass(self):
9796
class D: pass
9897
self.assertRaises(RuntimeError, isinstance, c, D)
9998

100-
99+
101100
# These tests are similar to above, but tickle certain code paths in
102101
# issubclass() instead of isinstance() -- really PyObject_IsSubclass()
103102
# vs. PyObject_IsInstance().
@@ -147,7 +146,6 @@ def getbases(self):
147146
self.assertRaises(TypeError, issubclass, B, C())
148147

149148

150-
151149
# meta classes for creating abstract classes and instances
152150
class AbstractClass(object):
153151
def __init__(self, bases):
@@ -179,7 +177,7 @@ class Super:
179177

180178
class Child(Super):
181179
pass
182-
180+
183181
class TestIsInstanceIsSubclass(unittest.TestCase):
184182
# Tests to ensure that isinstance and issubclass work on abstract
185183
# classes and instances. Before the 2.2 release, TypeErrors were
@@ -357,6 +355,6 @@ def blowstack(fxn, arg, compare_to):
357355
tuple_arg = (tuple_arg,)
358356
fxn(arg, tuple_arg)
359357

360-
358+
361359
if __name__ == '__main__':
362360
unittest.main()

Modules/_blake2/blake2module.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,6 @@
3838
#endif // HAVE_LIBB2
3939

4040
// for secure_zero_memory(), store32(), store48(), and store64()
41-
#include "impl/blake2-impl.h"
41+
#include "impl/blake2-impl.h"
4242

4343
#endif // Py_BLAKE2MODULE_H

Modules/_blake2/impl/blake2b-round.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
\
6363
row2l = _mm_roti_epi64(row2l, -24); \
6464
row2h = _mm_roti_epi64(row2h, -24); \
65-
65+
6666
#define G2(row1l,row2l,row3l,row4l,row1h,row2h,row3h,row4h,b0,b1) \
6767
row1l = _mm_add_epi64(_mm_add_epi64(row1l, b0), row2l); \
6868
row1h = _mm_add_epi64(_mm_add_epi64(row1h, b1), row2h); \
@@ -81,7 +81,7 @@
8181
\
8282
row2l = _mm_roti_epi64(row2l, -63); \
8383
row2h = _mm_roti_epi64(row2h, -63); \
84-
84+
8585
#if defined(HAVE_SSSE3)
8686
#define DIAGONALIZE(row1l,row2l,row3l,row4l,row1h,row2h,row3h,row4h) \
8787
t0 = _mm_alignr_epi8(row2h, row2l, 8); \

Modules/_blake2/impl/blake2s-load-xop.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ buf = _mm_perm_epi8(t1, m3, _mm_set_epi32(TOB(3),TOB(2),TOB(1),TOB(7)) );
166166
#define LOAD_MSG_8_3(buf) \
167167
t0 = _mm_perm_epi8(m0, m2, _mm_set_epi32(TOB(6),TOB(1),TOB(0),TOB(0)) ); \
168168
buf = _mm_perm_epi8(t0, m3, _mm_set_epi32(TOB(3),TOB(2),TOB(5),TOB(4)) ); \
169-
169+
170170
#define LOAD_MSG_8_4(buf) \
171171
buf = _mm_perm_epi8(m0, m1, _mm_set_epi32(TOB(5),TOB(4),TOB(7),TOB(2)) );
172172

Modules/_blake2/impl/blake2s-round.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,6 @@
8686
LOAD_MSG_ ##r ##_4(buf4); \
8787
G2(row1,row2,row3,row4,buf4); \
8888
UNDIAGONALIZE(row1,row2,row3,row4); \
89-
89+
9090
#endif
9191

Modules/_ctypes/darwin/dlfcn.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
Copyright (c) 2002 Jorge Acereda <[email protected]> &
33
Peter O'Gorman <[email protected]>
4-
4+
55
Portions may be copyright others, see the AUTHORS file included with this
66
distribution.
77

Modules/_ctypes/libffi_osx/ffi.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,12 @@ initialize_aggregate(
6565

6666
arg->size = ALIGN(arg->size, curalign);
6767
arg->size += (*ptr)->size;
68-
arg->alignment = (arg->alignment > curalign) ?
68+
arg->alignment = (arg->alignment > curalign) ?
6969
arg->alignment : curalign;
7070
#else
7171
arg->size = ALIGN(arg->size, (*ptr)->alignment);
7272
arg->size += (*ptr)->size;
73-
arg->alignment = (arg->alignment > (*ptr)->alignment) ?
73+
arg->alignment = (arg->alignment > (*ptr)->alignment) ?
7474
arg->alignment : (*ptr)->alignment;
7575
#endif
7676

@@ -130,10 +130,10 @@ struct_on_stack(
130130
// Arguments' ffi_type->alignment must be nonzero.
131131
ffi_status
132132
ffi_prep_cif(
133-
/*@out@*/ /*@partial@*/ ffi_cif* cif,
133+
/*@out@*/ /*@partial@*/ ffi_cif* cif,
134134
ffi_abi abi,
135-
unsigned int nargs,
136-
/*@dependent@*/ /*@out@*/ /*@partial@*/ ffi_type* rtype,
135+
unsigned int nargs,
136+
/*@dependent@*/ /*@out@*/ /*@partial@*/ ffi_type* rtype,
137137
/*@dependent@*/ ffi_type** atypes)
138138
{
139139
unsigned int bytes = 0;
@@ -184,7 +184,7 @@ ffi_prep_cif(
184184
if ((*ptr)->alignment == 0)
185185
return FFI_BAD_TYPEDEF;
186186

187-
/* Perform a sanity check on the argument type, do this
187+
/* Perform a sanity check on the argument type, do this
188188
check after the initialization. */
189189
FFI_ASSERT_VALID_TYPE(*ptr);
190190

Modules/_ctypes/libffi_osx/include/ffi.h

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -199,9 +199,9 @@ typedef union {
199199

200200
void
201201
ffi_raw_call(
202-
/*@dependent@*/ ffi_cif* cif,
203-
void (*fn)(void),
204-
/*@out@*/ void* rvalue,
202+
/*@dependent@*/ ffi_cif* cif,
203+
void (*fn)(void),
204+
/*@out@*/ void* rvalue,
205205
/*@dependent@*/ ffi_raw* avalue);
206206

207207
void
@@ -225,9 +225,9 @@ ffi_raw_size(
225225
longs and doubles are followed by an empty 64-bit word. */
226226
void
227227
ffi_java_raw_call(
228-
/*@dependent@*/ ffi_cif* cif,
229-
void (*fn)(void),
230-
/*@out@*/ void* rvalue,
228+
/*@dependent@*/ ffi_cif* cif,
229+
void (*fn)(void),
230+
/*@out@*/ void* rvalue,
231231
/*@dependent@*/ ffi_raw* avalue);
232232

233233
void
@@ -272,8 +272,8 @@ typedef struct ffi_raw_closure {
272272
ffi_cif* cif;
273273

274274
#if !FFI_NATIVE_RAW_API
275-
/* if this is enabled, then a raw closure has the same layout
276-
as a regular closure. We use this to install an intermediate
275+
/* if this is enabled, then a raw closure has the same layout
276+
as a regular closure. We use this to install an intermediate
277277
handler to do the transaltion, void** -> ffi_raw*. */
278278
void (*translate_args)(ffi_cif*,void*,void**,void*);
279279
void* this_closure;
@@ -303,17 +303,17 @@ ffi_prep_java_raw_closure(
303303

304304
ffi_status
305305
ffi_prep_cif(
306-
/*@out@*/ /*@partial@*/ ffi_cif* cif,
306+
/*@out@*/ /*@partial@*/ ffi_cif* cif,
307307
ffi_abi abi,
308-
unsigned int nargs,
309-
/*@dependent@*/ /*@out@*/ /*@partial@*/ ffi_type* rtype,
308+
unsigned int nargs,
309+
/*@dependent@*/ /*@out@*/ /*@partial@*/ ffi_type* rtype,
310310
/*@dependent@*/ ffi_type** atypes);
311311

312312
void
313313
ffi_call(
314-
/*@dependent@*/ ffi_cif* cif,
315-
void (*fn)(void),
316-
/*@out@*/ void* rvalue,
314+
/*@dependent@*/ ffi_cif* cif,
315+
void (*fn)(void),
316+
/*@out@*/ void* rvalue,
317317
/*@dependent@*/ void** avalue);
318318

319319
/* Useful for eliminating compiler warnings */

Modules/_ctypes/libffi_osx/include/ffi_common.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ char* alloca();
4141
# endif
4242
#endif
4343

44-
/*#if defined(FFI_DEBUG)
44+
/*#if defined(FFI_DEBUG)
4545
#include <stdio.h>
4646
#endif*/
4747

@@ -65,7 +65,7 @@ ffi_type_test(
6565
# define FFI_ASSERT_AT(x, f, l) ((x) ? 0 : ffi_assert(#x, (f), (l)))
6666
# define FFI_ASSERT_VALID_TYPE(x) ffi_type_test(x, __FILE__, __LINE__)
6767
#else
68-
# define FFI_ASSERT(x)
68+
# define FFI_ASSERT(x)
6969
# define FFI_ASSERT_AT(x, f, l)
7070
# define FFI_ASSERT_VALID_TYPE(x)
7171
#endif // #ifdef FFI_DEBUG

Modules/_ctypes/libffi_osx/include/fficonfig.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Manually created fficonfig.h for Darwin on PowerPC or Intel
1+
/* Manually created fficonfig.h for Darwin on PowerPC or Intel
22
33
This file is manually generated to do away with the need for autoconf and
44
therefore make it easier to cross-compile and build fat binaries.
@@ -33,10 +33,10 @@
3333
# define SIZEOF_DOUBLE 8
3434
# if __GNUC__ >= 4
3535
# define HAVE_LONG_DOUBLE 1
36-
# define SIZEOF_LONG_DOUBLE 16
36+
# define SIZEOF_LONG_DOUBLE 16
3737
# else
3838
# undef HAVE_LONG_DOUBLE
39-
# define SIZEOF_LONG_DOUBLE 8
39+
# define SIZEOF_LONG_DOUBLE 8
4040
# endif
4141

4242
#elif defined(__ppc64__)

Modules/_ctypes/libffi_osx/include/x86-ffitarget.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
# define X86
3434
#endif
3535

36-
#if defined(__x86_64__)
36+
#if defined(__x86_64__)
3737
# ifndef X86_64
3838
# define X86_64
3939
# endif

Modules/_ctypes/libffi_osx/powerpc/ppc-ffi_darwin.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -891,7 +891,7 @@ ffi_closure_helper_DARWIN(
891891
avalue[i] = alloca(arg_types[i]->size);
892892
ffi64_struct_to_ram_form(arg_types[i], (const char*)pgr,
893893
&gprSize, (const char*)pfr, &fprSize, &nf, avalue[i], NULL);
894-
894+
895895
ng += gprSize / sizeof(long);
896896
pgr += gprSize / sizeof(long);
897897
pfr += (fprSize - savedFPRSize) / sizeof(double);
@@ -1479,7 +1479,7 @@ ffi64_struct_to_reg_form(
14791479
memcpy(&outGPRs[destGMarker],
14801480
&inStruct[srcMarker], inType->size);
14811481
}
1482-
1482+
14831483
srcMarker += inType->size;
14841484
destGMarker += inType->size;
14851485
i += inType->size - 1;
@@ -1561,7 +1561,7 @@ ffi64_struct_to_reg_form(
15611561
case FFI_TYPE_STRUCT:
15621562
recurseCount++;
15631563
ffi64_struct_to_reg_form(inType->elements[i],
1564-
inStruct, &srcMarker, &fprsUsed, outGPRs,
1564+
inStruct, &srcMarker, &fprsUsed, outGPRs,
15651565
&destGMarker, outFPRs, &destFMarker);
15661566
recurseCount--;
15671567
break;

Modules/_ctypes/libffi_osx/types.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* -----------------------------------------------------------------------
22
types.c - Copyright (c) 1996, 1998 Red Hat, Inc.
3-
3+
44
Predefined ffi_types needed by libffi.
55
66
Permission is hereby granted, free of charge, to any person obtaining
@@ -85,7 +85,7 @@ FFI_INTEGRAL_TYPEDEF(sint64, 8, 8, FFI_TYPE_SINT64);
8585
FFI_INTEGRAL_TYPEDEF(longdouble, 12, 4, FFI_TYPE_LONGDOUBLE);
8686
# endif
8787

88-
#elif defined ARM || defined SH || defined POWERPC_AIX
88+
#elif defined ARM || defined SH || defined POWERPC_AIX
8989
FFI_INTEGRAL_TYPEDEF(double, 8, 4, FFI_TYPE_DOUBLE);
9090
FFI_INTEGRAL_TYPEDEF(longdouble, 8, 4, FFI_TYPE_LONGDOUBLE);
9191
#elif defined POWERPC_DARWIN

Modules/_ctypes/libffi_osx/x86/x86-ffi64.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
/* -----------------------------------------------------------------------
44
x86-ffi64.c - Copyright (c) 2002 Bo Thorsen <[email protected]>
5-
6-
x86-64 Foreign Function Interface
5+
6+
x86-64 Foreign Function Interface
77
88
Permission is hereby granted, free of charge, to any person obtaining
99
a copy of this software and associated documentation files (the
@@ -208,7 +208,7 @@ classify_argument(
208208

209209
case FFI_TYPE_STRUCT:
210210
{
211-
ffi_type** ptr;
211+
ffi_type** ptr;
212212
int i;
213213
enum x86_64_reg_class subclasses[MAX_CLASSES];
214214
const int UNITS_PER_WORD = 8;

0 commit comments

Comments
 (0)