| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 531cf2b commit 96925f4
20 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -97,6 +97,13 @@ jobs: | |||
| 97 | 97 | ||
| 98 | 98 | - uses: dtolnay/rust-toolchain@stable | |
| 99 | 99 | ||
| 100 | + - name: Use a short Cargo home on Windows | ||
| 101 | + if: runner.os == 'Windows' | ||
| 102 | + shell: pwsh | ||
| 103 | + run: | | ||
| 104 | + "CARGO_HOME=$env:RUNNER_TEMP\c" >> $env:GITHUB_ENV | ||
| 105 | + git config --global core.longpaths true | ||
| 106 | + | ||
| 100 | 107 | - name: Restore cache | |
| 101 | 108 | uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 | |
| 102 | 109 | with: | |
@@ -105,6 +112,9 @@ jobs: | |||
| 105 | 112 | ~/.cargo/registry/index/ | |
| 106 | 113 | ~/.cargo/registry/cache/ | |
| 107 | 114 | ~/.cargo/git/db/ | |
| 115 | + ${{ runner.temp }}/c/registry/index/ | ||
| 116 | + ${{ runner.temp }}/c/registry/cache/ | ||
| 117 | + ${{ runner.temp }}/c/git/db/ | ||
| 108 | 118 | target/ | |
| 109 | 119 | key: ${{ runner.os }}-${{ hashFiles('**/Cargo.toml') }}- | |
| 110 | 120 | restore-keys: | | |
@@ -338,6 +348,13 @@ jobs: | |||
| 338 | 348 | ||
| 339 | 349 | - uses: dtolnay/rust-toolchain@stable | |
| 340 | 350 | ||
| 351 | + - name: Use a short Cargo home on Windows | ||
| 352 | + if: runner.os == 'Windows' | ||
| 353 | + shell: pwsh | ||
| 354 | + run: | | ||
| 355 | + "CARGO_HOME=$env:RUNNER_TEMP\c" >> $env:GITHUB_ENV | ||
| 356 | + git config --global core.longpaths true | ||
| 357 | + | ||
| 341 | 358 | - name: Restore cache | |
| 342 | 359 | uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 | |
| 343 | 360 | with: | |
@@ -346,6 +363,9 @@ jobs: | |||
| 346 | 363 | ~/.cargo/registry/index/ | |
| 347 | 364 | ~/.cargo/registry/cache/ | |
| 348 | 365 | ~/.cargo/git/db/ | |
| 366 | + ${{ runner.temp }}/c/registry/index/ | ||
| 367 | + ${{ runner.temp }}/c/registry/cache/ | ||
| 368 | + ${{ runner.temp }}/c/git/db/ | ||
| 349 | 369 | target/ | |
| 350 | 370 | key: ${{ runner.os }}-${{ hashFiles('**/Cargo.toml') }}- | |
| 351 | 371 | restore-keys: | | |
@@ -499,6 +519,13 @@ jobs: | |||
| 499 | 519 | with: | |
| 500 | 520 | components: clippy | |
| 501 | 521 | ||
| 522 | + - name: Use a short Cargo home on Windows | ||
| 523 | + if: runner.os == 'Windows' | ||
| 524 | + shell: pwsh | ||
| 525 | + run: | | ||
| 526 | + "CARGO_HOME=$env:RUNNER_TEMP\c" >> $env:GITHUB_ENV | ||
| 527 | + git config --global core.longpaths true | ||
| 528 | + | ||
| 502 | 529 | - name: Restore cache | |
| 503 | 530 | uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 | |
| 504 | 531 | with: | |
@@ -507,6 +534,9 @@ jobs: | |||
| 507 | 534 | ~/.cargo/registry/index/ | |
| 508 | 535 | ~/.cargo/registry/cache/ | |
| 509 | 536 | ~/.cargo/git/db/ | |
| 537 | + ${{ runner.temp }}/c/registry/index/ | ||
| 538 | + ${{ runner.temp }}/c/registry/cache/ | ||
| 539 | + ${{ runner.temp }}/c/git/db/ | ||
| 510 | 540 | target/ | |
| 511 | 541 | key: ${{ runner.os }}-${{ hashFiles('**/Cargo.toml') }}- | |
| 512 | 542 | restore-keys: | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -60,6 +60,13 @@ jobs: | |||
| 60 | 60 | with: | |
| 61 | 61 | target: ${{ matrix.target }} | |
| 62 | 62 | ||
| 63 | + - name: Use a short Cargo home on Windows | ||
| 64 | + if: runner.os == 'Windows' | ||
| 65 | + shell: pwsh | ||
| 66 | + run: | | ||
| 67 | + "CARGO_HOME=$env:RUNNER_TEMP\c" >> $env:GITHUB_ENV | ||
| 68 | + git config --global core.longpaths true | ||
| 69 | + | ||
| 63 | 70 | - name: Install macOS dependencies | |
| 64 | 71 | uses: ./.github/actions/install-macos-deps | |
| 65 | 72 | with: | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -52,6 +52,13 @@ jobs: | |||
| 52 | 52 | toolchain: ${{ matrix.toolchain }} | |
| 53 | 53 | target: ${{ matrix.target }} | |
| 54 | 54 | ||
| 55 | + - name: Use a short Cargo home on Windows | ||
| 56 | + if: runner.os == 'Windows' | ||
| 57 | + shell: pwsh | ||
| 58 | + run: | | ||
| 59 | + "CARGO_HOME=$env:RUNNER_TEMP\c" >> $env:GITHUB_ENV | ||
| 60 | + git config --global core.longpaths true | ||
| 61 | + | ||
| 55 | 62 | - name: Install macos dependencies | |
| 56 | 63 | uses: ./.github/actions/install-macos-deps | |
| 57 | 64 | with: | |
@@ -74,5 +81,8 @@ jobs: | |||
| 74 | 81 | ~/.cargo/registry/index/ | |
| 75 | 82 | ~/.cargo/registry/cache/ | |
| 76 | 83 | ~/.cargo/git/db/ | |
| 84 | + ${{ runner.temp }}/c/registry/index/ | ||
| 85 | + ${{ runner.temp }}/c/registry/cache/ | ||
| 86 | + ${{ runner.temp }}/c/git/db/ | ||
| 77 | 87 | target/ | |
| 78 | 88 | key: ${{ runner.os }}-${{ matrix.toolchain }}-${{ matrix.target }}-${{ hashFiles('**/Cargo.toml') }}-${{ hashFiles('Cargo.lock') }}-${{ github.sha }} | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -184,10 +184,10 @@ rustpython-wtf8 = { path = "crates/wtf8", version = "0.5.0" } | |||
| 184 | 184 | rustpython-doc = { path = "crates/doc", version = "0.5.0" } | |
| 185 | 185 | ||
| 186 | 186 | # Use the RustPython Ruff fork for RustPython public `_ast` metadata. | |
| 187 | - ruff_python_parser = { package = "rustpython-ruff_python_parser", git = "https://github.com/RustPython/ruff.git", tag = "0.15.19-rustpython" } | ||
| 188 | - ruff_python_ast = { package = "rustpython-ruff_python_ast", git = "https://github.com/RustPython/ruff.git", tag = "0.15.19-rustpython" } | ||
| 189 | - ruff_text_size = { package = "rustpython-ruff_text_size", git = "https://github.com/RustPython/ruff.git", tag = "0.15.19-rustpython" } | ||
| 190 | - ruff_source_file = { package = "rustpython-ruff_source_file", git = "https://github.com/RustPython/ruff.git", tag = "0.15.19-rustpython" } | ||
| 187 | + ruff_python_parser = { package = "rustpython-ruff_python_parser", git = "https://github.com/RustPython/ruff.git", tag = "0.16.5-rustpython" } | ||
| 188 | + ruff_python_ast = { package = "rustpython-ruff_python_ast", git = "https://github.com/RustPython/ruff.git", tag = "0.16.5-rustpython" } | ||
| 189 | + ruff_text_size = { package = "rustpython-ruff_text_size", git = "https://github.com/RustPython/ruff.git", tag = "0.16.5-rustpython" } | ||
| 190 | + ruff_source_file = { package = "rustpython-ruff_source_file", git = "https://github.com/RustPython/ruff.git", tag = "0.16.5-rustpython" } | ||
| 191 | 191 | ||
| 192 | 192 | der = { version = "0.8", features = ["alloc", "oid", "pem", "zeroize"] } | |
| 193 | 193 | phf = { version = "0.14.0", default-features = false, features = ["macros"]} | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1468,7 +1468,7 @@ | |||
| 1468 | 1468 | Traceback (most recent call last): | |
| 1469 | 1469 | SyntaxError: invalid syntax | |
| 1470 | 1470 | ||
| 1471 | - >>> dict(x=34, x=1, y=2); x $ y # TODO: RUSTPYTHON; Wrong error message # doctest: +EXPECTED_FAILURE | ||
| 1471 | + >>> dict(x=34, x=1, y=2); x $ y | ||
| 1472 | 1472 | Traceback (most recent call last): | |
| 1473 | 1473 | SyntaxError: invalid syntax | |
| 1474 | 1474 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -24,7 +24,7 @@ use malachite_bigint::BigInt; | |||
| 24 | 24 | use num_complex::Complex; | |
| 25 | 25 | use num_traits::{Num, ToPrimitive, Zero}; | |
| 26 | 26 | use ruff_python_ast::{self as ast, name::Name}; | |
| 27 | - use ruff_text_size::{Ranged, TextRange, TextSize}; | ||
| 27 | + use ruff_text_size::{Ranged, TextRange, TextSize, TextSlice}; | ||
| 28 | 28 | use rustpython_compiler_core::{ | |
| 29 | 29 | Mode, OneIndexed, PositionEncoding, SourceFile, SourceLocation, | |
| 30 | 30 | bytecode::{ | |
@@ -9129,7 +9129,12 @@ impl<'warnings> Compiler<'warnings> { | |||
| 9129 | 9129 | range, | |
| 9130 | 9130 | .. | |
| 9131 | 9131 | }) => { | |
| 9132 | - let key = key.as_ref(); | ||
| 9132 | + let Some(key) = key.as_deref() else { | ||
| 9133 | + self.set_source_range(*range); | ||
| 9134 | + return Err(self.error(CodegenErrorType::SyntaxError( | ||
| 9135 | + "dict unpacking cannot be used in dict comprehension".to_owned(), | ||
| 9136 | + ))); | ||
| 9137 | + }; | ||
| 9133 | 9138 | self.compile_comprehension( | |
| 9134 | 9139 | "<dictcomp>", | |
| 9135 | 9140 | Some( | |
@@ -9644,7 +9649,11 @@ impl<'warnings> Compiler<'warnings> { | |||
| 9644 | 9649 | continue; | |
| 9645 | 9650 | }; | |
| 9646 | 9651 | for other in &keywords[i + 1..] { | |
| 9647 | - if other.arg.as_ref() == Some(arg) { | ||
| 9652 | + if other | ||
| 9653 | + .arg | ||
| 9654 | + .as_ref() | ||
| 9655 | + .is_some_and(|other| other.as_str() == arg.as_str()) | ||
| 9656 | + { | ||
| 9648 | 9657 | return Err(self.error_ranged( | |
| 9649 | 9658 | CodegenErrorType::SyntaxError(format!("keyword argument repeated: {arg}")), | |
| 9650 | 9659 | other.range, | |
@@ -10067,7 +10076,11 @@ impl<'warnings> Compiler<'warnings> { | |||
| 10067 | 10076 | self.visit_expr(&first.iter); | |
| 10068 | 10077 | } | |
| 10069 | 10078 | if self.consume_inlined_comprehension_scope() { | |
| 10070 | - self.visit_comprehension_tail(key, Some(value), generators); | ||
| 10079 | + if let Some(key) = key.as_deref() { | ||
| 10080 | + self.visit_comprehension_tail(key, Some(value), generators); | ||
| 10081 | + } else { | ||
| 10082 | + self.visit_comprehension_tail(value, None, generators); | ||
| 10083 | + } | ||
| 10071 | 10084 | } else { | |
| 10072 | 10085 | self.consume_scope(); | |
| 10073 | 10086 | } | |
@@ -13249,9 +13262,10 @@ impl<'warnings> Compiler<'warnings> { | |||
| 13249 | 13262 | { | |
| 13250 | 13263 | let after_brace = interp.range.start() + TextSize::new(1); | |
| 13251 | 13264 | self.source_file | |
| 13265 | + .source_text() | ||
| 13252 | 13266 | .slice(TextRange::new(after_brace, expr_range.end())) | |
| 13253 | 13267 | } else { | |
| 13254 | - self.source_file.slice(expr_range) | ||
| 13268 | + self.source_file.source_text().slice(expr_range) | ||
| 13255 | 13269 | } | |
| 13256 | 13270 | .to_string(); | |
| 13257 | 13271 | self.set_source_range(interp.range); | |
@@ -13843,7 +13857,7 @@ mod tests { | |||
| 13843 | 13857 | fn frozenset_call_expr() -> ast::Expr { | |
| 13844 | 13858 | ast::Expr::Call(ast::ExprCall { | |
| 13845 | 13859 | node_index: ast::AtomicNodeIndex::NONE, | |
| 13846 | - range: TextRange::default(), | ||
| 13860 | + range_start: TextSize::default(), | ||
| 13847 | 13861 | func: Box::new(ast::Expr::Name(ast::ExprName { | |
| 13848 | 13862 | node_index: ast::AtomicNodeIndex::NONE, | |
| 13849 | 13863 | range: TextRange::default(), | |
@@ -13996,7 +14010,7 @@ mod tests { | |||
| 13996 | 14010 | ); | |
| 13997 | 14011 | let message = first_ast_constant_warning(ast::Expr::Call(ast::ExprCall { | |
| 13998 | 14012 | node_index: ast::AtomicNodeIndex::NONE, | |
| 13999 | - range: TextRange::default(), | ||
| 14013 | + range_start: TextSize::default(), | ||
| 14000 | 14014 | func: Box::new(func), | |
| 14001 | 14015 | arguments: ast::Arguments { | |
| 14002 | 14016 | node_index: ast::AtomicNodeIndex::NONE, | |
| Back | FazBrowse Home | New Git URL |
0 commit comments