Skip to content

Commit b887bc0

Browse files
Merge branch 'main' into jit-devcontainer
2 parents bbd6f28 + dd0840b commit b887bc0

File tree

20 files changed

+431
-338
lines changed

20 files changed

+431
-338
lines changed

.github/CODEOWNERS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -406,11 +406,15 @@ Lib/test/test_dataclasses/ @ericvsmith
406406

407407
# Dates and times
408408
Doc/**/*time.rst @pganssle @abalkin
409+
Doc/library/zoneinfo.rst @pganssle
409410
Include/datetime.h @pganssle @abalkin
410411
Include/internal/pycore_time.h @pganssle @abalkin
412+
Lib/test/test_zoneinfo/ @pganssle
413+
Lib/zoneinfo/ @pganssle
411414
Lib/*time.py @pganssle @abalkin
412415
Lib/test/datetimetester.py @pganssle @abalkin
413416
Lib/test/test_*time.py @pganssle @abalkin
417+
Modules/*zoneinfo* @pganssle
414418
Modules/*time* @pganssle @abalkin
415419
Python/pytime.c @pganssle @abalkin
416420

Doc/c-api/veryhigh.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,8 @@ the same library that the Python runtime is using.
183183
objects *globals* and *locals* with the compiler flags specified by
184184
*flags*. *globals* must be a dictionary; *locals* can be any object
185185
that implements the mapping protocol. The parameter *start* specifies
186-
the start token that should be used to parse the source code.
186+
the start symbol and must one of the following:
187+
:c:data:`Py_eval_input`, :c:data:`Py_file_input`, or :c:data:`Py_single_input`.
187188
188189
Returns the result of executing the code as a Python object, or ``NULL`` if an
189190
exception was raised.
@@ -231,7 +232,7 @@ the same library that the Python runtime is using.
231232
.. c:function:: PyObject* Py_CompileStringObject(const char *str, PyObject *filename, int start, PyCompilerFlags *flags, int optimize)
232233
233234
Parse and compile the Python source code in *str*, returning the resulting code
234-
object. The start token is given by *start*; this can be used to constrain the
235+
object. The start symbol is given by *start*; this can be used to constrain the
235236
code which can be compiled and should be :c:data:`Py_eval_input`,
236237
:c:data:`Py_file_input`, or :c:data:`Py_single_input`. The filename specified by
237238
*filename* is used to construct the code object and may appear in tracebacks or

Doc/library/argparse.rst

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -981,8 +981,8 @@ the various :class:`ArgumentParser` actions. The two most common uses of it are
981981
(like ``-f`` or ``--foo``) and ``nargs='?'``. This creates an optional
982982
argument that can be followed by zero or one command-line arguments.
983983
When parsing the command line, if the option string is encountered with no
984-
command-line argument following it, the value of ``const`` will be assumed to
985-
be ``None`` instead. See the nargs_ description for examples.
984+
command-line argument following it, the value from ``const`` will be used.
985+
See the nargs_ description for examples.
986986

987987
.. versionchanged:: 3.11
988988
``const=None`` by default, including when ``action='append_const'`` or
@@ -1142,16 +1142,21 @@ if the argument was not one of the acceptable values::
11421142
game.py: error: argument move: invalid choice: 'fire' (choose from 'rock',
11431143
'paper', 'scissors')
11441144

1145-
Note that inclusion in the *choices* sequence is checked after any type_
1146-
conversions have been performed, so the type of the objects in the *choices*
1147-
sequence should match the type_ specified.
1148-
11491145
Any sequence can be passed as the *choices* value, so :class:`list` objects,
11501146
:class:`tuple` objects, and custom sequences are all supported.
11511147

11521148
Use of :class:`enum.Enum` is not recommended because it is difficult to
11531149
control its appearance in usage, help, and error messages.
11541150

1151+
Note that *choices* are checked after any type_
1152+
conversions have been performed, so objects in *choices*
1153+
should match the type_ specified. This can make *choices*
1154+
appear unfamiliar in usage, help, or error messages.
1155+
1156+
To keep *choices* user-friendly, consider a custom type wrapper that
1157+
converts and formats values, or omit type_ and handle conversion in
1158+
your application code.
1159+
11551160
Formatted choices override the default *metavar* which is normally derived
11561161
from *dest*. This is usually what you want because the user never sees the
11571162
*dest* parameter. If this display isn't desirable (perhaps because there are

Doc/library/platform.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ Cross platform
5656
Returns the machine type, e.g. ``'AMD64'``. An empty string is returned if the
5757
value cannot be determined.
5858

59+
The output is platform-dependent and may differ in casing and naming conventions.
60+
5961

6062
.. function:: node()
6163

Include/internal/pycore_call.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ _PyObject_CallNoArgs(PyObject *func) {
186186
}
187187

188188

189-
extern PyObject *const *
189+
PyAPI_FUNC(PyObject *const *)
190190
_PyStack_UnpackDict(PyThreadState *tstate,
191191
PyObject *const *args, Py_ssize_t nargs,
192192
PyObject *kwargs, PyObject **p_kwnames);
@@ -196,7 +196,7 @@ extern void _PyStack_UnpackDict_Free(
196196
Py_ssize_t nargs,
197197
PyObject *kwnames);
198198

199-
extern void _PyStack_UnpackDict_FreeNoDecRef(
199+
PyAPI_FUNC(void) _PyStack_UnpackDict_FreeNoDecRef(
200200
PyObject *const *stack,
201201
PyObject *kwnames);
202202

Include/internal/pycore_ceval.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ PyAPI_FUNC(int) _Py_CheckRecursiveCall(
226226
PyThreadState *tstate,
227227
const char *where);
228228

229-
int _Py_CheckRecursiveCallPy(
229+
PyAPI_FUNC(int) _Py_CheckRecursiveCallPy(
230230
PyThreadState *tstate);
231231

232232
static inline int _Py_EnterRecursiveCallTstate(PyThreadState *tstate,

Include/internal/pycore_code.h

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ extern PyObject* _PyCode_GetFreevars(PyCodeObject *);
262262
extern PyObject* _PyCode_GetCode(PyCodeObject *);
263263

264264
/** API for initializing the line number tables. */
265-
extern int _PyCode_InitAddressRange(PyCodeObject* co, PyCodeAddressRange *bounds);
265+
PyAPI_FUNC(int) _PyCode_InitAddressRange(PyCodeObject* co, PyCodeAddressRange *bounds);
266266

267267
/** Out of process API for initializing the location table. */
268268
extern void _PyLineTable_InitAddressRange(
@@ -272,7 +272,7 @@ extern void _PyLineTable_InitAddressRange(
272272
PyCodeAddressRange *range);
273273

274274
/** API for traversing the line number table. */
275-
extern int _PyLineTable_NextAddressRange(PyCodeAddressRange *range);
275+
PyAPI_FUNC(int) _PyLineTable_NextAddressRange(PyCodeAddressRange *range);
276276
extern int _PyLineTable_PreviousAddressRange(PyCodeAddressRange *range);
277277
// This is used in dump_frame() in traceback.c without an attached tstate.
278278
extern int _PyCode_Addr2LineNoTstate(PyCodeObject *co, int addr);
@@ -293,33 +293,34 @@ extern void _PyCode_Clear_Executors(PyCodeObject *code);
293293
#define ENABLE_SPECIALIZATION_FT ENABLE_SPECIALIZATION
294294
#endif
295295

296-
/* Specialization functions */
296+
/* Specialization functions, these are exported only for other re-generated
297+
* interpreters to call */
297298

298-
extern void _Py_Specialize_LoadSuperAttr(_PyStackRef global_super, _PyStackRef cls,
299+
PyAPI_FUNC(void) _Py_Specialize_LoadSuperAttr(_PyStackRef global_super, _PyStackRef cls,
299300
_Py_CODEUNIT *instr, int load_method);
300-
extern void _Py_Specialize_LoadAttr(_PyStackRef owner, _Py_CODEUNIT *instr,
301+
PyAPI_FUNC(void) _Py_Specialize_LoadAttr(_PyStackRef owner, _Py_CODEUNIT *instr,
301302
PyObject *name);
302-
extern void _Py_Specialize_StoreAttr(_PyStackRef owner, _Py_CODEUNIT *instr,
303+
PyAPI_FUNC(void) _Py_Specialize_StoreAttr(_PyStackRef owner, _Py_CODEUNIT *instr,
303304
PyObject *name);
304-
extern void _Py_Specialize_LoadGlobal(PyObject *globals, PyObject *builtins,
305+
PyAPI_FUNC(void) _Py_Specialize_LoadGlobal(PyObject *globals, PyObject *builtins,
305306
_Py_CODEUNIT *instr, PyObject *name);
306-
extern void _Py_Specialize_StoreSubscr(_PyStackRef container, _PyStackRef sub,
307+
PyAPI_FUNC(void) _Py_Specialize_StoreSubscr(_PyStackRef container, _PyStackRef sub,
307308
_Py_CODEUNIT *instr);
308-
extern void _Py_Specialize_Call(_PyStackRef callable, _Py_CODEUNIT *instr,
309+
PyAPI_FUNC(void) _Py_Specialize_Call(_PyStackRef callable, _Py_CODEUNIT *instr,
309310
int nargs);
310-
extern void _Py_Specialize_CallKw(_PyStackRef callable, _Py_CODEUNIT *instr,
311+
PyAPI_FUNC(void) _Py_Specialize_CallKw(_PyStackRef callable, _Py_CODEUNIT *instr,
311312
int nargs);
312-
extern void _Py_Specialize_BinaryOp(_PyStackRef lhs, _PyStackRef rhs, _Py_CODEUNIT *instr,
313+
PyAPI_FUNC(void) _Py_Specialize_BinaryOp(_PyStackRef lhs, _PyStackRef rhs, _Py_CODEUNIT *instr,
313314
int oparg, _PyStackRef *locals);
314-
extern void _Py_Specialize_CompareOp(_PyStackRef lhs, _PyStackRef rhs,
315+
PyAPI_FUNC(void) _Py_Specialize_CompareOp(_PyStackRef lhs, _PyStackRef rhs,
315316
_Py_CODEUNIT *instr, int oparg);
316-
extern void _Py_Specialize_UnpackSequence(_PyStackRef seq, _Py_CODEUNIT *instr,
317+
PyAPI_FUNC(void) _Py_Specialize_UnpackSequence(_PyStackRef seq, _Py_CODEUNIT *instr,
317318
int oparg);
318-
extern void _Py_Specialize_ForIter(_PyStackRef iter, _PyStackRef null_or_index, _Py_CODEUNIT *instr, int oparg);
319-
extern void _Py_Specialize_Send(_PyStackRef receiver, _Py_CODEUNIT *instr);
320-
extern void _Py_Specialize_ToBool(_PyStackRef value, _Py_CODEUNIT *instr);
321-
extern void _Py_Specialize_ContainsOp(_PyStackRef value, _Py_CODEUNIT *instr);
322-
extern void _Py_GatherStats_GetIter(_PyStackRef iterable);
319+
PyAPI_FUNC(void) _Py_Specialize_ForIter(_PyStackRef iter, _PyStackRef null_or_index, _Py_CODEUNIT *instr, int oparg);
320+
PyAPI_FUNC(void) _Py_Specialize_Send(_PyStackRef receiver, _Py_CODEUNIT *instr);
321+
PyAPI_FUNC(void) _Py_Specialize_ToBool(_PyStackRef value, _Py_CODEUNIT *instr);
322+
PyAPI_FUNC(void) _Py_Specialize_ContainsOp(_PyStackRef value, _Py_CODEUNIT *instr);
323+
PyAPI_FUNC(void) _Py_GatherStats_GetIter(_PyStackRef iterable);
323324

324325
// Utility functions for reading/writing 32/64-bit values in the inline caches.
325326
// Great care should be taken to ensure that these functions remain correct and
@@ -514,7 +515,7 @@ typedef struct {
514515

515516
#define COMPARISON_NOT_EQUALS (COMPARISON_UNORDERED | COMPARISON_LESS_THAN | COMPARISON_GREATER_THAN)
516517

517-
extern int _Py_Instrument(PyCodeObject *co, PyInterpreterState *interp);
518+
PyAPI_FUNC(int) _Py_Instrument(PyCodeObject *co, PyInterpreterState *interp);
518519

519520
extern _Py_CODEUNIT _Py_GetBaseCodeUnit(PyCodeObject *code, int offset);
520521

Include/internal/pycore_dict.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ PyAPI_FUNC(int) _PyDict_SetItem_KnownHash_LockHeld(PyDictObject *mp, PyObject *k
144144
PyAPI_FUNC(int) _PyDict_GetItemRef_KnownHash_LockHeld(PyDictObject *op, PyObject *key, Py_hash_t hash, PyObject **result);
145145
extern int _PyDict_GetItemRef_KnownHash(PyDictObject *op, PyObject *key, Py_hash_t hash, PyObject **result);
146146
extern int _PyDict_GetItemRef_Unicode_LockHeld(PyDictObject *op, PyObject *key, PyObject **result);
147-
extern int _PyObjectDict_SetItem(PyTypeObject *tp, PyObject *obj, PyObject **dictptr, PyObject *name, PyObject *value);
147+
PyAPI_FUNC(int) _PyObjectDict_SetItem(PyTypeObject *tp, PyObject *obj, PyObject **dictptr, PyObject *name, PyObject *value);
148148

149149
extern int _PyDict_Pop_KnownHash(
150150
PyDictObject *dict,

Include/internal/pycore_function.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ extern "C" {
88
# error "this header requires Py_BUILD_CORE define"
99
#endif
1010

11-
extern PyObject* _PyFunction_Vectorcall(
11+
PyAPI_FUNC(PyObject *) _PyFunction_Vectorcall(
1212
PyObject *func,
1313
PyObject *const *stack,
1414
size_t nargsf,

Include/internal/pycore_genobject.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ PyAPI_FUNC(int) _PyGen_SetStopIterationValue(PyObject *);
3131
PyAPI_FUNC(int) _PyGen_FetchStopIterationValue(PyObject **);
3232

3333
PyAPI_FUNC(PyObject *)_PyCoro_GetAwaitableIter(PyObject *o);
34-
extern PyObject *_PyAsyncGenValueWrapperNew(PyThreadState *state, PyObject *);
34+
PyAPI_FUNC(PyObject *)_PyAsyncGenValueWrapperNew(PyThreadState *state, PyObject *);
3535

3636
extern PyTypeObject _PyCoroWrapper_Type;
3737
extern PyTypeObject _PyAsyncGenWrappedValue_Type;

0 commit comments

Comments
 (0)