Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Doc/library/math.rst
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ noted otherwise, all return values are floats.
:func:`atan(x) <atan>` Arc tangent of *x*, in radians
:func:`atanpi(x) <atanpi>` Arc tangent of *x*, in half-turns
:func:`atan2(y, x) <atan2>` ``atan(y / x)``, in radians
:func:`atan2pi(y, x) <atan2pi>` ``atan(y / x)``, in half-turns
:func:`atan2pi(y, x) <atan2pi>` ``atanpi(y / x)``, in half-turns
:func:`cos(x) <cos>` Cosine of *x* radians
:func:`cospi(x) <cospi>` Cosine of *x⋅π* radians
:func:`sin(x) <sin>` Sine of *x* radians
Expand Down
4 changes: 0 additions & 4 deletions Include/internal/pycore_fileutils_windows.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,7 @@ static inline BOOL _Py_GetFileInformationByName(
static int GetFileInformationByName_init = -1;

if (GetFileInformationByName_init < 0) {
#ifdef MS_WINDOWS_DESKTOP
HMODULE hMod = LoadLibraryW(L"api-ms-win-core-file-l2-1-4");
#else
HMODULE hMod = LoadPackagedLibrary(L"api-ms-win-core-file-l2-1-4", 0);
#endif
GetFileInformationByName_init = 0;
if (hMod) {
GetFileInformationByName = (PGetFileInformationByName)GetProcAddress(
Expand Down
4 changes: 2 additions & 2 deletions Include/refcount.h
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,7 @@ static inline Py_ALWAYS_INLINE void Py_DECREF(PyObject *op)
do { \
_Py_TYPEOF(op)* _tmp_op_ptr = &(op); \
_Py_TYPEOF(op) _tmp_old_op = (*_tmp_op_ptr); \
if (_tmp_old_op != NULL) { \
if (_tmp_old_op != _Py_NULL) { \
*_tmp_op_ptr = _Py_NULL; \
Py_DECREF(_tmp_old_op); \
} \
Expand All @@ -494,7 +494,7 @@ static inline Py_ALWAYS_INLINE void Py_DECREF(PyObject *op)
do { \
PyObject **_tmp_op_ptr = _Py_CAST(PyObject**, &(op)); \
PyObject *_tmp_old_op = (*_tmp_op_ptr); \
if (_tmp_old_op != NULL) { \
if (_tmp_old_op != _Py_NULL) { \
PyObject *_null_ptr = _Py_NULL; \
memcpy(_tmp_op_ptr, &_null_ptr, sizeof(PyObject*)); \
Py_DECREF(_tmp_old_op); \
Expand Down
12 changes: 10 additions & 2 deletions Lib/test/test_cext/extension.c
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,17 @@ _testcext_exec(PyObject *module)
Py_BUILD_ASSERT(sizeof(int) == sizeof(unsigned int));
assert(Py_BUILD_ASSERT_EXPR(sizeof(int) == sizeof(unsigned int)) == 0);

// Test Py_CLEAR()
obj = NULL;
// Test Py_CLEAR(): use typeof()/__typeof__() if available, or memcpy()
obj = Py_None;
Py_CLEAR(obj);
assert(obj == NULL);

#ifndef Py_LIMITED_API
// Test Py_SETREF(): use typeof()/__typeof__() if available, or memcpy()
obj = Py_None;
Py_SETREF(obj, NULL);
assert(obj == NULL);
#endif

// Test that Py_BEGIN_CRITICAL_SECTION is available
Py_BEGIN_CRITICAL_SECTION(module);
Expand Down
16 changes: 16 additions & 0 deletions Lib/test/test_cppext/extension.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,22 @@ _testcppext_exec(PyObject *module)
Py_BUILD_ASSERT(sizeof(int) == sizeof(unsigned int));
assert(Py_BUILD_ASSERT_EXPR(sizeof(int) == sizeof(unsigned int)) == 0);

// Test Py_CLEAR(): use typeof()/__typeof__() if available, or memcpy()
PyObject *obj = Py_None;
Py_CLEAR(obj);
assert(obj == _Py_NULL);

#ifndef Py_LIMITED_API
// Test Py_SETREF(): use typeof()/__typeof__() if available, or memcpy()
obj = Py_None;
Py_SETREF(obj, _Py_NULL);
assert(obj == _Py_NULL);
#endif

// Test that Py_BEGIN_CRITICAL_SECTION is available
Py_BEGIN_CRITICAL_SECTION(module);
Py_END_CRITICAL_SECTION();

return 0;
}

Expand Down
6 changes: 3 additions & 3 deletions Modules/mathmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ m_asinpi(double x)

#ifndef HAVE_ATANPI
/*
asin(x)/pi. It conforms to C23 Annex 'F'.
atan(x)/pi. It conforms to C23 Annex 'F'.
*/

static double
Expand All @@ -274,7 +274,7 @@ m_atanpi(double x)

#ifndef HAVE_ATAN2PI
/*
asin(x)/pi. It conforms to C23 Annex 'F'.
atan2(y, x)/pi. It conforms to C23 Annex 'F'.
*/

static double
Expand Down Expand Up @@ -1136,7 +1136,7 @@ FUNC1D(atanh, atanh, 0,
FUNC1D(atanpi, m_atanpi, 0,
"atanpi($module, x, /)\n--\n\n"
"Return the arc tangent (measured in half-turns) of x.\n\n"
"The result is between 0 and 1.",
"The result is between -1/2 and 1/2.",
"expected a number in range from -1 up to 1, got %s")
FUNC1(cbrt, cbrt, 0,
"cbrt($module, x, /)\n--\n\n"
Expand Down
Loading