Skip to content

Commit

Permalink
Fix errors in manifests
Browse files Browse the repository at this point in the history
preserve_locals/globals should be a list.
Cast it to a list if it looks like it has mistaken been passed as a string.
  • Loading branch information
dflook committed Sep 5, 2024
1 parent e128644 commit 03ec99a
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 16 deletions.
4 changes: 4 additions & 0 deletions src/python_minifier/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,12 @@ def minify(

if preserve_locals is None:
preserve_locals = []
elif isinstance(preserve_locals, str):
preserve_locals = [preserve_locals]
if preserve_globals is None:
preserve_globals = []
elif isinstance(preserve_globals, str):
preserve_globals = [preserve_globals]

preserve_locals.extend(module.preserved)
preserve_globals.extend(module.preserved)
Expand Down
12 changes: 8 additions & 4 deletions xtest/manifests/python3.10_test_manifest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -865,17 +865,21 @@
rename_globals: true
/usr/local/lib/python3.10/test/test_contextlib_async.py:
- options:
preserve_locals: baz
preserve_locals:
- baz
- options:
rename_globals: true
preserve_locals: baz
preserve_locals:
- baz
- options:
remove_literal_statements: true
preserve_locals: baz
preserve_locals:
- baz
- options:
remove_literal_statements: true
rename_globals: true
preserve_locals: baz
preserve_locals:
- baz
/usr/local/lib/python3.10/test/test_copy.py:
- options: {}
- options:
Expand Down
24 changes: 16 additions & 8 deletions xtest/manifests/python3.11_test_manifest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -188,17 +188,21 @@
/usr/local/lib/python3.11/test/test_asyncio/test_futures.py: []
/usr/local/lib/python3.11/test/test_asyncio/test_futures2.py:
- options:
preserve_locals: future
preserve_locals:
- future
- options:
rename_globals: true
preserve_locals: future
preserve_locals:
- future
- options:
remove_literal_statements: true
preserve_locals: future
preserve_locals:
- future
- options:
remove_literal_statements: true
rename_globals: true
preserve_locals: future
preserve_locals:
- future
/usr/local/lib/python3.11/test/test_asyncio/test_locks.py:
- options: {}
- options:
Expand Down Expand Up @@ -2904,17 +2908,21 @@
rename_globals: true
/usr/local/lib/python3.11/test/test_opcache.py:
- options:
preserve_locals: Class
preserve_locals:
- Class
- options:
rename_globals: true
preserve_locals: Class
preserve_locals:
- Class
- options:
remove_literal_statements: true
preserve_locals: Class
preserve_locals:
- Class
- options:
remove_literal_statements: true
rename_globals: true
preserve_locals: Class
preserve_locals:
- Class
/usr/local/lib/python3.11/test/test_opcodes.py:
- options: {}
- options:
Expand Down
12 changes: 8 additions & 4 deletions xtest/manifests/python3.12_test_manifest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4740,20 +4740,24 @@
status: passing
/usr/local/lib/python3.12/test/test_opcache.py:
- options:
preserve_locals: Class
preserve_locals:
- Class
remove_literal_statements: true
rename_globals: true
status: passing
- options:
preserve_locals: Class
preserve_locals:
- Class
rename_globals: true
status: passing
- options:
preserve_locals: Class
preserve_locals:
- Class
remove_literal_statements: true
status: passing
- options:
preserve_locals: Class
preserve_locals:
- Class
status: passing
/usr/local/lib/python3.12/test/test_opcodes.py:
- options:
Expand Down

0 comments on commit 03ec99a

Please sign in to comment.