| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
| |
Co-authored-by: da-woods <dw-git@d-woods.co.uk>
|
|
|
|
|
|
|
|
|
| |
This is a quick-and-dirty way to run the C++ tests.
It can definitely be improved in the future, but it should fail when things go wrong.
- Run test functions on import (yes, this can definitely be improved)
- Fudge setuptools metadata (name & version) to make the extension installable
- Install and import the extension in test_cppext
|
|
|
|
|
| |
Fix the compatibility of the Python C API with C++ older than C++11.
_Py_NULL is only defined as nullptr on C++11 and newer.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add C++ overloads for _Py_CAST_impl() to handle 0/NULL. This will allow
C++ extensions that pass 0 or NULL to macros using _Py_CAST() to
continue to compile. Without this, you get an error like:
invalid ‘static_cast’ from type ‘int’ to type ‘_object*’
The modern way to use a NULL value in C++ is to use nullptr. However,
we want to not break extensions that do things the old way.
Co-authored-by: serge-sans-paille
|
|
|
|
| |
* Add StrongRef class.
* Rename and reformat functions of the _Py_CAST() implementation.
|
| |
|
|
|
|
| |
_Py_CAST() cannot be used with a constant type: use _Py_STATIC_CAST()
instead.
|
|
|
|
|
|
|
|
| |
Fix C++ compiler warnings: "zero as null pointer constant"
(clang -Wzero-as-null-pointer-constant).
* Add the _Py_NULL macro used by static inline functions to use
nullptr in C++.
* Replace NULL with nullptr in _testcppext.cpp.
|
|
|
|
|
|
|
|
|
|
| |
Fix C++ compiler warnings on cast macros, like _PyObject_CAST(), when
casting a constant expression to a non constant type: use
const_cast<> in C++.
* In C++, Py_SAFE_DOWNCAST() now uses static_cast<> rather than
reinterpret_cast<>.
* Add tests to the _testcppext C++ extension.
* test_cppext no longer captures stdout in verbose mode.
|
|
Build a basic C++ test extension to check that the Python C API is
compatible with C++ and does not emit C++ compiler warnings.
* Add Modules/_testcppext.cpp: C++ extension
* Add Lib/test/test_cppext.py: test building the C++ extension.
|