Skip to content

Commit 234af7d

Browse files
Merge branch 'main' into bug/155728-untrack-const-tuples
2 parents b2b039c + f37e8ff commit 234af7d

6 files changed

Lines changed: 32 additions & 12 deletions

File tree

‎Doc/library/math.rst‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ noted otherwise, all return values are floats.
9090
:func:`atan(x) <atan>` Arc tangent of *x*, in radians
9191
:func:`atanpi(x) <atanpi>` Arc tangent of *x*, in half-turns
9292
:func:`atan2(y, x) <atan2>` ``atan(y / x)``, in radians
93-
:func:`atan2pi(y, x) <atan2pi>` ``atan(y / x)``, in half-turns
93+
:func:`atan2pi(y, x) <atan2pi>` ``atanpi(y / x)``, in half-turns
9494
:func:`cos(x) <cos>` Cosine of *x* radians
9595
:func:`cospi(x) <cospi>` Cosine of *x⋅π* radians
9696
:func:`sin(x) <sin>` Sine of *x* radians

‎Include/internal/pycore_fileutils_windows.h‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,7 @@ static inline BOOL _Py_GetFileInformationByName(
5555
static int GetFileInformationByName_init = -1;
5656

5757
if (GetFileInformationByName_init < 0) {
58-
#ifdef MS_WINDOWS_DESKTOP
5958
HMODULE hMod = LoadLibraryW(L"api-ms-win-core-file-l2-1-4");
60-
#else
61-
HMODULE hMod = LoadPackagedLibrary(L"api-ms-win-core-file-l2-1-4", 0);
62-
#endif
6359
GetFileInformationByName_init = 0;
6460
if (hMod) {
6561
GetFileInformationByName = (PGetFileInformationByName)GetProcAddress(

‎Include/refcount.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -484,7 +484,7 @@ static inline Py_ALWAYS_INLINE void Py_DECREF(PyObject *op)
484484
do { \
485485
_Py_TYPEOF(op)* _tmp_op_ptr = &(op); \
486486
_Py_TYPEOF(op) _tmp_old_op = (*_tmp_op_ptr); \
487-
if (_tmp_old_op != NULL) { \
487+
if (_tmp_old_op != _Py_NULL) { \
488488
*_tmp_op_ptr = _Py_NULL; \
489489
Py_DECREF(_tmp_old_op); \
490490
} \
@@ -494,7 +494,7 @@ static inline Py_ALWAYS_INLINE void Py_DECREF(PyObject *op)
494494
do { \
495495
PyObject **_tmp_op_ptr = _Py_CAST(PyObject**, &(op)); \
496496
PyObject *_tmp_old_op = (*_tmp_op_ptr); \
497-
if (_tmp_old_op != NULL) { \
497+
if (_tmp_old_op != _Py_NULL) { \
498498
PyObject *_null_ptr = _Py_NULL; \
499499
memcpy(_tmp_op_ptr, &_null_ptr, sizeof(PyObject*)); \
500500
Py_DECREF(_tmp_old_op); \

‎Lib/test/test_cext/extension.c‎

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,17 @@ _testcext_exec(PyObject *module)
9595
Py_BUILD_ASSERT(sizeof(int) == sizeof(unsigned int));
9696
assert(Py_BUILD_ASSERT_EXPR(sizeof(int) == sizeof(unsigned int)) == 0);
9797

98-
// Test Py_CLEAR()
99-
obj = NULL;
98+
// Test Py_CLEAR(): use typeof()/__typeof__() if available, or memcpy()
99+
obj = Py_None;
100100
Py_CLEAR(obj);
101+
assert(obj == NULL);
102+
103+
#ifndef Py_LIMITED_API
104+
// Test Py_SETREF(): use typeof()/__typeof__() if available, or memcpy()
105+
obj = Py_None;
106+
Py_SETREF(obj, NULL);
107+
assert(obj == NULL);
108+
#endif
101109

102110
// Test that Py_BEGIN_CRITICAL_SECTION is available
103111
Py_BEGIN_CRITICAL_SECTION(module);

‎Lib/test/test_cppext/extension.cpp‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,22 @@ _testcppext_exec(PyObject *module)
294294
Py_BUILD_ASSERT(sizeof(int) == sizeof(unsigned int));
295295
assert(Py_BUILD_ASSERT_EXPR(sizeof(int) == sizeof(unsigned int)) == 0);
296296

297+
// Test Py_CLEAR(): use typeof()/__typeof__() if available, or memcpy()
298+
PyObject *obj = Py_None;
299+
Py_CLEAR(obj);
300+
assert(obj == _Py_NULL);
301+
302+
#ifndef Py_LIMITED_API
303+
// Test Py_SETREF(): use typeof()/__typeof__() if available, or memcpy()
304+
obj = Py_None;
305+
Py_SETREF(obj, _Py_NULL);
306+
assert(obj == _Py_NULL);
307+
#endif
308+
309+
// Test that Py_BEGIN_CRITICAL_SECTION is available
310+
Py_BEGIN_CRITICAL_SECTION(module);
311+
Py_END_CRITICAL_SECTION();
312+
297313
return 0;
298314
}
299315

‎Modules/mathmodule.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ m_asinpi(double x)
256256

257257
#ifndef HAVE_ATANPI
258258
/*
259-
asin(x)/pi. It conforms to C23 Annex 'F'.
259+
atan(x)/pi. It conforms to C23 Annex 'F'.
260260
*/
261261

262262
static double
@@ -274,7 +274,7 @@ m_atanpi(double x)
274274

275275
#ifndef HAVE_ATAN2PI
276276
/*
277-
asin(x)/pi. It conforms to C23 Annex 'F'.
277+
atan2(y, x)/pi. It conforms to C23 Annex 'F'.
278278
*/
279279

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

0 commit comments

Comments
 (0)