-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Use cfg_select in a bunch more places #7740
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
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,12 +1,7 @@ | ||
| #[cfg(not(feature = "threading"))] | ||
| use alloc::rc::Rc; | ||
| #[cfg(feature = "threading")] | ||
| use alloc::sync::Arc; | ||
|
|
||
| // type aliases instead of new-types because you can't do `fn method(self: PyRc<Self>)` with a | ||
| // newtype; requires the arbitrary_self_types unstable feature | ||
|
|
||
| #[cfg(feature = "threading")] | ||
| pub type PyRc<T> = Arc<T>; | ||
| #[cfg(not(feature = "threading"))] | ||
| pub type PyRc<T> = Rc<T>; | ||
| pub type PyRc<T> = cfg_select! { | ||
| feature = "threading" => alloc::sync::Arc::<T>, | ||
| _ => alloc::rc::Rc::<T>, | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🌐 Web query:
In OpenSSL, what minimum version introduced SSL_CTX_get_num_tickets and SSL_CTX_set_num_tickets?💡 Result:
The minimum OpenSSL version that introduced both SSL_CTX_get_num_tickets and SSL_CTX_set_num_tickets is 1.1.1.
Citations:
🏁 Script executed:
Repository: RustPython/RustPython
Length of output: 2008
🏁 Script executed:
Repository: RustPython/RustPython
Length of output: 312
🏁 Script executed:
Repository: RustPython/RustPython
Length of output: 1055
🏁 Script executed:
Repository: RustPython/RustPython
Length of output: 1347
🏁 Script executed:
Repository: RustPython/RustPython
Length of output: 47
🏁 Script executed:
Repository: RustPython/RustPython
Length of output: 154
Change version gates from
ossl110toossl111forSSL_CTX_get_num_ticketsandSSL_CTX_set_num_ticketsSSL_CTX_get_num_ticketsandSSL_CTX_set_num_ticketswere introduced in OpenSSL 1.1.1, not 1.1.0. Using theossl110gate will cause build or link failures on OpenSSL 1.1.0 targets. Both occurrences must be updated to useossl111.Required fix
cfg_select! { - ossl110 => { + ossl111 => { let ctx = self.ctx(); let num = unsafe { sys::SSL_CTX_get_num_tickets(ctx.as_ptr()) }; Ok(num) } _ => Ok(0), }cfg_select! { - ossl110 => { + ossl111 => { let ctx = self.builder(); let result = unsafe { sys::SSL_CTX_set_num_tickets(ctx.as_ptr(), value as usize) }; if result != 1 { return Err(vm.new_value_error("failed to set num tickets.")); } Ok(()) }📝 Committable suggestion
🤖 Prompt for AI Agents