| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Several platforms don't define the static_assert macro despite having
compiler support for the _Static_assert keyword. The macro needs to be
defined since it is used unconditionally in the Python code. So it
should always be safe to define it if undefined and not in C++11 (or
later) mode.
Hence, remove the checks for particular platforms or libc versions,
and just define static_assert anytime it needs to be defined but isn't.
That way, all platforms that need the fix will get it, regardless of
whether someone specifically thought of them.
Also document that certain macOS versions are among the platforms that
need this.
The C2x draft (currently expected to become C23) makes static_assert
a keyword to match C++. So only define the macro for up to C17.
Co-authored-by: Victor Stinner <vstinner@python.org>
|
|
|
|
| |
UB (GH-93700)
|
|
|
|
|
|
| |
_posixsubprocess: add a static assertion to ensure that the pid_t
type is signed.
Replace _Py_IntegralTypeSigned() with _Py_IS_TYPE_SIGNED().
|
|
|
|
|
|
|
|
|
| |
* Fix typo in pymacro.h
* Update Include/pymacro.h
Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Victor Stinner <vstinner@python.org>
|
| |
|
|
|
|
|
| |
On FreeBSD, if the static_assert() macro is not defined, define it in
Python until <sys/cdefs.h> supports C11:
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=255290
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add a new _Py_RVALUE() macro to prevent using an expression as an
l-value.
Replace a "(void)" cast with the _Py_RVALUE() macro in the following
macros:
* PyCell_SET()
* PyList_SET_ITEM()
* PyTuple_SET_ITEM()
* _PyGCHead_SET_FINALIZED()
* _PyGCHead_SET_NEXT()
* asdl_seq_SET()
* asdl_seq_SET_UNTYPED()
Add also parentheses around macro arguments in PyCell_SET() and
PyTuple_SET_ITEM() macros.
|
| |
|
|
|
|
|
| |
mode. (GH-16329)
Co-authored-by: Victor Stinner <vstinner@python.org>
|
| |
|
| |
|
| |
|
|
|
| |
It reduces "data" segment in python about 200KB.
|
|
|
|
|
|
|
| |
* Add Py_UNREACHABLE() as an alias to abort().
* Use Py_UNREACHABLE() instead of assert(0)
* Convert more unreachable code to use Py_UNREACHABLE()
* Document Py_UNREACHABLE() and a few other macros.
|
| |
|
|
|
|
|
| |
Issue #27350: use Py_MEMBER_SIZE() macro to get the size of
PyDictKeyEntry.dk_indices, rather than hardcoding 8.
|
| |
|
| |
|
|
|
|
|
| |
Keep _Py_STRINGIZE() in PC/pyconfig.h to not introduce a dependency between
pyconfig.h and pymacros.h.
|
|
|
|
| |
take two parameters.
|
| |
|
| |
|
| |
|
|
|
|
|
|
| |
integer values, by using Py_uintptr_t instead of size_t.
Patch by Serhiy Storchaka.
|
|
|
|
|
| |
To make it clearer that Py_BUILD_ASSERT_EXPR(cond) cannot be used as
assert(cond).
|
| |
|
|
Move other various macros to pymcacro.h
Thanks Rusty Russell for having written these amazing C macros!
|