Skip to content

gh-67565: Add tests for the remove redundant C-contiguity checks #110951

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 2 commits into from
Oct 19, 2023

Conversation

furkanonder
Copy link
Contributor

@furkanonder furkanonder commented Oct 16, 2023

@bedevere-app bedevere-app bot added awaiting review tests Tests in the Lib/test dir labels Oct 16, 2023
@furkanonder furkanonder added 3.11 only security fixes 3.12 only security fixes skip news needs backport to 3.11 only security fixes needs backport to 3.12 only security fixes and removed 3.11 only security fixes 3.12 only security fixes labels Oct 17, 2023
Copy link
Member

@serhiy-storchaka serhiy-storchaka left a comment

Choose a reason for hiding this comment

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

LGTM.

@serhiy-storchaka serhiy-storchaka merged commit 9376728 into python:main Oct 19, 2023
@miss-islington-app
Copy link

Thanks @furkanonder for the PR, and @serhiy-storchaka for merging it 🌮🎉.. I'm working now to backport this PR to: 3.11, 3.12.
🐍🍒⛏🤖

@miss-islington-app
Copy link

Sorry, @furkanonder and @serhiy-storchaka, I could not cleanly backport this to 3.12 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker 9376728ce45191fcc0b908c7487ad7985454537e 3.12

@miss-islington-app
Copy link

Sorry, @furkanonder and @serhiy-storchaka, I could not cleanly backport this to 3.11 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker 9376728ce45191fcc0b908c7487ad7985454537e 3.11

furkanonder added a commit to furkanonder/cpython that referenced this pull request Oct 23, 2023
@bedevere-app
Copy link

bedevere-app bot commented Oct 23, 2023

GH-111198 is a backport of this pull request to the 3.12 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.12 only security fixes label Oct 23, 2023
@bedevere-app
Copy link

bedevere-app bot commented Oct 23, 2023

GH-111199 is a backport of this pull request to the 3.11 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.11 only security fixes label Oct 23, 2023
@furkanonder
Copy link
Contributor Author

@serhiy-storchaka The bot couldn't backport the changes because of the conflicts. I opened it manually. Can you merge these PRs?

@serhiy-storchaka
Copy link
Member

Thank you Furkan. Were they all conflicts in Argument Clinic generated code?

@furkanonder
Copy link
Contributor Author

furkanonder commented Oct 23, 2023

Thank you Furkan. Were they all conflicts in Argument Clinic generated code?

The only file that creates conflict is test_binascii.py. It seems that the previous test case and my test case created a conflict.

--- a/Lib/test/test_binascii.py
+++ b/Lib/test/test_binascii.py
@@@ -428,6 -465,21 +428,24 @@@ class BinASCIITest(unittest.TestCase)
          self.assertEqual(binascii.b2a_base64(b, newline=False),
                           b'aGVsbG8=')
  
++<<<<<<< HEAD
++=======
+     @hypothesis.given(
+         binary=hypothesis.strategies.binary(),
+         newline=hypothesis.strategies.booleans(),
+     )
+     def test_base64_roundtrip(self, binary, newline):
+         converted = binascii.b2a_base64(self.type2test(binary), newline=newline)
+         restored = binascii.a2b_base64(self.type2test(converted))
+         self.assertConversion(binary, converted, restored, newline=newline)
+ 
+     def test_c_contiguity(self):
+         m = memoryview(bytearray(b'noncontig'))
+         noncontig_writable = m[::-2]
+         with self.assertRaises(BufferError):
+             binascii.b2a_hex(noncontig_writable)
+ 
++>>>>>>> 9376728ce4 (gh-67565: Add tests for C-contiguity checks (GH-110951))
  
  class ArrayBinASCIITest(BinASCIITest):
      def type2test(self, s):

serhiy-storchaka pushed a commit that referenced this pull request Oct 23, 2023
serhiy-storchaka pushed a commit that referenced this pull request Oct 23, 2023
aisk pushed a commit to aisk/cpython that referenced this pull request Feb 11, 2024
Glyphack pushed a commit to Glyphack/cpython that referenced this pull request Sep 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
skip news tests Tests in the Lib/test dir
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants