Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b2db87b

Browse files
committed
Merge remote-tracking branch 'upstream/main' into 45711-exc_info_just_value
2 parents 458ad26 + c5d18a5 commit b2db87b

File tree

18 files changed

+187
-93
lines changed

18 files changed

+187
-93
lines changed

Doc/library/zipimport.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ and a path within the archive can be specified to only import from a
2323
subdirectory. For example, the path :file:`example.zip/lib/` would only
2424
import from the :file:`lib/` subdirectory within the archive.
2525

26-
Any files may be present in the ZIP archive, but only files :file:`.py` and
27-
:file:`.pyc` are available for import. ZIP import of dynamic modules
26+
Any files may be present in the ZIP archive, but importers are only invoked for
27+
:file:`.py` and :file:`.pyc` files. ZIP import of dynamic modules
2828
(:file:`.pyd`, :file:`.so`) is disallowed. Note that if an archive only contains
2929
:file:`.py` files, Python will not attempt to modify the archive by adding the
3030
corresponding :file:`.pyc` file, meaning that if a ZIP archive

Doc/tutorial/classes.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -797,7 +797,7 @@ using the :func:`next` built-in function; this example shows how it all works::
797797
>>> s = 'abc'
798798
>>> it = iter(s)
799799
>>> it
800-
<iterator object at 0x00A1DB50>
800+
<str_iterator object at 0x10c90e650>
801801
>>> next(it)
802802
'a'
803803
>>> next(it)

Include/internal/pycore_code.h

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -276,22 +276,11 @@ void _Py_Specialize_BinaryOp(PyObject *lhs, PyObject *rhs, _Py_CODEUNIT *instr,
276276
SpecializedCacheEntry *cache);
277277
void _Py_Specialize_CompareOp(PyObject *lhs, PyObject *rhs, _Py_CODEUNIT *instr, SpecializedCacheEntry *cache);
278278

279-
#define PRINT_SPECIALIZATION_STATS 0
280-
#define PRINT_SPECIALIZATION_STATS_DETAILED 0
281-
#define PRINT_SPECIALIZATION_STATS_TO_FILE 0
282279

283-
#ifdef Py_DEBUG
284-
#define COLLECT_SPECIALIZATION_STATS 1
285-
#define COLLECT_SPECIALIZATION_STATS_DETAILED 1
286-
#else
287-
#define COLLECT_SPECIALIZATION_STATS PRINT_SPECIALIZATION_STATS
288-
#define COLLECT_SPECIALIZATION_STATS_DETAILED PRINT_SPECIALIZATION_STATS_DETAILED
289-
#endif
280+
#ifdef Py_STATS
290281

291282
#define SPECIALIZATION_FAILURE_KINDS 30
292283

293-
#if COLLECT_SPECIALIZATION_STATS
294-
295284
typedef struct _stats {
296285
uint64_t specialization_success;
297286
uint64_t specialization_failure;
@@ -300,15 +289,13 @@ typedef struct _stats {
300289
uint64_t miss;
301290
uint64_t deopt;
302291
uint64_t unquickened;
303-
#if COLLECT_SPECIALIZATION_STATS_DETAILED
304292
uint64_t specialization_failure_kinds[SPECIALIZATION_FAILURE_KINDS];
305-
#endif
306293
} SpecializationStats;
307294

308295
extern SpecializationStats _specialization_stats[256];
309296
#define STAT_INC(opname, name) _specialization_stats[opname].name++
310297
#define STAT_DEC(opname, name) _specialization_stats[opname].name--
311-
void _Py_PrintSpecializationStats(void);
298+
void _Py_PrintSpecializationStats(int to_file);
312299

313300
PyAPI_FUNC(PyObject*) _Py_GetSpecializationStats(void);
314301

Include/opcode.h

Lines changed: 26 additions & 24 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Lib/inspect.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232

3333
__author__ = ('Ka-Ping Yee <[email protected]>',
3434
'Yury Selivanov <[email protected]>')
35-
35+
3636
__all__ = [
3737
"ArgInfo",
3838
"Arguments",
@@ -131,7 +131,7 @@
131131
"walktree",
132132
]
133133

134-
134+
135135
import abc
136136
import ast
137137
import dis
@@ -591,7 +591,7 @@ def getmembers_static(object, predicate=None):
591591
without triggering dynamic lookup via the descriptor protocol,
592592
__getattr__ or __getattribute__. Optionally, only return members that
593593
satisfy a given predicate.
594-
594+
595595
Note: this function may not be able to retrieve all members
596596
that getmembers can fetch (like dynamically created attributes)
597597
and may find members that getmembers can't (like descriptors

Lib/opcode.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,8 @@ def jabs_op(name, op):
259259
"CALL_NO_KW_PY_SIMPLE",
260260
"CALL_NO_KW_LIST_APPEND",
261261
"CALL_NO_KW_METHOD_DESCRIPTOR_O",
262+
"CALL_NO_KW_TYPE_1",
263+
"CALL_NO_KW_BUILTIN_CLASS_1",
262264
"CALL_NO_KW_METHOD_DESCRIPTOR_FAST",
263265
"JUMP_ABSOLUTE_QUICK",
264266
"LOAD_ATTR_ADAPTIVE",

Lib/test/test_getpath.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -534,7 +534,7 @@ def test_symlink_buildpath_macos(self):
534534
VERSION_MINOR=8, # of testing
535535
PYWINVER=None,
536536
EXE_SUFFIX=None,
537-
537+
538538
ENV_PATH="",
539539
ENV_PYTHONHOME="",
540540
ENV_PYTHONEXECUTABLE="",

Lib/test/test_inspect.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ def istest(self, predicate, exp):
109109

110110
def test__all__(self):
111111
support.check__all__(self, inspect, not_exported=("k", "v", "mod_dict", "modulesbyfile"))
112-
112+
113113
def generator_function_example(self):
114114
for i in range(2):
115115
yield i
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Add a --with-pystats configure option to turn on internal statistics
2+
gathering.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Specialize the CALL_FUNCTION instruction for calls to builtin types with a
2+
single argument. Speeds up ``range(x)``, ``list(x)``, and specifically
3+
``type(obj)``.

0 commit comments

Comments
 (0)