Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for extracting Rust set types from frozenset #3632

Merged
merged 1 commit into from
Dec 7, 2023

Conversation

messense
Copy link
Member

@messense messense commented Dec 7, 2023

The conversion table is lying currently...

| `frozenset[T]` | `HashSet<T>`, `BTreeSet<T>`, `hashbrown::HashSet<T>`[^3] | `&PyFrozenSet` |

In [4]: nh3.clean("<b><img src='' onerror='alert(\\'hax\\')'>I'm not trying to XSS you</b>", tags=frozenset())
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Cell In[4], line 1
----> 1 nh3.clean("<b><img src='' onerror='alert(\\'hax\\')'>I'm not trying to XSS you</b>", tags=frozenset())

TypeError: argument 'tags': 'frozenset' object cannot be converted to 'PySet'

@messense messense changed the title Add supoort for extracting Rust set types from frozenset Add support for extracting Rust set types from frozenset Dec 7, 2023
Copy link

codspeed-hq bot commented Dec 7, 2023

CodSpeed Performance Report

Merging #3632 will improve performances by 22.03%

Comparing messense:extract-frozen-set (c21a84d) with main (07726ae)

Summary

⚡ 1 improvements
✅ 77 untouched benchmarks

Benchmarks breakdown

Benchmark main messense:extract-frozen-set Change
not_a_list_via_downcast 153.9 ns 126.1 ns +22.03%

Copy link
Member

@davidhewitt davidhewitt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep this makes total sense to add 👍

@davidhewitt davidhewitt added this pull request to the merge queue Dec 7, 2023
Merged via the queue into PyO3:main with commit 24d9113 Dec 7, 2023
36 of 37 checks passed
@messense messense deleted the extract-frozen-set branch December 7, 2023 23:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants