Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit51b78f7

Browse files
authored
Merge branch 'main' into reduce_dependencty_on_compiler
2 parents28ba5d9 +1603a10 commit51b78f7

35 files changed

+228
-147
lines changed

‎Doc/using/configure.rst‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -749,6 +749,17 @@ Compiler flags
749749
extensions. Use it when a compiler flag should *not* be part of the
750750
distutils:envvar:`CFLAGS` once Python is installed (:issue:`21121`).
751751

752+
In particular,:envvar:`CFLAGS` should not contain:
753+
754+
* the compiler flag `-I` (for setting the search path for include files).
755+
The `-I` flags are processed from left to right, and any flags in
756+
:envvar:`CFLAGS` would take precedence over user- and package-supplied `-I`
757+
flags.
758+
759+
* hardening flags such as `-Werror` because distributions cannot control
760+
whether packages installed by users conform to such heightened
761+
standards.
762+
752763
..versionadded::3.5
753764

754765
..envvar::EXTRA_CFLAGS
@@ -861,6 +872,13 @@ Linker flags
861872
:envvar:`CFLAGS_NODIST`. Use it when a linker flag should *not* be part of
862873
the distutils:envvar:`LDFLAGS` once Python is installed (:issue:`35257`).
863874

875+
In particular,:envvar:`LDFLAGS` should not contain:
876+
877+
* the compiler flag `-L` (for setting the search path for libraries).
878+
The `-L` flags are processed from left to right, and any flags in
879+
:envvar:`LDFLAGS` would take precedence over user- and package-supplied `-L`
880+
flags.
881+
864882
..envvar::CONFIGURE_LDFLAGS_NODIST
865883

866884
Value of:envvar:`LDFLAGS_NODIST` variable passed to the ``./configure``

‎Include/abstract.h‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ extern "C" {
8888
-1 on failure.
8989
9090
This is the equivalent of the Python statement: del o.attr_name. */
91-
#definePyObject_DelAttrString(O,A) PyObject_SetAttrString((O),(A), NULL)
91+
#definePyObject_DelAttrString(O,A) PyObject_SetAttrString((O),(A), NULL)
9292

9393

9494
/* Implemented as a macro:
@@ -98,7 +98,7 @@ extern "C" {
9898
Delete attribute named attr_name, for object o. Returns -1
9999
on failure. This is the equivalent of the Python
100100
statement: del o.attr_name. */
101-
#definePyObject_DelAttr(O,A) PyObject_SetAttr((O),(A), NULL)
101+
#definePyObject_DelAttr(O,A) PyObject_SetAttr((O),(A), NULL)
102102

103103

104104
/* Implemented elsewhere:
@@ -722,7 +722,7 @@ PyAPI_FUNC(PyObject *) PySequence_Fast(PyObject *o, const char* m);
722722
/* Return the 'i'-th element of the sequence 'o', assuming that o was returned
723723
by PySequence_Fast, and that i is within bounds. */
724724
#definePySequence_Fast_GET_ITEM(o,i)\
725-
(PyList_Check(o) ? PyList_GET_ITEM(o, i) : PyTuple_GET_ITEM(o, i))
725+
(PyList_Check(o) ? PyList_GET_ITEM((o), (i)) : PyTuple_GET_ITEM((o), (i)))
726726

727727
/* Return a pointer to the underlying item array for
728728
an object returned by PySequence_Fast */
@@ -802,7 +802,7 @@ PyAPI_FUNC(Py_ssize_t) PyMapping_Length(PyObject *o);
802802
failure.
803803
804804
This is equivalent to the Python statement: del o[key]. */
805-
#definePyMapping_DelItemString(O,K) PyObject_DelItemString((O),(K))
805+
#definePyMapping_DelItemString(O,K) PyObject_DelItemString((O),(K))
806806

807807
/* Implemented as a macro:
808808
@@ -812,7 +812,7 @@ PyAPI_FUNC(Py_ssize_t) PyMapping_Length(PyObject *o);
812812
Returns -1 on failure.
813813
814814
This is equivalent to the Python statement: del o[key]. */
815-
#definePyMapping_DelItem(O,K) PyObject_DelItem((O),(K))
815+
#definePyMapping_DelItem(O,K) PyObject_DelItem((O),(K))
816816

817817
/* On success, return 1 if the mapping object 'o' has the key 'key',
818818
and 0 otherwise.

‎Include/ceval.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ Py_DEPRECATED(3.9) PyAPI_FUNC(PyObject *) PyEval_CallObjectWithKeywords(
3131

3232
/* Deprecated since PyEval_CallObjectWithKeywords is deprecated */
3333
#definePyEval_CallObject(callable,arg) \
34-
PyEval_CallObjectWithKeywords(callable,arg, _PyObject_CAST(_Py_NULL))
34+
PyEval_CallObjectWithKeywords((callable), (arg), _PyObject_CAST(_Py_NULL))
3535

3636
Py_DEPRECATED(3.9)PyAPI_FUNC(PyObject*)PyEval_CallFunction(
3737
PyObject*callable,constchar*format, ...);

‎Include/cpython/abstract.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ PyAPI_FUNC(Py_ssize_t) PyObject_LengthHint(PyObject *o, Py_ssize_t);
176176
/* Assume tp_as_sequence and sq_item exist and that 'i' does not
177177
need to be corrected for a negative index. */
178178
#definePySequence_ITEM(o,i)\
179-
( Py_TYPE(o)->tp_as_sequence->sq_item(o, i) )
179+
( Py_TYPE(o)->tp_as_sequence->sq_item((o), (i)) )
180180

181181
#definePY_ITERSEARCH_COUNT 1
182182
#definePY_ITERSEARCH_INDEX 2

‎Include/cpython/classobject.h‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ PyAPI_FUNC(PyObject *) PyMethod_Self(PyObject *);
2929
/* Macros for direct access to these values. Type checks are *not*
3030
done, so use with care. */
3131
#definePyMethod_GET_FUNCTION(meth) \
32-
(((PyMethodObject *)meth) -> im_func)
32+
(((PyMethodObject *)(meth)) -> im_func)
3333
#definePyMethod_GET_SELF(meth) \
34-
(((PyMethodObject *)meth) -> im_self)
34+
(((PyMethodObject *)(meth)) -> im_self)
3535

3636
typedefstruct {
3737
PyObject_HEAD
@@ -48,7 +48,7 @@ PyAPI_FUNC(PyObject *) PyInstanceMethod_Function(PyObject *);
4848
/* Macros for direct access to these values. Type checks are *not*
4949
done, so use with care. */
5050
#definePyInstanceMethod_GET_FUNCTION(meth) \
51-
(((PyInstanceMethodObject *)meth) -> func)
51+
(((PyInstanceMethodObject *)(meth)) -> func)
5252

5353
#ifdef__cplusplus
5454
}

‎Include/cpython/code.h‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ typedef uint16_t _Py_CODEUNIT;
2929
#endif
3030

3131
// Use "unsigned char" instead of "uint8_t" here to avoid illegal aliasing:
32-
#define_Py_SET_OPCODE(word,opcode) (((unsigned char *)&(word))[0] = (opcode))
32+
#define_Py_SET_OPCODE(word,opcode) \
33+
do { ((unsigned char *)&(word))[0] = (opcode); } while (0)
3334

3435
// To avoid repeating ourselves in deepfreeze.py, all PyCodeObject members are
3536
// defined in this macro:

‎Include/cpython/listobject.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,12 @@ static inline Py_ssize_t PyList_GET_SIZE(PyObject *op) {
3636
}
3737
#definePyList_GET_SIZE(op) PyList_GET_SIZE(_PyObject_CAST(op))
3838

39-
#definePyList_GET_ITEM(op,index) (_PyList_CAST(op)->ob_item[index])
39+
#definePyList_GET_ITEM(op,index) (_PyList_CAST(op)->ob_item[(index)])
4040

4141
staticinlinevoid
4242
PyList_SET_ITEM(PyObject*op,Py_ssize_tindex,PyObject*value) {
4343
PyListObject*list=_PyList_CAST(op);
4444
list->ob_item[index]=value;
4545
}
4646
#definePyList_SET_ITEM(op,index,value) \
47-
PyList_SET_ITEM(_PyObject_CAST(op), index, _PyObject_CAST(value))
47+
PyList_SET_ITEM(_PyObject_CAST(op),(index), _PyObject_CAST(value))

‎Include/cpython/modsupport.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ PyAPI_FUNC(int) _PyArg_NoPositional(const char *funcname, PyObject *args);
3434
#define_PyArg_NoPositional(funcname,args) \
3535
((args) == NULL || _PyArg_NoPositional((funcname), (args)))
3636

37-
#define_Py_ANY_VARARGS(n) (n == PY_SSIZE_T_MAX)
37+
#define_Py_ANY_VARARGS(n) ((n) == PY_SSIZE_T_MAX)
3838

3939
PyAPI_FUNC(void)_PyArg_BadArgument(constchar*,constchar*,constchar*,PyObject*);
4040
PyAPI_FUNC(int)_PyArg_CheckPositional(constchar*,Py_ssize_t,
@@ -100,7 +100,7 @@ PyAPI_FUNC(PyObject * const *) _PyArg_UnpackKeywordsWithVararg(
100100

101101
#define_PyArg_UnpackKeywords(args,nargs,kwargs,kwnames,parser,minpos,maxpos,minkw,buf) \
102102
(((minkw) == 0 && (kwargs) == NULL && (kwnames) == NULL && \
103-
(minpos) <= (nargs) && (nargs) <= (maxpos) && args != NULL) ? (args) : \
103+
(minpos) <= (nargs) && (nargs) <= (maxpos) &&(args) != NULL) ? (args) : \
104104
_PyArg_UnpackKeywords((args), (nargs), (kwargs), (kwnames), (parser), \
105105
(minpos), (maxpos), (minkw), (buf)))
106106

‎Include/cpython/object.h‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ typedef struct _Py_Identifier {
4545
// For now we are keeping _Py_IDENTIFIER for continued use
4646
// in non-builtin extensions (and naughty PyPI modules).
4747

48-
#define_Py_static_string_init(value) { .string = value, .index = -1 }
48+
#define_Py_static_string_init(value) { .string =(value), .index = -1 }
4949
#define_Py_static_string(varname,value) static _Py_Identifier varname = _Py_static_string_init(value)
5050
#define_Py_IDENTIFIER(varname) _Py_static_string(PyId_##varname, #varname)
5151

@@ -385,9 +385,9 @@ _PyObject_DebugTypeStats(FILE *out);
385385
#endif
386386

387387
#define_PyObject_ASSERT_WITH_MSG(obj,expr,msg) \
388-
_PyObject_ASSERT_FROM(obj, expr, msg, __FILE__, __LINE__, __func__)
388+
_PyObject_ASSERT_FROM((obj), expr,(msg), __FILE__, __LINE__, __func__)
389389
#define_PyObject_ASSERT(obj,expr) \
390-
_PyObject_ASSERT_WITH_MSG(obj, expr, NULL)
390+
_PyObject_ASSERT_WITH_MSG((obj), expr, NULL)
391391

392392
#define_PyObject_ASSERT_FAILED_MSG(obj,msg) \
393393
_PyObject_AssertFailed((obj), NULL, (msg), __FILE__, __LINE__, __func__)
@@ -493,8 +493,8 @@ PyAPI_FUNC(int) _PyTrash_cond(PyObject *op, destructor dealloc);
493493
} while (0);
494494

495495
#definePy_TRASHCAN_BEGIN(op,dealloc) \
496-
Py_TRASHCAN_BEGIN_CONDITION(op, \
497-
_PyTrash_cond(_PyObject_CAST(op), (destructor)dealloc))
496+
Py_TRASHCAN_BEGIN_CONDITION((op), \
497+
_PyTrash_cond(_PyObject_CAST(op), (destructor)(dealloc)))
498498

499499
/* The following two macros, Py_TRASHCAN_SAFE_BEGIN and
500500
* Py_TRASHCAN_SAFE_END, are deprecated since version 3.11 and
@@ -505,7 +505,7 @@ Py_DEPRECATED(3.11) typedef int UsingDeprecatedTrashcanMacro;
505505
#definePy_TRASHCAN_SAFE_BEGIN(op) \
506506
do { \
507507
UsingDeprecatedTrashcanMacro cond=1; \
508-
Py_TRASHCAN_BEGIN_CONDITION(op, cond);
508+
Py_TRASHCAN_BEGIN_CONDITION((op), cond);
509509
#definePy_TRASHCAN_SAFE_END(op) \
510510
Py_TRASHCAN_END; \
511511
} while(0);

‎Include/cpython/odictobject.h‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@ PyAPI_FUNC(int) PyODict_SetItem(PyObject *od, PyObject *key, PyObject *item);
2727
PyAPI_FUNC(int)PyODict_DelItem(PyObject*od,PyObject*key);
2828

2929
/* wrappers around PyDict* functions */
30-
#definePyODict_GetItem(od,key) PyDict_GetItem(_PyObject_CAST(od), key)
30+
#definePyODict_GetItem(od,key) PyDict_GetItem(_PyObject_CAST(od),(key))
3131
#definePyODict_GetItemWithError(od,key) \
32-
PyDict_GetItemWithError(_PyObject_CAST(od), key)
33-
#definePyODict_Contains(od,key) PyDict_Contains(_PyObject_CAST(od), key)
32+
PyDict_GetItemWithError(_PyObject_CAST(od),(key))
33+
#definePyODict_Contains(od,key) PyDict_Contains(_PyObject_CAST(od),(key))
3434
#definePyODict_Size(od) PyDict_Size(_PyObject_CAST(od))
3535
#definePyODict_GetItemString(od,key) \
36-
PyDict_GetItemString(_PyObject_CAST(od), key)
36+
PyDict_GetItemString(_PyObject_CAST(od),(key))
3737

3838
#endif
3939

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp