Skip to content

Commit c431854

Browse files
louisomzhangyangyu
authored andcommitted
bpo-29927: Remove duplicate BufferError init and unnecessary semicolons (GH-866)
1 parent 83371f4 commit c431854

1 file changed

Lines changed: 51 additions & 53 deletions

File tree

Objects/exceptions.c

Lines changed: 51 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -2488,7 +2488,6 @@ _PyExc_Init(PyObject *bltinmod)
24882488
PRE_INIT(ZeroDivisionError)
24892489
PRE_INIT(SystemError)
24902490
PRE_INIT(ReferenceError)
2491-
PRE_INIT(BufferError)
24922491
PRE_INIT(MemoryError)
24932492
PRE_INIT(BufferError)
24942493
PRE_INIT(Warning)
@@ -2504,22 +2503,22 @@ _PyExc_Init(PyObject *bltinmod)
25042503
PRE_INIT(ResourceWarning)
25052504

25062505
/* OSError subclasses */
2507-
PRE_INIT(ConnectionError);
2508-
2509-
PRE_INIT(BlockingIOError);
2510-
PRE_INIT(BrokenPipeError);
2511-
PRE_INIT(ChildProcessError);
2512-
PRE_INIT(ConnectionAbortedError);
2513-
PRE_INIT(ConnectionRefusedError);
2514-
PRE_INIT(ConnectionResetError);
2515-
PRE_INIT(FileExistsError);
2516-
PRE_INIT(FileNotFoundError);
2517-
PRE_INIT(IsADirectoryError);
2518-
PRE_INIT(NotADirectoryError);
2519-
PRE_INIT(InterruptedError);
2520-
PRE_INIT(PermissionError);
2521-
PRE_INIT(ProcessLookupError);
2522-
PRE_INIT(TimeoutError);
2506+
PRE_INIT(ConnectionError)
2507+
2508+
PRE_INIT(BlockingIOError)
2509+
PRE_INIT(BrokenPipeError)
2510+
PRE_INIT(ChildProcessError)
2511+
PRE_INIT(ConnectionAbortedError)
2512+
PRE_INIT(ConnectionRefusedError)
2513+
PRE_INIT(ConnectionResetError)
2514+
PRE_INIT(FileExistsError)
2515+
PRE_INIT(FileNotFoundError)
2516+
PRE_INIT(IsADirectoryError)
2517+
PRE_INIT(NotADirectoryError)
2518+
PRE_INIT(InterruptedError)
2519+
PRE_INIT(PermissionError)
2520+
PRE_INIT(ProcessLookupError)
2521+
PRE_INIT(TimeoutError)
25232522

25242523
bdict = PyModule_GetDict(bltinmod);
25252524
if (bdict == NULL)
@@ -2566,7 +2565,6 @@ _PyExc_Init(PyObject *bltinmod)
25662565
POST_INIT(ZeroDivisionError)
25672566
POST_INIT(SystemError)
25682567
POST_INIT(ReferenceError)
2569-
POST_INIT(BufferError)
25702568
POST_INIT(MemoryError)
25712569
POST_INIT(BufferError)
25722570
POST_INIT(Warning)
@@ -2588,43 +2586,43 @@ _PyExc_Init(PyObject *bltinmod)
25882586
}
25892587

25902588
/* OSError subclasses */
2591-
POST_INIT(ConnectionError);
2592-
2593-
POST_INIT(BlockingIOError);
2594-
ADD_ERRNO(BlockingIOError, EAGAIN);
2595-
ADD_ERRNO(BlockingIOError, EALREADY);
2596-
ADD_ERRNO(BlockingIOError, EINPROGRESS);
2597-
ADD_ERRNO(BlockingIOError, EWOULDBLOCK);
2598-
POST_INIT(BrokenPipeError);
2599-
ADD_ERRNO(BrokenPipeError, EPIPE);
2589+
POST_INIT(ConnectionError)
2590+
2591+
POST_INIT(BlockingIOError)
2592+
ADD_ERRNO(BlockingIOError, EAGAIN)
2593+
ADD_ERRNO(BlockingIOError, EALREADY)
2594+
ADD_ERRNO(BlockingIOError, EINPROGRESS)
2595+
ADD_ERRNO(BlockingIOError, EWOULDBLOCK)
2596+
POST_INIT(BrokenPipeError)
2597+
ADD_ERRNO(BrokenPipeError, EPIPE)
26002598
#ifdef ESHUTDOWN
2601-
ADD_ERRNO(BrokenPipeError, ESHUTDOWN);
2599+
ADD_ERRNO(BrokenPipeError, ESHUTDOWN)
26022600
#endif
2603-
POST_INIT(ChildProcessError);
2604-
ADD_ERRNO(ChildProcessError, ECHILD);
2605-
POST_INIT(ConnectionAbortedError);
2606-
ADD_ERRNO(ConnectionAbortedError, ECONNABORTED);
2607-
POST_INIT(ConnectionRefusedError);
2608-
ADD_ERRNO(ConnectionRefusedError, ECONNREFUSED);
2609-
POST_INIT(ConnectionResetError);
2610-
ADD_ERRNO(ConnectionResetError, ECONNRESET);
2611-
POST_INIT(FileExistsError);
2612-
ADD_ERRNO(FileExistsError, EEXIST);
2613-
POST_INIT(FileNotFoundError);
2614-
ADD_ERRNO(FileNotFoundError, ENOENT);
2615-
POST_INIT(IsADirectoryError);
2616-
ADD_ERRNO(IsADirectoryError, EISDIR);
2617-
POST_INIT(NotADirectoryError);
2618-
ADD_ERRNO(NotADirectoryError, ENOTDIR);
2619-
POST_INIT(InterruptedError);
2620-
ADD_ERRNO(InterruptedError, EINTR);
2621-
POST_INIT(PermissionError);
2622-
ADD_ERRNO(PermissionError, EACCES);
2623-
ADD_ERRNO(PermissionError, EPERM);
2624-
POST_INIT(ProcessLookupError);
2625-
ADD_ERRNO(ProcessLookupError, ESRCH);
2626-
POST_INIT(TimeoutError);
2627-
ADD_ERRNO(TimeoutError, ETIMEDOUT);
2601+
POST_INIT(ChildProcessError)
2602+
ADD_ERRNO(ChildProcessError, ECHILD)
2603+
POST_INIT(ConnectionAbortedError)
2604+
ADD_ERRNO(ConnectionAbortedError, ECONNABORTED)
2605+
POST_INIT(ConnectionRefusedError)
2606+
ADD_ERRNO(ConnectionRefusedError, ECONNREFUSED)
2607+
POST_INIT(ConnectionResetError)
2608+
ADD_ERRNO(ConnectionResetError, ECONNRESET)
2609+
POST_INIT(FileExistsError)
2610+
ADD_ERRNO(FileExistsError, EEXIST)
2611+
POST_INIT(FileNotFoundError)
2612+
ADD_ERRNO(FileNotFoundError, ENOENT)
2613+
POST_INIT(IsADirectoryError)
2614+
ADD_ERRNO(IsADirectoryError, EISDIR)
2615+
POST_INIT(NotADirectoryError)
2616+
ADD_ERRNO(NotADirectoryError, ENOTDIR)
2617+
POST_INIT(InterruptedError)
2618+
ADD_ERRNO(InterruptedError, EINTR)
2619+
POST_INIT(PermissionError)
2620+
ADD_ERRNO(PermissionError, EACCES)
2621+
ADD_ERRNO(PermissionError, EPERM)
2622+
POST_INIT(ProcessLookupError)
2623+
ADD_ERRNO(ProcessLookupError, ESRCH)
2624+
POST_INIT(TimeoutError)
2625+
ADD_ERRNO(TimeoutError, ETIMEDOUT)
26282626

26292627
preallocate_memerrors();
26302628

0 commit comments

Comments
 (0)