Skip to content

Commit ee22d40

Browse files
Merge branch 'main' into py-prefix-asynciodebug
2 parents c4dbbb0 + d890aba commit ee22d40

7 files changed

Lines changed: 56 additions & 26 deletions

File tree

Doc/c-api/float.rst

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,24 @@ Floating-Point Objects
7878
Return the minimum normalized positive float *DBL_MIN* as C :c:expr:`double`.
7979
8080
81+
.. c:macro:: Py_INFINITY
82+
83+
This macro expands a to constant expression of type :c:expr:`double`, that
84+
represents the positive infinity.
85+
86+
On most platforms, this is equivalent to the :c:macro:`!INFINITY` macro from
87+
the C11 standard ``<math.h>`` header.
88+
89+
90+
.. c:macro:: Py_NAN
91+
92+
This macro expands a to constant expression of type :c:expr:`double`, that
93+
represents a quiet not-a-number (qNaN) value.
94+
95+
On most platforms, this is equivalent to the :c:macro:`!NAN` macro from
96+
the C11 standard ``<math.h>`` header.
97+
98+
8199
.. c:macro:: Py_MATH_El
82100
83101
High precision (long double) definition of :data:`~math.e` constant.

Doc/whatsnew/3.15.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -451,6 +451,7 @@ math
451451
mimetypes
452452
---------
453453

454+
* Add ``application/node`` MIME type for ``.cjs`` extension. (Contributed by John Franey in :gh:`140937`.)
454455
* Add ``application/toml``. (Contributed by Gil Forcada in :gh:`139959`.)
455456
* Rename ``application/x-texinfo`` to ``application/texinfo``.
456457
(Contributed by Charlie Lin in :gh:`140165`)

Include/internal/pycore_importdl.h

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,34 @@ extern "C" {
1414

1515
extern const char *_PyImport_DynLoadFiletab[];
1616

17+
#ifdef HAVE_DYNAMIC_LOADING
18+
/* ./configure sets HAVE_DYNAMIC_LOADING if dynamic loading of modules is
19+
supported on this platform. configure will then compile and link in one
20+
of the dynload_*.c files, as appropriate. We will call a function in
21+
those modules to get a function pointer to the module's init function.
22+
23+
The function should return:
24+
- The function pointer on success
25+
- NULL with exception set if the library cannot be loaded
26+
- NULL *without* an extension set if the library could be loaded but the
27+
function cannot be found in it.
28+
*/
29+
#ifdef MS_WINDOWS
30+
#include <windows.h>
31+
typedef FARPROC dl_funcptr;
32+
extern dl_funcptr _PyImport_FindSharedFuncptrWindows(const char *prefix,
33+
const char *shortname,
34+
PyObject *pathname,
35+
FILE *fp);
36+
#else
37+
typedef void (*dl_funcptr)(void);
38+
extern dl_funcptr _PyImport_FindSharedFuncptr(const char *prefix,
39+
const char *shortname,
40+
const char *pathname, FILE *fp);
41+
#endif
42+
43+
#endif /* HAVE_DYNAMIC_LOADING */
44+
1745

1846
typedef enum ext_module_kind {
1947
_Py_ext_module_kind_UNKNOWN = 0,
@@ -112,8 +140,6 @@ extern int _PyImport_RunModInitFunc(
112140
#define MAXSUFFIXSIZE 12
113141

114142
#ifdef MS_WINDOWS
115-
#include <windows.h>
116-
typedef FARPROC dl_funcptr;
117143

118144
#ifdef Py_DEBUG
119145
# define PYD_DEBUG_SUFFIX "_d"
@@ -136,8 +162,6 @@ typedef FARPROC dl_funcptr;
136162
#define PYD_TAGGED_SUFFIX PYD_DEBUG_SUFFIX "." PYD_SOABI ".pyd"
137163
#define PYD_UNTAGGED_SUFFIX PYD_DEBUG_SUFFIX ".pyd"
138164

139-
#else
140-
typedef void (*dl_funcptr)(void);
141165
#endif
142166

143167

Lib/mimetypes.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -486,6 +486,7 @@ def _default_mime_types():
486486
'.wiz' : 'application/msword',
487487
'.nq' : 'application/n-quads',
488488
'.nt' : 'application/n-triples',
489+
'.cjs' : 'application/node',
489490
'.bin' : 'application/octet-stream',
490491
'.a' : 'application/octet-stream',
491492
'.dll' : 'application/octet-stream',
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Add ``.cjs`` to :mod:`mimetypes` to give CommonJS modules a MIME type of
2+
``application/node``.

Objects/setobject.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2747,7 +2747,9 @@ PySet_Contains(PyObject *anyset, PyObject *key)
27472747
PyErr_BadInternalCall();
27482748
return -1;
27492749
}
2750-
2750+
if (PyFrozenSet_CheckExact(anyset)) {
2751+
return set_contains_key((PySetObject *)anyset, key);
2752+
}
27512753
int rv;
27522754
Py_BEGIN_CRITICAL_SECTION(anyset);
27532755
rv = set_contains_key((PySetObject *)anyset, key);

Python/importdl.c

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -10,27 +10,6 @@
1010
#include "pycore_runtime.h" // _Py_ID()
1111

1212

13-
/* ./configure sets HAVE_DYNAMIC_LOADING if dynamic loading of modules is
14-
supported on this platform. configure will then compile and link in one
15-
of the dynload_*.c files, as appropriate. We will call a function in
16-
those modules to get a function pointer to the module's init function.
17-
*/
18-
#ifdef HAVE_DYNAMIC_LOADING
19-
20-
#ifdef MS_WINDOWS
21-
extern dl_funcptr _PyImport_FindSharedFuncptrWindows(const char *prefix,
22-
const char *shortname,
23-
PyObject *pathname,
24-
FILE *fp);
25-
#else
26-
extern dl_funcptr _PyImport_FindSharedFuncptr(const char *prefix,
27-
const char *shortname,
28-
const char *pathname, FILE *fp);
29-
#endif
30-
31-
#endif /* HAVE_DYNAMIC_LOADING */
32-
33-
3413
/***********************************/
3514
/* module info to use when loading */
3615
/***********************************/
@@ -414,6 +393,9 @@ _PyImport_GetModuleExportHooks(
414393
*modexport = (PyModExportFunction)exportfunc;
415394
return 2;
416395
}
396+
if (PyErr_Occurred()) {
397+
return -1;
398+
}
417399

418400
exportfunc = findfuncptr(
419401
info->hook_prefixes->init_prefix,

0 commit comments

Comments
 (0)