Skip to content

Commit 361dcdc

Browse files
authored
bpo-40268: Remove unused osdefs.h includes (GH-19532)
When the include is needed, add required symbol in a comment.
1 parent d9ea5ca commit 361dcdc

13 files changed

+18
-20
lines changed

Modules/_tracemalloc.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
#include "pycore_traceback.h"
55
#include "hashtable.h"
66
#include "frameobject.h"
7-
#include "osdefs.h"
87

98
#include "clinic/_tracemalloc.c.h"
109
/*[clinic input]

Modules/getpath.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#include "pycore_fileutils.h"
55
#include "pycore_initconfig.h"
66
#include "pycore_pathconfig.h"
7-
#include "osdefs.h"
7+
#include "osdefs.h" // DELIM
88

99
#include <sys/types.h>
1010
#include <string.h>

Modules/posixmodule.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -312,11 +312,11 @@ extern char *ctermid_r(char *);
312312
#ifndef IO_REPARSE_TAG_MOUNT_POINT
313313
#define IO_REPARSE_TAG_MOUNT_POINT (0xA0000003L)
314314
#endif
315-
#include "osdefs.h"
315+
#include "osdefs.h" // SEP
316316
#include <malloc.h>
317317
#include <windows.h>
318-
#include <shellapi.h> /* for ShellExecute() */
319-
#include <lmcons.h> /* for UNLEN */
318+
#include <shellapi.h> // ShellExecute()
319+
#include <lmcons.h> // UNLEN
320320
#define HAVE_SYMLINK
321321
#endif /* _MSC_VER */
322322

Modules/syslogmodule.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ Revision history:
5050
/* syslog module */
5151

5252
#include "Python.h"
53-
#include "osdefs.h"
53+
#include "osdefs.h" // SEP
5454

5555
#include <syslog.h>
5656

Objects/exceptions.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#include "pycore_initconfig.h"
1010
#include "pycore_object.h"
1111
#include "structmember.h" // PyMemberDef
12-
#include "osdefs.h"
12+
#include "osdefs.h" // SEP
1313

1414

1515
/* Compatibility aliases */
@@ -1435,11 +1435,13 @@ my_basename(PyObject *name)
14351435
size = PyUnicode_GET_LENGTH(name);
14361436
offset = 0;
14371437
for(i=0; i < size; i++) {
1438-
if (PyUnicode_READ(kind, data, i) == SEP)
1438+
if (PyUnicode_READ(kind, data, i) == SEP) {
14391439
offset = i + 1;
1440+
}
14401441
}
1441-
if (offset != 0)
1442+
if (offset != 0) {
14421443
return PyUnicode_Substring(name, offset, size);
1444+
}
14431445
else {
14441446
Py_INCREF(name);
14451447
return name;

PC/getpathp.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,9 @@
8080

8181

8282
#include "Python.h"
83-
#include "pycore_initconfig.h" /* PyStatus */
84-
#include "pycore_pathconfig.h" /* _PyPathConfig */
85-
#include "osdefs.h"
83+
#include "pycore_initconfig.h" // PyStatus
84+
#include "pycore_pathconfig.h" // _PyPathConfig
85+
#include "osdefs.h" // SEP, ALTSEP
8686
#include <wchar.h>
8787

8888
#ifndef MS_WINDOWS

Python/fileutils.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#include "Python.h"
22
#include "pycore_fileutils.h"
3-
#include "osdefs.h"
3+
#include "osdefs.h" // SEP
44
#include <locale.h>
55

66
#ifdef MS_WINDOWS

Python/import.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
#include "marshal.h"
1717
#include "code.h"
1818
#include "frameobject.h"
19-
#include "osdefs.h"
2019
#include "importdl.h"
2120
#include "pydtrace.h"
2221

Python/pathconfig.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* Path configuration like module_search_path (sys.path) */
22

33
#include "Python.h"
4-
#include "osdefs.h"
4+
#include "osdefs.h" // DELIM
55
#include "pycore_initconfig.h"
66
#include "pycore_fileutils.h"
77
#include "pycore_pathconfig.h"

Python/pylifecycle.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
#include "symtable.h"
2727
#include "ast.h"
2828
#include "marshal.h"
29-
#include "osdefs.h"
3029
#include <locale.h>
3130

3231
#ifdef HAVE_SIGNAL_H

Python/pythonrun.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
#include "symtable.h"
2828
#include "ast.h"
2929
#include "marshal.h"
30-
#include "osdefs.h"
3130
#include <locale.h>
3231

3332
#ifdef HAVE_SIGNAL_H

Python/sysmodule.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ Data members:
2626
#include "pycore_pymem.h" // _PyMem_SetDefaultAllocator()
2727
#include "pycore_pystate.h" // _PyThreadState_GET()
2828
#include "pycore_tupleobject.h"
29-
#include "pydtrace.h"
3029

31-
#include "osdefs.h"
30+
#include "pydtrace.h"
31+
#include "osdefs.h" // DELIM
3232
#include <locale.h>
3333

3434
#ifdef MS_WINDOWS

Python/traceback.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#include "code.h"
77
#include "frameobject.h"
88
#include "structmember.h" // PyMemberDef
9-
#include "osdefs.h"
9+
#include "osdefs.h" // SEP
1010
#ifdef HAVE_FCNTL_H
1111
#include <fcntl.h>
1212
#endif

0 commit comments

Comments
 (0)