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 passing flags as strings #52

Merged
merged 2 commits into from
Nov 8, 2024

Conversation

sirosen
Copy link
Contributor

@sirosen sirosen commented Nov 4, 2024

resolves #51

There is no support for Flags structs as provided by the regress crate. But a string can be passed down and is converted to Flags by the with_flags constructor.
Exposing flags as a struct/enum adds significant complexity deemed not worth the additional code at this time. (See #51 for more details.)

A python test verifies that the alternate constructor pattern works and provides support for the "u" flag.

EDIT: 🤫 minor force-push. I botched the style rule by removing a line of whitespace by mistake.

resolves crate-py#51

There is no support for `Flags` structs as provided by the `regress`
crate. But a string can be passed down and is converted to Flags by
the `with_flags` constructor.
Exposing flags as a struct/enum adds significant complexity deemed
not worth the additional code at this time.
(See crate-py#51 for more details.)

A python test verifies that the alternate constructor pattern works
and provides support for the `"u"` flag.
@Julian
Copy link
Member

Julian commented Nov 5, 2024

I'll try to look at this tomorrow, but just because it's a common thing to forget (until PyO3/pyo3#2454 is resolved) -- can you update the rpds.pyi as well for this?

@sirosen
Copy link
Contributor Author

sirosen commented Nov 7, 2024

I just pushed a change for the type-stubs. I didn't realize that was independent of the pyo3 process.
It also allowed me to solve another issue I've run into -- RegressError not being exposed. I included it in the changeset.

@Julian
Copy link
Member

Julian commented Nov 8, 2024

OK, let's go with this for now then, can always give the other implementation another shot down the line. Appreciated as usual!

@Julian Julian merged commit 3dbc35c into crate-py:main Nov 8, 2024
27 checks passed
@sirosen sirosen deleted the expose-flags branch November 8, 2024 13:31
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.

Feature request: expose 'with_flags' to allow compilation of unicode patterns
2 participants