Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[3.11] Trim trailing whitespace and test on CI (GH-104275) #108215

Merged
merged 8 commits into from
Aug 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@
# https://git-scm.com/docs/gitignore#_pattern_format

# GitHub
.github/** @ezio-melotti
.github/** @ezio-melotti @hugovk

# pre-commit
.pre-commit-config.yaml @hugovk @AlexWaygood

# asyncio
**/*asyncio* @1st1 @asvetlov
Expand Down
22 changes: 22 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Lint

on: [push, pull_request, workflow_dispatch]

permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
lint:
runs-on: ubuntu-latest
timeout-minutes: 10

steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.x"
- uses: pre-commit/action@v3.0.0
7 changes: 7 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: check-yaml
- id: trailing-whitespace
types_or: [c, python, rst]
2 changes: 1 addition & 1 deletion Lib/test/test_asyncio/test_runners.py
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ async def coro():
with asyncio.Runner() as runner:
with self.assertRaises(asyncio.CancelledError):
runner.run(coro())

def test_signal_install_not_supported_ok(self):
# signal.signal() can throw if the "main thread" doensn't have signals enabled
assert threading.current_thread() is threading.main_thread()
Expand Down
8 changes: 3 additions & 5 deletions Lib/test/test_isinstance.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
from test import support



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


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



# meta classes for creating abstract classes and instances
class AbstractClass(object):
def __init__(self, bases):
Expand Down Expand Up @@ -179,7 +177,7 @@ class Super:

class Child(Super):
pass

class TestIsInstanceIsSubclass(unittest.TestCase):
# Tests to ensure that isinstance and issubclass work on abstract
# classes and instances. Before the 2.2 release, TypeErrors were
Expand Down Expand Up @@ -357,6 +355,6 @@ def blowstack(fxn, arg, compare_to):
tuple_arg = (tuple_arg,)
fxn(arg, tuple_arg)


if __name__ == '__main__':
unittest.main()
2 changes: 1 addition & 1 deletion Modules/_blake2/blake2module.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,6 @@
#endif // HAVE_LIBB2

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

#endif // Py_BLAKE2MODULE_H
4 changes: 2 additions & 2 deletions Modules/_blake2/impl/blake2b-round.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
\
row2l = _mm_roti_epi64(row2l, -24); \
row2h = _mm_roti_epi64(row2h, -24); \

#define G2(row1l,row2l,row3l,row4l,row1h,row2h,row3h,row4h,b0,b1) \
row1l = _mm_add_epi64(_mm_add_epi64(row1l, b0), row2l); \
row1h = _mm_add_epi64(_mm_add_epi64(row1h, b1), row2h); \
Expand All @@ -81,7 +81,7 @@
\
row2l = _mm_roti_epi64(row2l, -63); \
row2h = _mm_roti_epi64(row2h, -63); \

#if defined(HAVE_SSSE3)
#define DIAGONALIZE(row1l,row2l,row3l,row4l,row1h,row2h,row3h,row4h) \
t0 = _mm_alignr_epi8(row2h, row2l, 8); \
Expand Down
2 changes: 1 addition & 1 deletion Modules/_blake2/impl/blake2s-load-xop.h
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ buf = _mm_perm_epi8(t1, m3, _mm_set_epi32(TOB(3),TOB(2),TOB(1),TOB(7)) );
#define LOAD_MSG_8_3(buf) \
t0 = _mm_perm_epi8(m0, m2, _mm_set_epi32(TOB(6),TOB(1),TOB(0),TOB(0)) ); \
buf = _mm_perm_epi8(t0, m3, _mm_set_epi32(TOB(3),TOB(2),TOB(5),TOB(4)) ); \

#define LOAD_MSG_8_4(buf) \
buf = _mm_perm_epi8(m0, m1, _mm_set_epi32(TOB(5),TOB(4),TOB(7),TOB(2)) );

Expand Down
2 changes: 1 addition & 1 deletion Modules/_blake2/impl/blake2s-round.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,6 @@
LOAD_MSG_ ##r ##_4(buf4); \
G2(row1,row2,row3,row4,buf4); \
UNDIAGONALIZE(row1,row2,row3,row4); \

#endif

2 changes: 1 addition & 1 deletion Modules/_ctypes/darwin/dlfcn.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
Copyright (c) 2002 Jorge Acereda <jacereda@users.sourceforge.net> &
Peter O'Gorman <ogorman@users.sourceforge.net>

Portions may be copyright others, see the AUTHORS file included with this
distribution.

Expand Down
12 changes: 6 additions & 6 deletions Modules/_ctypes/libffi_osx/ffi.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,12 @@ initialize_aggregate(

arg->size = ALIGN(arg->size, curalign);
arg->size += (*ptr)->size;
arg->alignment = (arg->alignment > curalign) ?
arg->alignment = (arg->alignment > curalign) ?
arg->alignment : curalign;
#else
arg->size = ALIGN(arg->size, (*ptr)->alignment);
arg->size += (*ptr)->size;
arg->alignment = (arg->alignment > (*ptr)->alignment) ?
arg->alignment = (arg->alignment > (*ptr)->alignment) ?
arg->alignment : (*ptr)->alignment;
#endif

Expand Down Expand Up @@ -130,10 +130,10 @@ struct_on_stack(
// Arguments' ffi_type->alignment must be nonzero.
ffi_status
ffi_prep_cif(
/*@out@*/ /*@partial@*/ ffi_cif* cif,
/*@out@*/ /*@partial@*/ ffi_cif* cif,
ffi_abi abi,
unsigned int nargs,
/*@dependent@*/ /*@out@*/ /*@partial@*/ ffi_type* rtype,
unsigned int nargs,
/*@dependent@*/ /*@out@*/ /*@partial@*/ ffi_type* rtype,
/*@dependent@*/ ffi_type** atypes)
{
unsigned int bytes = 0;
Expand Down Expand Up @@ -184,7 +184,7 @@ ffi_prep_cif(
if ((*ptr)->alignment == 0)
return FFI_BAD_TYPEDEF;

/* Perform a sanity check on the argument type, do this
/* Perform a sanity check on the argument type, do this
check after the initialization. */
FFI_ASSERT_VALID_TYPE(*ptr);

Expand Down
28 changes: 14 additions & 14 deletions Modules/_ctypes/libffi_osx/include/ffi.h
Original file line number Diff line number Diff line change
Expand Up @@ -199,9 +199,9 @@ typedef union {

void
ffi_raw_call(
/*@dependent@*/ ffi_cif* cif,
void (*fn)(void),
/*@out@*/ void* rvalue,
/*@dependent@*/ ffi_cif* cif,
void (*fn)(void),
/*@out@*/ void* rvalue,
/*@dependent@*/ ffi_raw* avalue);

void
Expand All @@ -225,9 +225,9 @@ ffi_raw_size(
longs and doubles are followed by an empty 64-bit word. */
void
ffi_java_raw_call(
/*@dependent@*/ ffi_cif* cif,
void (*fn)(void),
/*@out@*/ void* rvalue,
/*@dependent@*/ ffi_cif* cif,
void (*fn)(void),
/*@out@*/ void* rvalue,
/*@dependent@*/ ffi_raw* avalue);

void
Expand Down Expand Up @@ -272,8 +272,8 @@ typedef struct ffi_raw_closure {
ffi_cif* cif;

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

ffi_status
ffi_prep_cif(
/*@out@*/ /*@partial@*/ ffi_cif* cif,
/*@out@*/ /*@partial@*/ ffi_cif* cif,
ffi_abi abi,
unsigned int nargs,
/*@dependent@*/ /*@out@*/ /*@partial@*/ ffi_type* rtype,
unsigned int nargs,
/*@dependent@*/ /*@out@*/ /*@partial@*/ ffi_type* rtype,
/*@dependent@*/ ffi_type** atypes);

void
ffi_call(
/*@dependent@*/ ffi_cif* cif,
void (*fn)(void),
/*@out@*/ void* rvalue,
/*@dependent@*/ ffi_cif* cif,
void (*fn)(void),
/*@out@*/ void* rvalue,
/*@dependent@*/ void** avalue);

/* Useful for eliminating compiler warnings */
Expand Down
4 changes: 2 additions & 2 deletions Modules/_ctypes/libffi_osx/include/ffi_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ char* alloca();
# endif
#endif

/*#if defined(FFI_DEBUG)
/*#if defined(FFI_DEBUG)
#include <stdio.h>
#endif*/

Expand All @@ -65,7 +65,7 @@ ffi_type_test(
# define FFI_ASSERT_AT(x, f, l) ((x) ? 0 : ffi_assert(#x, (f), (l)))
# define FFI_ASSERT_VALID_TYPE(x) ffi_type_test(x, __FILE__, __LINE__)
#else
# define FFI_ASSERT(x)
# define FFI_ASSERT(x)
# define FFI_ASSERT_AT(x, f, l)
# define FFI_ASSERT_VALID_TYPE(x)
#endif // #ifdef FFI_DEBUG
Expand Down
6 changes: 3 additions & 3 deletions Modules/_ctypes/libffi_osx/include/fficonfig.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Manually created fficonfig.h for Darwin on PowerPC or Intel
/* Manually created fficonfig.h for Darwin on PowerPC or Intel

This file is manually generated to do away with the need for autoconf and
therefore make it easier to cross-compile and build fat binaries.
Expand Down Expand Up @@ -33,10 +33,10 @@
# define SIZEOF_DOUBLE 8
# if __GNUC__ >= 4
# define HAVE_LONG_DOUBLE 1
# define SIZEOF_LONG_DOUBLE 16
# define SIZEOF_LONG_DOUBLE 16
# else
# undef HAVE_LONG_DOUBLE
# define SIZEOF_LONG_DOUBLE 8
# define SIZEOF_LONG_DOUBLE 8
# endif

#elif defined(__ppc64__)
Expand Down
2 changes: 1 addition & 1 deletion Modules/_ctypes/libffi_osx/include/x86-ffitarget.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
# define X86
#endif

#if defined(__x86_64__)
#if defined(__x86_64__)
# ifndef X86_64
# define X86_64
# endif
Expand Down
6 changes: 3 additions & 3 deletions Modules/_ctypes/libffi_osx/powerpc/ppc-ffi_darwin.c
Original file line number Diff line number Diff line change
Expand Up @@ -891,7 +891,7 @@ ffi_closure_helper_DARWIN(
avalue[i] = alloca(arg_types[i]->size);
ffi64_struct_to_ram_form(arg_types[i], (const char*)pgr,
&gprSize, (const char*)pfr, &fprSize, &nf, avalue[i], NULL);

ng += gprSize / sizeof(long);
pgr += gprSize / sizeof(long);
pfr += (fprSize - savedFPRSize) / sizeof(double);
Expand Down Expand Up @@ -1479,7 +1479,7 @@ ffi64_struct_to_reg_form(
memcpy(&outGPRs[destGMarker],
&inStruct[srcMarker], inType->size);
}

srcMarker += inType->size;
destGMarker += inType->size;
i += inType->size - 1;
Expand Down Expand Up @@ -1561,7 +1561,7 @@ ffi64_struct_to_reg_form(
case FFI_TYPE_STRUCT:
recurseCount++;
ffi64_struct_to_reg_form(inType->elements[i],
inStruct, &srcMarker, &fprsUsed, outGPRs,
inStruct, &srcMarker, &fprsUsed, outGPRs,
&destGMarker, outFPRs, &destFMarker);
recurseCount--;
break;
Expand Down
4 changes: 2 additions & 2 deletions Modules/_ctypes/libffi_osx/types.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* -----------------------------------------------------------------------
types.c - Copyright (c) 1996, 1998 Red Hat, Inc.

Predefined ffi_types needed by libffi.

Permission is hereby granted, free of charge, to any person obtaining
Expand Down Expand Up @@ -85,7 +85,7 @@ FFI_INTEGRAL_TYPEDEF(sint64, 8, 8, FFI_TYPE_SINT64);
FFI_INTEGRAL_TYPEDEF(longdouble, 12, 4, FFI_TYPE_LONGDOUBLE);
# endif

#elif defined ARM || defined SH || defined POWERPC_AIX
#elif defined ARM || defined SH || defined POWERPC_AIX
FFI_INTEGRAL_TYPEDEF(double, 8, 4, FFI_TYPE_DOUBLE);
FFI_INTEGRAL_TYPEDEF(longdouble, 8, 4, FFI_TYPE_LONGDOUBLE);
#elif defined POWERPC_DARWIN
Expand Down
6 changes: 3 additions & 3 deletions Modules/_ctypes/libffi_osx/x86/x86-ffi64.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

/* -----------------------------------------------------------------------
x86-ffi64.c - Copyright (c) 2002 Bo Thorsen <bo@suse.de>
x86-64 Foreign Function Interface

x86-64 Foreign Function Interface

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
Expand Down Expand Up @@ -208,7 +208,7 @@ classify_argument(

case FFI_TYPE_STRUCT:
{
ffi_type** ptr;
ffi_type** ptr;
int i;
enum x86_64_reg_class subclasses[MAX_CLASSES];
const int UNITS_PER_WORD = 8;
Expand Down
Loading