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
3 changes: 1 addition & 2 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -298,8 +298,7 @@ InternalDocs/jit.md @brandtbucher @savannahostrowski @diegorusso @AA-T
# Lazy imports (PEP 810)
Objects/lazyimportobject.c @yhg1s @DinoV @pablogsal
Include/internal/pycore_lazyimportobject.h @yhg1s @DinoV @pablogsal
Lib/test/test_import/test_lazy_imports.py @yhg1s @DinoV @pablogsal
Lib/test/test_import/data/lazy_imports/ @yhg1s @DinoV @pablogsal
Lib/test/test_lazy_import @yhg1s @DinoV @pablogsal

# Micro-op / μop / Tier 2 Optimiser
Python/optimizer.c @markshannon @Fidget-Spinner
Expand Down
2 changes: 2 additions & 0 deletions Grammar/python.gram
Original file line number Diff line number Diff line change
Expand Up @@ -1447,6 +1447,8 @@ invalid_import_from_targets:
RAISE_SYNTAX_ERROR_STARTING_FROM(token, "Expected one or more names after 'import'") }

invalid_with_stmt:
| ['async'] 'with' ','.(expression ['as' star_target])+ trailing=',' ':' {
RAISE_SYNTAX_ERROR_KNOWN_LOCATION(trailing, "the last 'with' item has a trailing comma") }
| ['async'] 'with' ','.(expression ['as' star_target])+ NEWLINE { RAISE_SYNTAX_ERROR("expected ':'") }
| ['async'] 'with' '(' ','.(expressions ['as' star_target])+ ','? ')' NEWLINE { RAISE_SYNTAX_ERROR("expected ':'") }
invalid_with_stmt_indent:
Expand Down
3 changes: 2 additions & 1 deletion Lib/profiling/sampling/sample.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,8 @@ def sample(self, collector, duration_sec=None, *, async_aware=False):
# Don't print stats for live mode (curses is handling display)
is_live_mode = LiveStatsCollector is not None and isinstance(collector, LiveStatsCollector)
if not is_live_mode:
print(f"Captured {num_samples:n} samples in {fmt(running_time_sec, 2)} seconds")
s = "" if num_samples == 1 else "s"
print(f"Captured {num_samples:n} sample{s} in {fmt(running_time_sec, 2)} seconds")
print(f"Sample rate: {fmt(sample_rate, 2)} samples/sec")
print(f"Error rate: {fmt(error_rate, 2)}")

Expand Down
8 changes: 6 additions & 2 deletions Lib/profiling/sampling/stack_collector.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,13 @@ def export(self, filename):
num_functions = len(flamegraph_data.get("children", []))
total_time = flamegraph_data.get("value", 0)
string_count = len(self._string_table)
s1 = "" if num_functions == 1 else "s"
s2 = "" if total_time == 1 else "s"
s3 = "" if string_count == 1 else "s"
print(
f"Flamegraph data: {num_functions} root functions, total samples: {total_time}, "
f"{string_count} unique strings"
f"Flamegraph data: {num_functions} root function{s1}, "
f"{total_time} total sample{s2}, "
f"{string_count} unique string{s3}"
)

if num_functions == 0:
Expand Down
5 changes: 3 additions & 2 deletions Lib/test/.ruff.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ extend-exclude = [
# and tests re-use the same names as only the grammar is being checked.
"test_grammar.py",
# Lazy import syntax (PEP 810) is not yet supported by Ruff
"test_import/data/lazy_imports/*.py",
"test_import/data/lazy_imports/**/*.py",
"test_lazy_import/__init__.py",
"test_lazy_import/data/*.py",
"test_lazy_import/data/**/*.py",
]

[lint]
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

2 changes: 0 additions & 2 deletions Lib/test/test_import/data/lazy_imports/basic_dir.py

This file was deleted.

This file was deleted.

1 change: 0 additions & 1 deletion Lib/test/test_import/data/lazy_imports/basic_unused.py

This file was deleted.

3 changes: 0 additions & 3 deletions Lib/test/test_import/data/lazy_imports/basic_used.py

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

3 changes: 0 additions & 3 deletions Lib/test/test_import/data/lazy_imports/eager_import_func.py

This file was deleted.

5 changes: 0 additions & 5 deletions Lib/test/test_import/data/lazy_imports/global_off.py

This file was deleted.

5 changes: 0 additions & 5 deletions Lib/test/test_import/data/lazy_imports/global_on.py

This file was deleted.

6 changes: 0 additions & 6 deletions Lib/test/test_import/data/lazy_imports/lazy_compat_from.py

This file was deleted.

2 changes: 0 additions & 2 deletions Lib/test/test_import/data/lazy_imports/lazy_import_pkg.py

This file was deleted.

3 changes: 0 additions & 3 deletions Lib/test/test_import/data/lazy_imports/lazy_with.py

This file was deleted.

3 changes: 0 additions & 3 deletions Lib/test/test_import/data/lazy_imports/lazy_with_from.py

This file was deleted.

5 changes: 0 additions & 5 deletions Lib/test/test_import/data/lazy_imports/modules_dict.py

This file was deleted.

5 changes: 0 additions & 5 deletions Lib/test/test_import/data/lazy_imports/modules_getattr.py

This file was deleted.

This file was deleted.

4 changes: 0 additions & 4 deletions Lib/test/test_import/data/lazy_imports/try_except_eager.py

This file was deleted.

This file was deleted.

Loading
Loading